Enhydra 5.1 API

com.lutris.appserver.server.jolt.joltpo
Class JoltResponse

java.lang.Object
  |
  +--com.lutris.appserver.server.jolt.joltpo.JoltResponse

public class JoltResponse
extends java.lang.Object

Cookies and other headers to be passed back to the client.


Constructor Summary
protected JoltResponse(HttpPresentationResponse httpResponse)
          Construct a response object.
 
Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
          Adds the specified cookie to the response.
 boolean containsHeader(java.lang.String name)
          Returns true if the response message header has a field with the specified name.
 java.lang.String getEncoding()
          Get the output character encoding.
 void setDateHeader(java.lang.String name, long date)
          Adds a field to the response header with a given name and date-valued field.
 void setEncoding(java.lang.String enc)
          Set the output character encoding.
 void setHeader(java.lang.String name, java.lang.String value)
          Adds a field to the response header with a given name and value.
 void setIntHeader(java.lang.String name, int value)
          Adds a field to the response header with a given name and integer value.
protected  void write(java.lang.String str)
          Write a string to the HTTP client.
protected  void writeHeaders()
          Write buffered headers and cookies to the HTTP client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoltResponse

protected JoltResponse(HttpPresentationResponse httpResponse)
Construct a response object.

Parameters:
httpResponse - HTTP response object used to return the response.
Method Detail

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)
               throws HttpPresentationException
Adds the specified cookie to the response. It can be called multiple times to set more than one cookie.

Parameters:
cookie - - The Cookie to return to the client.
HttpPresentationException

containsHeader

public boolean containsHeader(java.lang.String name)
                       throws HttpPresentationException
Returns true if the response message header has a field with the specified name.

Parameters:
name - the header field name
HttpPresentationException

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
               throws HttpPresentationException
Adds a field to the response header with a given name and value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field value
HttpPresentationException

setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)
                  throws HttpPresentationException
Adds a field to the response header with a given name and integer value. If the field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
value - the header field integer value
HttpPresentationException

setDateHeader

public void setDateHeader(java.lang.String name,
                          long date)
                   throws HttpPresentationException
Adds a field to the response header with a given name and date-valued field. The date is specified in terms of milliseconds since the epoch. If the date field had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.

Parameters:
name - the header field name
HttpPresentationException

setEncoding

public void setEncoding(java.lang.String enc)
Set the output character encoding.

Parameters:
enc - character encoding

getEncoding

public java.lang.String getEncoding()
Get the output character encoding.

Returns:
the current encoding

writeHeaders

protected void writeHeaders()
                     throws HttpPresentationException
Write buffered headers and cookies to the HTTP client.

HttpPresentationException

write

protected void write(java.lang.String str)
              throws HttpPresentationException
Write a string to the HTTP client. Set headers if this is the first write. The output is flushed.

Parameters:
str - The string to write.
HttpPresentationException

Enhydra 5.1 API