NextApp Echo2
v2.1.1

nextapp.echo2.webcontainer.image
Class AbstractImageService

java.lang.Object
  extended by nextapp.echo2.webcontainer.image.AbstractImageService
All Implemented Interfaces:
nextapp.echo2.webrender.Service
Direct Known Subclasses:
AwtImageService, StreamImageService

public abstract class AbstractImageService
extends java.lang.Object
implements nextapp.echo2.webrender.Service

Abstract base service for rendering images sourced from the application container.


Field Summary
 
Fields inherited from interface nextapp.echo2.webrender.Service
DO_NOT_CACHE
 
Constructor Summary
AbstractImageService()
           
 
Method Summary
 java.lang.String createUri(ContainerInstance containerInstance, java.lang.String imageId)
          Creates a URI to retrieve a specific image for a specific component from the server.
abstract  void renderImage(nextapp.echo2.webrender.Connection conn, nextapp.echo2.app.ImageReference imageReference)
          Renders the specified image to the given connection.
 void service(nextapp.echo2.webrender.Connection conn)
          Services an HTTP request.
 void serviceBadRequest(nextapp.echo2.webrender.Connection conn, java.lang.String message)
          Handles an invalid request for an image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nextapp.echo2.webrender.Service
getId, getVersion
 

Constructor Detail

AbstractImageService

public AbstractImageService()
Method Detail

createUri

public java.lang.String createUri(ContainerInstance containerInstance,
                                  java.lang.String imageId)
Creates a URI to retrieve a specific image for a specific component from the server.

Parameters:
containerInstance - the relevant application container instance.
imageId - the unique id to retrieve the image from the ContainerInstance

renderImage

public abstract void renderImage(nextapp.echo2.webrender.Connection conn,
                                 nextapp.echo2.app.ImageReference imageReference)
                          throws java.io.IOException
Renders the specified image to the given connection. Implementations should set the response content type, and write image data to the response OutputStream.

Parameters:
conn - the Connection on which to render the image
imageReference - the image to be rendered
Throws:
java.io.IOException - if the image cannot be rendered

service

public void service(nextapp.echo2.webrender.Connection conn)
             throws java.io.IOException
Description copied from interface: nextapp.echo2.webrender.Service
Services an HTTP request. Information about the HTTP request as well as methods for issuing a response are available from the provided Connection object.

Specified by:
service in interface nextapp.echo2.webrender.Service
Parameters:
conn - A Connection object which wraps HttpServletRequest and HttpServletResponse objects and provides access to the facilities of the Echo application container.
Throws:
java.io.IOException - in the event of errors related to processing the HTTP request or producing a response.
See Also:
Service.service(nextapp.echo2.webrender.Connection)

serviceBadRequest

public void serviceBadRequest(nextapp.echo2.webrender.Connection conn,
                              java.lang.String message)
Handles an invalid request for an image.

Parameters:
conn - the Connection
message - the error message

NextApp Echo2
v2.1.1