NextApp Echo
App Container 1.0.5

nextapp.echoservlet
Class StaticText

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

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

A service that renders static text data.

See Also:
Serialized Form

Field Summary
private  ContentType contentType
           
private  java.lang.String data
           
private  Id id
           
 
Constructor Summary
StaticText(ContentType contentType, java.lang.String data)
          Deprecated. The StaticText(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.
StaticText(java.lang.String identifier, ContentType contentType, java.lang.String data)
          Creates a new text content object.
 
Method Summary
static StaticText 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 StaticText createFromResource(java.lang.String identifier, java.lang.String resourceName)
          Creates a StaticText 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
 

Field Detail

contentType

private ContentType contentType

data

private java.lang.String data

id

private Id id
Constructor Detail

StaticText

public StaticText(ContentType contentType,
                  java.lang.String data)
Deprecated. The StaticText(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 text content object.

Parameters:
contentType - The content type of the object.
data - A string referencing the content.

StaticText

public StaticText(java.lang.String identifier,
                  ContentType contentType,
                  java.lang.String data)
Creates a new text content object.

Parameters:
identifier - A unique identifier for this service.
contentType - The content type of the object.
data - A string referencing the content.
Method Detail

createFromResource

public static StaticText 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 StaticText object by way of a resource name. The content type will be determined from the resource's extension. JavaScript resources will be compressed.

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

createFromResource

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

Parameters:
identifier - A unique identifier for this service.
resourceName - The name of the resource from which to create the StaticText object.
Returns:
A StaticText 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.0.5