Package org.apache.cxf.jaxrs.provider
Class AbstractConfigurableProvider
- java.lang.Object
-
- org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider
-
- Direct Known Subclasses:
AbstractCachingMessageProvider
,AbstractJAXBProvider
,AbstractResponseViewProvider
,BinaryDataProvider
,FormEncodingProvider
,MultipartProvider
,PrimitiveTextProvider
,SourceProvider
,StreamingResponseProvider
,StringTextProvider
public abstract class AbstractConfigurableProvider extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static ResourceBundle
BUNDLE
protected static Logger
LOG
-
Constructor Summary
Constructors Constructor Description AbstractConfigurableProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.cxf.Bus
getBus()
Gets the Bus.List<String>
getConsumeMediaTypes()
Gets the custom Consumes media typesboolean
getEnableBuffering()
Gets the value of the buffering modeboolean
getEnableStreaming()
Gets the value of the streaming modeList<String>
getProduceMediaTypes()
Gets the custom Produces media typesvoid
init(List<ClassResourceInfo> resources)
Gives providers a chance to introspect the JAX-RS model classes.protected boolean
isPayloadEmpty(javax.ws.rs.core.HttpHeaders headers)
protected boolean
isPayloadEmpty(javax.ws.rs.core.MultivaluedMap<String,String> headers)
protected void
reportEmptyContentLength()
void
setBus(org.apache.cxf.Bus b)
Sets the Busvoid
setConsumeMediaTypes(List<String> types)
Sets custom Consumes media types; can be used to override staticConsumes
annotation value set on the provider.void
setEnableBuffering(boolean enableBuf)
Enables the buffering mode.void
setEnableStreaming(boolean enableStream)
Enables the support for streaming.void
setProduceMediaTypes(List<String> types)
Sets custom Produces media types; can be used to override staticProduces
annotation value set on the provider.
-
-
-
Field Detail
-
BUNDLE
protected static final ResourceBundle BUNDLE
-
LOG
protected static final Logger LOG
-
-
Method Detail
-
setBus
public void setBus(org.apache.cxf.Bus b)
Sets the Bus- Parameters:
b
-
-
getBus
public org.apache.cxf.Bus getBus()
Gets the Bus. Providers may use the bus to resolve resource references. Example: ResourceUtils.getResourceStream(reference, this.getBus())- Returns:
-
setConsumeMediaTypes
public void setConsumeMediaTypes(List<String> types)
Sets custom Consumes media types; can be used to override staticConsumes
annotation value set on the provider.- Parameters:
types
- the media types
-
getConsumeMediaTypes
public List<String> getConsumeMediaTypes()
Gets the custom Consumes media types- Returns:
- media types
-
setProduceMediaTypes
public void setProduceMediaTypes(List<String> types)
Sets custom Produces media types; can be used to override staticProduces
annotation value set on the provider.- Parameters:
types
- the media types
-
getProduceMediaTypes
public List<String> getProduceMediaTypes()
Gets the custom Produces media types- Returns:
- media types
-
setEnableBuffering
public void setEnableBuffering(boolean enableBuf)
Enables the buffering mode. If set to true then the runtime will ensure that the provider writes to a cached stream. For example, the JAXB marshalling process may fail after the initial XML tags have already been written out to the HTTP output stream. Enabling the buffering ensures no incomplete payloads are sent back to clients in case of marshalling errors at the cost of the initial buffering - which might be negligible for small payloads.- Parameters:
enableBuf
- the value of the buffering mode, false is default.
-
getEnableBuffering
public boolean getEnableBuffering()
Gets the value of the buffering mode- Returns:
- true if the buffering is enabled
-
setEnableStreaming
public void setEnableStreaming(boolean enableStream)
Enables the support for streaming. XML-aware providers which prefer writing to Stax XMLStreamWriter can set this value to true. Additionally, if the streaming and the buffering modes are enabled, the runtime will ensure the XMLStreamWriter events are cached properly.- Parameters:
enableStream
- the value of the streaming mode, false is default.
-
getEnableStreaming
public boolean getEnableStreaming()
Gets the value of the streaming mode- Returns:
- true if the streaming is enabled
-
init
public void init(List<ClassResourceInfo> resources)
Gives providers a chance to introspect the JAX-RS model classes. For example, the JAXB provider may use the model classes to create a single composite JAXBContext supporting all the JAXB-annotated root resource classes/types.- Parameters:
resources
-
-
isPayloadEmpty
protected boolean isPayloadEmpty(javax.ws.rs.core.HttpHeaders headers)
-
isPayloadEmpty
protected boolean isPayloadEmpty(javax.ws.rs.core.MultivaluedMap<String,String> headers)
-
reportEmptyContentLength
protected void reportEmptyContentLength() throws javax.ws.rs.core.NoContentException
- Throws:
javax.ws.rs.core.NoContentException
-
-