org.norther.tammi.spray.protocol.chain
Class AbstractProtocolRequest.ProtocolRequestExtension

java.lang.Object
  extended by org.norther.tammi.spray.filter.chain.AbstractExtension
      extended by org.norther.tammi.spray.protocol.chain.AbstractProtocolRequest.ProtocolRequestExtension
All Implemented Interfaces:
Serializable, EventListener, Extension, ServletRequestBindingListener, ProtocolExtension
Enclosing class:
AbstractProtocolRequest

protected class AbstractProtocolRequest.ProtocolRequestExtension
extends AbstractExtension
implements ProtocolExtension

The protocol extension class.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.norther.tammi.spray.protocol.chain.ProtocolExtension
KEY
 
Constructor Summary
AbstractProtocolRequest.ProtocolRequestExtension()
          Constructs a new extension.
 
Method Summary
 void drain()
          Drains a HTTP/1.1 request.
 String getFormDataFileName()
          Gets the file name of a form-data part.
 StringBuilder getLinkedURL(String location)
          Gets a URL link to the specified location.
 StringBuilder getLinkedURL(String location, boolean absolute)
          Gets an optionally absolute URL link to the specified location.
 StringBuilder getLinkedURL(String location, boolean absolute, OrderedMap info)
          Gets an optionally absolute URL link to the specified location with additional URL parameters.
 StringBuilder getLinkedURL(String location, OrderedMap info)
          Gets a URL link to the specified location with additional URL parameters.
 String getMultipartHeader(String name)
          Gets the value of a named multipart header.
 InputStream getNextInputStream()
          Returns an input stream for reading the body of the next part of a multipart request.
 String getPartialCharacterEncoding()
          Gets the character encoding of the current multipart stream.
 String getPartialContentType()
          Gets the content type of the current multipart stream.
 String getPathTail()
          Gets the tail of the path info without parsed and requested parameters.
 StringBuilder getRedirectedURL(boolean secure)
          Gets a redirected URL link, which is either secure or non-secure.
 StringBuilder getRedirectedURL(String location)
          Gets a redirected URL link to the specified location.
 StringBuilder getRedirectedURL(String location, boolean secure)
          Gets a redirected URL link, which is either secure or non-secure.
 StringBuilder getRedirectedURL(String location, boolean secure, OrderedMap info)
          Gets a redirected URL link with additional URL parameters, which is either secure or non-secure.
 StringBuilder getRedirectedURL(String host, int port, String location, boolean secure)
          Gets a redirected URL link to a specific host and/or port, which is either secure or non-secure.
 StringBuilder getRedirectedURL(String host, int port, String location, boolean secure, OrderedMap info)
          Gets a redirected URL link with additional URL parameters to the specified host and/or port, which is either secure or non-secure.
 StringBuilder getRedirectedURL(String location, OrderedMap info)
          Gets a redirected URL link with additional URL parameters.
 String getRedirectionURL()
          Gets the redirection URL of this request.
 Principal getUserPrincipal()
          Gets the authenticated principal that is registered to the session of this request.
 boolean isAbsoluteURLLinks()
          Gets the absolute URL links option.
 boolean isNoCache()
          Checks whether caching of pages in clients is on or off.
 boolean isPathInfoParsed()
          Gets the path info to be parsed as parameters option.
 boolean isRedirection()
          Checks whether this request is a redirection.
 HttpSession registerUserPrincipal(Principal principal)
          Registers the authenticated principal to the session of this request.
 void setFormDataFileName(String path)
          Sets the file name of a form-data part.
 void setNoCache(boolean flag)
          Sets whether caching of pages in clients is on or off.
 void setRedirection(boolean flag)
          Sets whether this request is a redirection.
 void setRedirectionURL(String url)
          Sets the redirection URL of this request.
 void valueUnbound(ServletRequestBindingEvent event)
          Notifies the object that it is being unbound from a request.
 
Methods inherited from class org.norther.tammi.spray.filter.chain.AbstractExtension
getFilterChain, getFilteredRequest, getFilteredResponse, isBound, valueBound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProtocolRequest.ProtocolRequestExtension

public AbstractProtocolRequest.ProtocolRequestExtension()
Constructs a new extension.

Method Detail

drain

public void drain()
Description copied from interface: ProtocolExtension
Drains a HTTP/1.1 request.

Specified by:
drain in interface ProtocolExtension

getPathTail

public String getPathTail()
Description copied from interface: ProtocolExtension
Gets the tail of the path info without parsed and requested parameters.

Specified by:
getPathTail in interface ProtocolExtension
Returns:
the path tail or null.

isRedirection

public boolean isRedirection()
Description copied from interface: ProtocolExtension
Checks whether this request is a redirection.

Specified by:
isRedirection in interface ProtocolExtension
Returns:
true if a redirection, otherwise false.

setRedirection

public void setRedirection(boolean flag)
Description copied from interface: ProtocolExtension
Sets whether this request is a redirection.

Specified by:
setRedirection in interface ProtocolExtension
Parameters:
flag - true if a redirection, otherwise false.

getRedirectionURL

public String getRedirectionURL()
Description copied from interface: ProtocolExtension
Gets the redirection URL of this request.

Specified by:
getRedirectionURL in interface ProtocolExtension
Returns:
the redirection URL or null.

setRedirectionURL

public void setRedirectionURL(String url)
Description copied from interface: ProtocolExtension
Sets the redirection URL of this request.

Specified by:
setRedirectionURL in interface ProtocolExtension
Parameters:
url - the redirection URL.

getMultipartHeader

public String getMultipartHeader(String name)
Description copied from interface: ProtocolExtension
Gets the value of a named multipart header. The headers are valid only for the current multipart stream.

Specified by:
getMultipartHeader in interface ProtocolExtension
Parameters:
name - the name of the header.
Returns:
the header string.

getPartialContentType

public String getPartialContentType()
Description copied from interface: ProtocolExtension
Gets the content type of the current multipart stream. The default is the content type specified for the body of the request.

Specified by:
getPartialContentType in interface ProtocolExtension
Returns:
the partial content type or null.

getPartialCharacterEncoding

public String getPartialCharacterEncoding()
Description copied from interface: ProtocolExtension
Gets the character encoding of the current multipart stream. The default is the character encoding specified for the body of the request. If the encoding for the body is not specified, the configured encoding from HttpFilterMBean is returned.

Specified by:
getPartialCharacterEncoding in interface ProtocolExtension
Returns:
the partial character encoding or null.

getFormDataFileName

public String getFormDataFileName()
Description copied from interface: ProtocolExtension
Gets the file name of a form-data part.

Specified by:
getFormDataFileName in interface ProtocolExtension
Returns:
the form-data file name or null.

setFormDataFileName

public void setFormDataFileName(String path)
Description copied from interface: ProtocolExtension
Sets the file name of a form-data part.

Specified by:
setFormDataFileName in interface ProtocolExtension
Parameters:
path - the form-data file name or path.

getNextInputStream

public InputStream getNextInputStream()
                               throws IOException
Description copied from interface: ProtocolExtension
Returns an input stream for reading the body of the next part of a multipart request. It returns null, if all parts have been read.

Calling this method can affect other methods returning values included in the body of the request.

Specified by:
getNextInputStream in interface ProtocolExtension
Returns:
the input stream.
Throws:
IOException - on errors.

isAbsoluteURLLinks

public boolean isAbsoluteURLLinks()
Description copied from interface: ProtocolExtension
Gets the absolute URL links option.

Specified by:
isAbsoluteURLLinks in interface ProtocolExtension
Returns:
the absolute URL links option.

isPathInfoParsed

public boolean isPathInfoParsed()
Description copied from interface: ProtocolExtension
Gets the path info to be parsed as parameters option.

Specified by:
isPathInfoParsed in interface ProtocolExtension
Returns:
the path info parsed option.

getLinkedURL

public StringBuilder getLinkedURL(String location)
Description copied from interface: ProtocolExtension
Gets a URL link to the specified location. The returned URL is either absolute or relative depending on the server configuration of URL links. The location parameter must be properly encoded in advance.

If the location is an absolute URL, it is converted into a string buffer as such.

An absolute path is appended to the context URL of the current request. The authority component is included if URL links are configured to be absolute.

A relative path is appended to the context URL after the path info parameters of linked key filters or before the corresponding query string parameters depending on the configuration.

Specified by:
getLinkedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
Returns:
the encoded link URL.

getLinkedURL

public StringBuilder getLinkedURL(String location,
                                  boolean absolute)
Description copied from interface: ProtocolExtension
Gets an optionally absolute URL link to the specified location.

Specified by:
getLinkedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
absolute - true for an absolute URL, false for a relative one.
Returns:
the encoded link URL.

getLinkedURL

public StringBuilder getLinkedURL(String location,
                                  OrderedMap info)
Description copied from interface: ProtocolExtension
Gets a URL link to the specified location with additional URL parameters. The returned URL is either absolute or relative depending on the server configuration of URL links. The location parameter must be properly encoded in advance.

Applied parameters from linked key filters are added to the URL parameter map, if any.

Specified by:
getLinkedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
info - a map of unencoded URL parameters.
Returns:
the encoded link URL.

getLinkedURL

public StringBuilder getLinkedURL(String location,
                                  boolean absolute,
                                  OrderedMap info)
Description copied from interface: ProtocolExtension
Gets an optionally absolute URL link to the specified location with additional URL parameters.

Specified by:
getLinkedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
absolute - true for an absolute URL, false for a relative one.
info - a map of unencoded URL parameters.
Returns:
the encoded link URL.

getRedirectedURL

public StringBuilder getRedirectedURL(boolean secure)
Description copied from interface: ProtocolExtension
Gets a redirected URL link, which is either secure or non-secure. The location is the URL of the current request.

Specified by:
getRedirectedURL in interface ProtocolExtension
Parameters:
secure - true for a secure link, false otherwise.
Returns:
the encoded redirection URL.

getRedirectedURL

public StringBuilder getRedirectedURL(String location)
Description copied from interface: ProtocolExtension
Gets a redirected URL link to the specified location. The returned URL is always absolute as e.g. WAP doesn't accept relative redirections. The location must be properly encoded in advance.

If the location is an absolute URL, it is converted into a string buffer as such.

An absolute path is appended to the servlet URL of the current request.

A relative path is appended to the servlet URL after the path info parameters of linked key filters or before the corresponding query string parameters depending on the configuration.

Specified by:
getRedirectedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
Returns:
the encoded redirection URL.

getRedirectedURL

public StringBuilder getRedirectedURL(String location,
                                      OrderedMap info)
Description copied from interface: ProtocolExtension
Gets a redirected URL link with additional URL parameters. The location must be properly encoded in advance.

Applied parameters from linked key filters are added to the URL parameter map, if any.

Specified by:
getRedirectedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
info - a map of unencoded URL parameters.
Returns:
the encoded redirection URL.

getRedirectedURL

public StringBuilder getRedirectedURL(String location,
                                      boolean secure)
Description copied from interface: ProtocolExtension
Gets a redirected URL link, which is either secure or non-secure. The location must be properly encoded in advance.

Specified by:
getRedirectedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
secure - true for a secure link, false otherwise.
Returns:
the encoded redirection URL.

getRedirectedURL

public StringBuilder getRedirectedURL(String location,
                                      boolean secure,
                                      OrderedMap info)
Description copied from interface: ProtocolExtension
Gets a redirected URL link with additional URL parameters, which is either secure or non-secure. The location must be properly encoded in advance.

Applied parameters from linked key filters are added to the URL parameter map, if any.

Specified by:
getRedirectedURL in interface ProtocolExtension
Parameters:
location - the encoded location of the link.
secure - true for a secure link, false otherwise.
info - a map of unencoded URL parameters.
Returns:
the encoded redirection URL.

getRedirectedURL

public StringBuilder getRedirectedURL(String host,
                                      int port,
                                      String location,
                                      boolean secure)
Description copied from interface: ProtocolExtension
Gets a redirected URL link to a specific host and/or port, which is either secure or non-secure. The location must be properly encoded in advance.

Specified by:
getRedirectedURL in interface ProtocolExtension
Parameters:
host - the optional server name of the link.
port - the port number of the link (0 for current).
location - the encoded location of the link.
secure - true for a secure link, false otherwise.
Returns:
the encoded redirection URL.

getRedirectedURL

public StringBuilder getRedirectedURL(String host,
                                      int port,
                                      String location,
                                      boolean secure,
                                      OrderedMap info)
Description copied from interface: ProtocolExtension
Gets a redirected URL link with additional URL parameters to the specified host and/or port, which is either secure or non-secure. The location parameter must be properly encoded in advance.

Applied parameters from linked key filters are added to the URL parameter map, if any.

Specified by:
getRedirectedURL in interface ProtocolExtension
Parameters:
host - the optional server name of the link.
port - the port number of the link (0 for current).
location - the encoded location of the link.
secure - true for a secure link, false otherwise.
info - a map of unencoded URL parameters.
Returns:
the encoded redirection URL.

isNoCache

public boolean isNoCache()
Description copied from interface: ProtocolExtension
Checks whether caching of pages in clients is on or off.

Specified by:
isNoCache in interface ProtocolExtension
Returns:
true if caching is disabled, false if enabled.

setNoCache

public void setNoCache(boolean flag)
Description copied from interface: ProtocolExtension
Sets whether caching of pages in clients is on or off.

Specified by:
setNoCache in interface ProtocolExtension
Parameters:
flag - true if caching is disabled, false if enabled.

getUserPrincipal

public Principal getUserPrincipal()
Description copied from interface: ProtocolExtension
Gets the authenticated principal that is registered to the session of this request.

Specified by:
getUserPrincipal in interface ProtocolExtension
Returns:
the authenticated principal or null if not registered.

registerUserPrincipal

public HttpSession registerUserPrincipal(Principal principal)
Description copied from interface: ProtocolExtension
Registers the authenticated principal to the session of this request.

Specified by:
registerUserPrincipal in interface ProtocolExtension
Parameters:
principal - the autheticated principal.
Returns:
the session of the principal.

valueUnbound

public void valueUnbound(ServletRequestBindingEvent event)
Description copied from interface: ServletRequestBindingListener
Notifies the object that it is being unbound from a request.

Specified by:
valueUnbound in interface ServletRequestBindingListener
Overrides:
valueUnbound in class AbstractExtension
Parameters:
event - the binding event.


Copyright © 2004 The Norther Organization. All rights reserved.