org.camunda.bpm.cycle.web.jaxrs.ext
Class TemplateMessageBodyWriter

java.lang.Object
  extended by org.camunda.bpm.cycle.web.jaxrs.ext.TemplateMessageBodyWriter
All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyWriter<String>

@Provider
public class TemplateMessageBodyWriter
extends Object
implements javax.ws.rs.ext.MessageBodyWriter<String>

Renders Strings returned by controllers as templates when text/html or text/xhtml+xml is requested as a content type. Exceptions thrown by the templating engine are properly translated to responses via a TemplateExceptionMapper.

Author:
nico.rehwaldt
See Also:
TemplateExceptionMapper, TemplateMessageBodyWriter

Constructor Summary
TemplateMessageBodyWriter()
           
 
Method Summary
 long getSize(String t, Class<?> type, Type type1, Annotation[] antns, javax.ws.rs.core.MediaType mt)
          Return the size of the response.
 boolean isWriteable(Class<?> type, Type t, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
          We can process only objects for which templates exist.
 void writeTo(String t, Class<?> type, Type type1, Annotation[] antns, javax.ws.rs.core.MediaType mt, javax.ws.rs.core.MultivaluedMap<String,Object> mm, OutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateMessageBodyWriter

public TemplateMessageBodyWriter()
Method Detail

isWriteable

public boolean isWriteable(Class<?> type,
                           Type t,
                           Annotation[] annotations,
                           javax.ws.rs.core.MediaType mediaType)
We can process only objects for which templates exist.

Specified by:
isWriteable in interface javax.ws.rs.ext.MessageBodyWriter<String>
Parameters:
type -
t -
annotations -
mediaType -
Returns:

getSize

public long getSize(String t,
                    Class<?> type,
                    Type type1,
                    Annotation[] antns,
                    javax.ws.rs.core.MediaType mt)
Return the size of the response. We do not know upfront, that is why we return -1.

Specified by:
getSize in interface javax.ws.rs.ext.MessageBodyWriter<String>
Parameters:
t -
type -
type1 -
antns -
mt -
Returns:

writeTo

public void writeTo(String t,
                    Class<?> type,
                    Type type1,
                    Annotation[] antns,
                    javax.ws.rs.core.MediaType mt,
                    javax.ws.rs.core.MultivaluedMap<String,Object> mm,
                    OutputStream out)
             throws IOException,
                    javax.ws.rs.WebApplicationException
Specified by:
writeTo in interface javax.ws.rs.ext.MessageBodyWriter<String>
Throws:
IOException
javax.ws.rs.WebApplicationException


Copyright © 2014 camunda services GmbH. All rights reserved.