T- the type of the template object.
@Contract @ConstrainedTo(value=SERVER) public interface TemplateProcessor<T>
Provideror registering an implementing class or instance as a singleton with
Application. Such view processors could be JSP view processors (supported by the Jersey servlet and filter implementations) or say Freemarker or Velocity view processors (not implemented).
|Modifier and Type||Method and Description|
Resolve a template name to a template reference.
Process a template and write the result to an output stream.
name- the template name.
mediaType- requested media type of the template.
nullif the template name cannot be resolved.
void writeTo(T templateReference, Viewable viewable, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String,Object> httpHeaders, OutputStream out) throws IOException
templateReference- the template reference. This is obtained by calling the
resolve(String, javax.ws.rs.core.MediaType)method with a template name and media type.
viewable- the viewable that contains the model to be passed to the template.
mediaType- media type the
templateReferenceshould be transformed into.
httpHeaders- http headers that will be send in the response. Headers can be modified to influence response headers before the the first byte is written to the
out. After the response buffer is committed the headers modification has no effect. Template processor can for example set the content type of the response.
out- the output stream to write the result of processing the template.
IOException- if there was an error processing the template.
Copyright © 2007-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.