Package org.jboss.resteasy.spi.config
Class Options<T>
- java.lang.Object
-
- org.jboss.resteasy.spi.config.Options<T>
-
public class Options<T> extends Object
Configuration options to be looked up in theConfiguration. Unless noted all options are optional and return a default value if the value was not found in the configuration.- Author:
- James R. Perkins
-
-
Field Summary
Fields Modifier and Type Field Description static Options<Boolean>ENABLE_DEFAULT_EXCEPTION_MAPPERAn option for enabling or disabling the default exception mapper.static Options<Threshold>ENTITY_FILE_THRESHOLDAn option for the threshold of theEntityOutputStreamto write to a file.static Options<Threshold>ENTITY_MEMORY_THRESHOLDAn option for the threshold of theEntityOutputStream.static Options<Integer>SSE_CLOSED_RESPONSE_CODEAn option which allows which HTTP status code should be sent when theSseEventSink.close()is invoked.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)protected static <T> TgetProperty(String name, Class<T> returnType, Supplier<T> dft)Checks theConfigurationfor the property returning the value or the given default.TgetValue()Resolves the value from the configurationinthashCode()Stringname()The key for the property.StringtoString()
-
-
-
Field Detail
-
ENABLE_DEFAULT_EXCEPTION_MAPPER
public static final Options<Boolean> ENABLE_DEFAULT_EXCEPTION_MAPPER
An option for enabling or disabling the default exception mapper. By default the default exception mapper is enabled.
-
ENTITY_MEMORY_THRESHOLD
public static final Options<Threshold> ENTITY_MEMORY_THRESHOLD
An option for the threshold of theEntityOutputStream. The threshold is used to determine when to offload an entity to a file out of memory.The default is 5 MB.
-
ENTITY_FILE_THRESHOLD
public static final Options<Threshold> ENTITY_FILE_THRESHOLD
An option for the threshold of theEntityOutputStreamto write to a file. A value of-1indicates no threshold limit.The default is 50 MB.
-
SSE_CLOSED_RESPONSE_CODE
public static final Options<Integer> SSE_CLOSED_RESPONSE_CODE
An option which allows which HTTP status code should be sent when theSseEventSink.close()is invoked. In some implementations 200 (OK) is the default. However, RESTEasy prefers 204 (No Content) as no content has been sent the response.The default is 204 - No Content
-
-
Method Detail
-
getValue
public T getValue()
Resolves the value from the configuration- Returns:
- the value or the default value which may be
null
-
name
public String name()
The key for the property.- Returns:
- the key for the property
-
getProperty
protected static <T> T getProperty(String name, Class<T> returnType, Supplier<T> dft)
Checks theConfigurationfor the property returning the value or the given default.- Parameters:
name- the name of the propertyreturnType- the type of the propertydft- the default value if the property was not found- Returns:
- the value found in the configuration or the default value
-
-