org.norther.tammi.spray.protocol.chain
Interface ProtocolExtension

All Superinterfaces:
Extension
All Known Implementing Classes:
AbstractProtocolRequest.ProtocolRequestExtension

public interface ProtocolExtension
extends Extension

An interface to a protocol specific extension of a servlet request. It is saved as a request attribute using its class name.

Author:
Ilkka Priha

Field Summary
static String KEY
          The extension key.
 
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.
 

Field Detail

KEY

static final String KEY
The extension key.

Method Detail

drain

void drain()
Drains a HTTP/1.1 request.


getPathTail

String getPathTail()
Gets the tail of the path info without parsed and requested parameters.

Returns:
the path tail or null.

isRedirection

boolean isRedirection()
Checks whether this request is a redirection.

Returns:
true if a redirection, otherwise false.

setRedirection

void setRedirection(boolean flag)
Sets whether this request is a redirection.

Parameters:
flag - true if a redirection, otherwise false.

getRedirectionURL

String getRedirectionURL()
Gets the redirection URL of this request.

Returns:
the redirection URL or null.

setRedirectionURL

void setRedirectionURL(String url)
Sets the redirection URL of this request.

Parameters:
url - the redirection URL.

getMultipartHeader

String getMultipartHeader(String name)
Gets the value of a named multipart header. The headers are valid only for the current multipart stream.

Parameters:
name - the name of the header.
Returns:
the header string.

getPartialContentType

String getPartialContentType()
Gets the content type of the current multipart stream. The default is the content type specified for the body of the request.

Returns:
the partial content type or null.

getPartialCharacterEncoding

String getPartialCharacterEncoding()
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.

Returns:
the partial character encoding or null.

getFormDataFileName

String getFormDataFileName()
Gets the file name of a form-data part.

Returns:
the form-data file name or null.

setFormDataFileName

void setFormDataFileName(String path)
Sets the file name of a form-data part.

Parameters:
path - the form-data file name or path.

getNextInputStream

InputStream getNextInputStream()
                               throws IOException
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.

Returns:
the input stream.
Throws:
IOException - on errors.

isAbsoluteURLLinks

boolean isAbsoluteURLLinks()
Gets the absolute URL links option.

Returns:
the absolute URL links option.

isPathInfoParsed

boolean isPathInfoParsed()
Gets the path info to be parsed as parameters option.

Returns:
the path info parsed option.

getLinkedURL

StringBuilder getLinkedURL(String location)
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.

Parameters:
location - the encoded location of the link.
Returns:
the encoded link URL.

getLinkedURL

StringBuilder getLinkedURL(String location,
                           boolean absolute)
Gets an optionally absolute URL link to the specified location.

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

StringBuilder getLinkedURL(String location,
                           OrderedMap info)
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.

Parameters:
location - the encoded location of the link.
info - a map of unencoded URL parameters.
Returns:
the encoded link URL.

getLinkedURL

StringBuilder getLinkedURL(String location,
                           boolean absolute,
                           OrderedMap info)
Gets an optionally absolute URL link to the specified location with additional URL parameters.

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

StringBuilder getRedirectedURL(boolean secure)
Gets a redirected URL link, which is either secure or non-secure. The location is the URL of the current request.

Parameters:
secure - true for a secure link, false otherwise.
Returns:
the encoded redirection URL.

getRedirectedURL

StringBuilder getRedirectedURL(String location)
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.

Parameters:
location - the encoded location of the link.
Returns:
the encoded redirection URL.

getRedirectedURL

StringBuilder getRedirectedURL(String location,
                               OrderedMap info)
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.

Parameters:
location - the encoded location of the link.
info - a map of unencoded URL parameters.
Returns:
the encoded redirection URL.

getRedirectedURL

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

Parameters:
location - the encoded location of the link.
secure - true for a secure link, false otherwise.
Returns:
the encoded redirection URL.

getRedirectedURL

StringBuilder getRedirectedURL(String location,
                               boolean secure,
                               OrderedMap info)
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.

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

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. The location must be properly encoded in advance.

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

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. The location parameter must be properly encoded in advance.

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

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

boolean isNoCache()
Checks whether caching of pages in clients is on or off.

Returns:
true if caching is disabled, false if enabled.

setNoCache

void setNoCache(boolean flag)
Sets whether caching of pages in clients is on or off.

Parameters:
flag - true if caching is disabled, false if enabled.

getUserPrincipal

Principal getUserPrincipal()
Gets the authenticated principal that is registered to the session of this request.

Returns:
the authenticated principal or null if not registered.

registerUserPrincipal

HttpSession registerUserPrincipal(Principal principal)
Registers the authenticated principal to the session of this request.

Parameters:
principal - the autheticated principal.
Returns:
the session of the principal.


Copyright © 2004 The Norther Organization. All rights reserved.