Apache CXF API

org.apache.cxf.jaxrs.provider
Class AbstractConfigurableProvider

java.lang.Object
  extended by org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider
Direct Known Subclasses:
AbstractJAXBProvider, AtomPojoProvider, BinaryDataProvider, MultipartProvider, RequestDispatcherProvider, SourceProvider, XMLBeansElementProvider

public abstract class AbstractConfigurableProvider
extends Object


Constructor Summary
AbstractConfigurableProvider()
           
 
Method Summary
 Bus getBus()
          Gets the Bus.
 List<String> getConsumeMediaTypes()
          Gets the custom Consumes media types
 boolean getEnableBuffering()
          Gets the value of the buffering mode
 boolean getEnableStreaming()
          Gets the value of the streaming mode
 List<String> getProduceMediaTypes()
          Gets the custom Produces media types
 void init(List<ClassResourceInfo> resources)
          Gives providers a chance to introspect the JAX-RS model classes.
 void setBus(Bus b)
          Sets the Bus
 void setConsumeMediaTypes(List<String> types)
          Sets custom Consumes media types; can be used to override static Consumes 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 static Produces annotation value set on the provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConfigurableProvider

public AbstractConfigurableProvider()
Method Detail

setBus

public void setBus(Bus b)
Sets the Bus

Parameters:
b -

getBus

public 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 static Consumes 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 static Produces 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 -

Apache CXF API

Apache CXF