org.glassfish.jersey.server.mvc.spi
Class ResolvedViewable<T>

java.lang.Object
  extended by org.glassfish.jersey.server.mvc.Viewable
      extended by org.glassfish.jersey.server.mvc.spi.ResolvedViewable<T>
Type Parameters:
T - the type of the resolved template object.

public final class ResolvedViewable<T>
extends Viewable

A resolved viewable.

A resolved viewable is obtained from the resolving methods on ViewableContext and has associated with it a TemplateProcessor that is capable of processing a template identified by a template reference.

Author:
Paul Sandoz (paul.sandoz at oracle.com), Michal Gajdos (michal.gajdos at oracle.com)

Constructor Summary
ResolvedViewable(TemplateProcessor<T> viewProcessor, T templateReference, Viewable viewable, java.lang.Class<?> resolvingClass, MediaType mediaType)
          Create a resolved viewable.
ResolvedViewable(TemplateProcessor<T> viewProcessor, T templateReference, Viewable viewable, MediaType mediaType)
          Create a resolved viewable.
 
Method Summary
 MediaType getMediaType()
          Get the media type for which the view processor resolved the template reference.
 void writeTo(java.io.OutputStream out)
          Write the resolved viewable.
 
Methods inherited from class org.glassfish.jersey.server.mvc.Viewable
getModel, getResolvingClass, getTemplateName, isTemplateNameAbsolute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResolvedViewable

public ResolvedViewable(TemplateProcessor<T> viewProcessor,
                        T templateReference,
                        Viewable viewable,
                        MediaType mediaType)
Create a resolved viewable.

Parameters:
viewProcessor - the view processor that resolved a template name to a template reference.
templateReference - the template reference.
viewable - the viewable that is resolved.
mediaType - media type the templateReference should be transformed into.

ResolvedViewable

public ResolvedViewable(TemplateProcessor<T> viewProcessor,
                        T templateReference,
                        Viewable viewable,
                        java.lang.Class<?> resolvingClass,
                        MediaType mediaType)
Create a resolved viewable.

Parameters:
viewProcessor - the view processor that resolved a template name to a template reference.
templateReference - the template reference.
viewable - the viewable that is resolved.
resolvingClass - the resolving class that was used to resolve a relative template name into an absolute template name.
mediaType - media type the templateReference should be transformed into.
Method Detail

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Write the resolved viewable.

This method defers to TemplateProcessor.writeTo(Object, org.glassfish.jersey.server.mvc.Viewable, javax.ws.rs.core.MediaType, java.io.OutputStream) to write the viewable utilizing the template reference.

Parameters:
out - the output stream that the view processor writes to.
Throws:
java.io.IOException - if there was an error processing the template.

getMediaType

public MediaType getMediaType()
Get the media type for which the view processor resolved the template reference.

Returns:
final media type of the resolved viewable.


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.