PageMixer API - 3.1

jp.ne.dti.lares.foozy.pagemixer.servlet
Class ReqHeaderKey

java.lang.Object
  |
  +--jp.ne.dti.lares.foozy.pagemixer.servlet.ReqHeaderKey
All Implemented Interfaces:
ServletConsumerContext.KeyCommand

public class ReqHeaderKey
extends java.lang.Object
implements ServletConsumerContext.KeyCommand

Key to identify value in "Servlet request header" storage class.

Since:
PageMixer 3.1

Field Summary
static int DATE
          Type ID to find Long object out.
static ReqHeaderKey HOST
          Key to get value from "Host" request header.
static int INT
          Type ID to find Integer object out.
static int STRING
          Type ID to find String object out.
 
Constructor Summary
ReqHeaderKey(java.lang.String name)
          Construct key named as specified name.
ReqHeaderKey(java.lang.String name, boolean single)
          Construct key named as specified name.
ReqHeaderKey(java.lang.String name, int type)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object object)
           
 java.lang.Integer getInteger(ConsumerContext context)
          Utility to look data object up easily.
 java.lang.Long getLong(ConsumerContext context)
          Utility to look data object up easily.
 java.lang.String getString(ConsumerContext context)
          Utility to look data object up easily.
 java.lang.Object getValue(javax.servlet.http.HttpServletRequest request)
          Get value from HttpServletRequest.
 java.lang.Object getValue(javax.servlet.http.HttpServlet servlet, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get value from HttpServletRequest.
 int hashCode()
           
 void setValue(javax.servlet.http.HttpServlet servlet, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Object value)
          This is not supported.
 java.lang.String toString()
           
 void unsetValue(javax.servlet.http.HttpServlet servlet, javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This is not supported.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HOST

public static final ReqHeaderKey HOST
Key to get value from "Host" request header.

This finds String value out in context.


STRING

public static final int STRING
Type ID to find String object out.

This causes invocation of HttpServletRequest#getHeader(String).


INT

public static final int INT
Type ID to find Integer object out.

This causes invocation of HttpServletRequest#getIntHeader(String).


DATE

public static final int DATE
Type ID to find Long object out.

This causes invocation of HttpServletRequest#getDateHeader(String).

Constructor Detail

ReqHeaderKey

public ReqHeaderKey(java.lang.String name,
                    boolean single)
Construct key named as specified name.

You can get Enumeratoin object by this class, if you specify "true" as single.

Parameters:
name - of header
single - whether use getHeader() or getHeaders()

ReqHeaderKey

public ReqHeaderKey(java.lang.String name)
Construct key named as specified name.

This is equivalent to ReqHeaderKey(name, STRING).

Parameters:
name - of header

ReqHeaderKey

public ReqHeaderKey(java.lang.String name,
                    int type)
Constructor.

This constructor allows you to get data object other than String.

Type of data object is corresponded to type parameter.

type invocation data type comment
STRING getHeader String
INT getIntHeader Integer
DATE getDateHeader Long not java.util.Date !!!!
Parameters:
name - of header
type - of data to be looked up
Method Detail

getInteger

public final java.lang.Integer getInteger(ConsumerContext context)
Utility to look data object up easily.

This is equivalent to (Integer)(context.getValue(key)), when instance of this class is referred as key.

Parameters:
context - in which data object is looked up

getLong

public final java.lang.Long getLong(ConsumerContext context)
Utility to look data object up easily.

This is equivalent to (Long)(context.getValue(key)), when instance of this class is referred as key.

Parameters:
context - in which data object is looked up

getString

public final java.lang.String getString(ConsumerContext context)
Utility to look data object up easily.

This is equivalent to (String)(context.getValue(key)), when instance of this class is referred as key.

Parameters:
context - in which data object is looked up

getValue

public final java.lang.Object getValue(javax.servlet.http.HttpServletRequest request)
Get value from HttpServletRequest.

ServletRequest#getHeader (as String) is used, if invocation target is constructed with "single" parameter "true". Otherwise, ServletRequest#getHeaders (as Enumeration of String) is used.

Parameters:
request - on which consumer context depends.
Returns:
value identified by this(may be null)

getValue

public java.lang.Object getValue(javax.servlet.http.HttpServlet servlet,
                                 javax.servlet.ServletContext context,
                                 javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
Get value from HttpServletRequest.

This is equivalent to getValue(request)

Specified by:
getValue in interface ServletConsumerContext.KeyCommand
Parameters:
servlet - on which consumer context depends.
context - on which consumer context depends.
request - on which consumer context depends.
response - on which consumer context depends.
Returns:
value identified by this(may be null)

setValue

public void setValue(javax.servlet.http.HttpServlet servlet,
                     javax.servlet.ServletContext context,
                     javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     java.lang.Object value)
This is not supported.
Specified by:
setValue in interface ServletConsumerContext.KeyCommand
Parameters:
servlet - on which consumer context depends.
context - on which consumer context depends.
request - on which consumer context depends.
response - on which consumer context depends.
value - value to be set
Throws:
UnsupportedOperationException - always

unsetValue

public void unsetValue(javax.servlet.http.HttpServlet servlet,
                       javax.servlet.ServletContext context,
                       javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
This is not supported.
Specified by:
unsetValue in interface ServletConsumerContext.KeyCommand
Parameters:
servlet - on which consumer context depends.
context - on which consumer context depends.
request - on which consumer context depends.
response - on which consumer context depends.
Throws:
UnsupportedOperationException - always

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

PageMixer API - 3.1