public interface RestConverter
Implements a filter mechanism for REST method calls that allows response objects to be converted to some other POJO after invocation of the REST method.
Converters are associated with REST methods through the following:
RestResource.converters()
RestMethod.converters()
RestContext.REST_converters
RestContextBuilder.converters(Class...)
RestContextBuilder.converters(RestConverter...)
Converters can also be associated at the servlet level using the @RestResource.converters()
annotation.
Applying converters at the resource level is equivalent to applying converters to each resource method individually.
convert(RestRequest, Object)
and return back a 'converted' object.
Subclasses must implement one of the following constructors:
Subclasses can also be defined as inner classes of the resource class.
Traversable
- Allows URL additional path info to address individual elements in a POJO tree.
Queryable
- Allows query/view/sort functions to be performed on POJOs.
Introspectable
- Allows Java public methods to be invoked on the returned POJOs.
RestContext.REST_converters
- Registering converters with REST resources.
Modifier and Type | Method and Description |
---|---|
Object |
convert(RestRequest req,
Object res)
Performs post-call conversion on the specified response object.
|
Object convert(RestRequest req, Object res) throws RestException, SerializeException
req
- The servlet request.res
- The response object set by the REST method through the RestResponse.setOutput(Object)
method.RestException
- Thrown if any errors occur during conversion.SerializeException
Copyright © 2018 Apache. All rights reserved.