NextApp Echo
App Container 1.1.4

nextapp.echoservlet
Class StaticBinary

java.lang.Object
  extended bynextapp.echoservlet.StaticBinary
All Implemented Interfaces:
CacheableService, java.io.Serializable, Service

public class StaticBinary
extends java.lang.Object
implements CacheableService, java.io.Serializable

A service that renders static binary data.

See Also:
Serialized Form

Constructor Summary
StaticBinary(ContentType contentType, byte[] data)
          Deprecated. The StaticBinary(String, ContentType, String) constructor should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.
StaticBinary(java.lang.String identifier, ContentType contentType, byte[] data)
          Creates a new binary content object.
 
Method Summary
static StaticBinary createFromResource(java.lang.String resourceName)
          Deprecated. The createFromResource(String, String) method should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.
static StaticBinary createFromResource(java.lang.String identifier, java.lang.String resourceName)
          Creates a StaticBinary object by way of a resource name.
 ContentType getContentType()
          Returns the content type.
 Id getId()
          Returns a unique identifier for this service.
 int getVersion()
          Returns zero to indicate that the content will never change.
 void service(Connection conn)
          Services an HTTP request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticBinary

public StaticBinary(ContentType contentType,
                    byte[] data)
Deprecated. The StaticBinary(String, ContentType, String) constructor should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.

Creates a new binary content object. Autogenerates a unique identifier for the service.

Parameters:
contentType - The content type of the object.
data - A byte array containing the binary content.

StaticBinary

public StaticBinary(java.lang.String identifier,
                    ContentType contentType,
                    byte[] data)
Creates a new binary content object.

Parameters:
identifier - A unique identifier for this service.
contentType - The content type of the object.
data - A byte array containing the binary content.
Method Detail

createFromResource

public static StaticBinary createFromResource(java.lang.String resourceName)
Deprecated. The createFromResource(String, String) method should be used instead. Use of this version may result in errors if applications are migrated between VMs, due to the Service having a different identifier on each VM.

Creates a StaticBinary object by way of a resource name. The content type will be determined from the resource's extension.

Parameters:
resourceName - The name of the resource from which to create the StaticBinary object.
Returns:
A StaticBinary object containing the content of the specified resource.

createFromResource

public static StaticBinary createFromResource(java.lang.String identifier,
                                              java.lang.String resourceName)
Creates a StaticBinary object by way of a resource name. The content type will be determined from the resource's extension.

Parameters:
identifier - A unique identifier for this service.
resourceName - The name of the resource from which to create the StaticBinary object.
Returns:
A StaticBinary object containing the content of the specified resource.

getContentType

public ContentType getContentType()
Returns the content type.

Returns:
The content type.

getId

public Id getId()
Description copied from interface: Service
Returns a unique identifier for this service.

Specified by:
getId in interface Service
Returns:
A unique identifier for this service.
See Also:
Service.getId()

getVersion

public int getVersion()
Returns zero to indicate that the content will never change.

Specified by:
getVersion in interface CacheableService
Returns:
Zero to indicate that the content will never change.

service

public void service(Connection conn)
             throws java.io.IOException
Description copied from interface: 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 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(Connection)

NextApp Echo
App Container 1.1.4