PageMixer API - 3.1

jp.ne.dti.lares.foozy.pagemixer.struts
Class StrutsConsumerContext

java.lang.Object
  |
  +--jp.ne.dti.lares.foozy.pagemixer.servlet.ServletConsumerContext
        |
        +--jp.ne.dti.lares.foozy.pagemixer.struts.StrutsConsumerContext
All Implemented Interfaces:
ConsumerContext

public class StrutsConsumerContext
extends ServletConsumerContext

Consumer conetxt implementation for Struts environment.

This is consumer context implementation for Struts environment.

But almost all processings are delegated to ServletConsumerContext.KeyCommand implementation classes.

ATTENTION:static members shown below are defined in ServletConsumerContext since Pagemixer 3.1.

Since:
PageMixer 1.1

Inner Class Summary
static class StrutsConsumerContext.AutoFormKey
          Deprecated. by non inner AutoFormKey class
static class StrutsConsumerContext.ErrorKey
          Deprecated.  
static class StrutsConsumerContext.FormKey
          Deprecated. by non inner FormKey class
static class StrutsConsumerContext.MappedActionKey
          Deprecated. by ActionConfigKey
static class StrutsConsumerContext.RequestFormKey
          Deprecated. by non inner RequestFormKey class
static class StrutsConsumerContext.SessionFormKey
          Deprecated. by non inner SessionFormKey class
 
Inner classes inherited from class jp.ne.dti.lares.foozy.pagemixer.servlet.ServletConsumerContext
ServletConsumerContext.ApplicationKey, ServletConsumerContext.ContextInitKey, ServletConsumerContext.CookieKey, ServletConsumerContext.KeyCommand, ServletConsumerContext.ParameterKey, ServletConsumerContext.ReqHeaderKey, ServletConsumerContext.RequestKey, ServletConsumerContext.ResHeaderKey, ServletConsumerContext.ServletInitKey, ServletConsumerContext.SessionKey
 
Field Summary
static ApplicationKey ACTION_SERVLET_KEY
          Key to access "ActionServlet" of Struts in application scope.
static RequestKey CANCEL_KEY
          Key to access "Boolean"(?) in request scope.
static RequestKey ERROR_KEY
          Key to access "ActionMessages" of Struts in request scope for error detail.
static RequestKey ERROR_MAP_KEY
          Deprecated. this will be removed at release of next major version
static RequestKey EXCEPTION_KEY
          Key to access "Exception" in request scope.
static SessionKey LOCALE_KEY
          Key to access "Locale" in session scope.
static RequestKey MAPPING_KEY
          Key to access "ActionConfig" ("ActionMapping"?) of Sttuts in request scope.
static RequestKey MESSAGE_KEY
          Key to access "ActionMessages" of Struts in request scope.
static ApplicationKey MODULE_PREFIXES_KEY
          Key to access "String[]" in application scope.
static RequestKey MULTIPART_KEY
          Key to access "String" (MultipartRequestWrapper?) in request scope.
static RequestKey PATH_PREFIX_KEY
          Key to access path prefix of "ActionServlet".
static RequestKey PATH_SUFFIX_KEY
          Key to access path suffix of "ActionServlet".
static ApplicationKey SERVLET_KEY
          Key to access String in application scope.
static SessionKey TOKEN_KEY
          Deprecated. by TRANSACTION_TOKEN_KEY
static SessionKey TRANSACTION_TOKEN_KEY
          Key to access "transaction token" of Struts in session scope.
static ParameterKey TRANSACTION_TOKEN_PARAM_KEY
          Key to access "transaction token" of Struts in request parameter scope.
 
Fields inherited from class jp.ne.dti.lares.foozy.pagemixer.servlet.ServletConsumerContext
BASE_HREF_KEY, CONTEXT_PATH_KEY, XHTML_KEY
 
Constructor Summary
StrutsConsumerContext(javax.servlet.http.HttpServlet servlet, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Construct consumer context with specified servlet environment.
 
Method Summary
static java.lang.String getActionPath(ConsumerContext context, java.lang.String name)
          Get path for "Action" of current module.
static java.lang.StringBuffer getActionPath(ConsumerContext context, java.lang.StringBuffer buffer, java.lang.String name)
          Get path for "Action" of current module.
static java.lang.StringBuffer getActionPath(ConsumerContext context, java.lang.StringBuffer buffer, java.lang.String prefix, java.lang.String name)
          Get path of "Action".
static java.lang.String getActionPath(ConsumerContext context, java.lang.String prefix, java.lang.String name)
          Get path for "Action".
static java.lang.String getActionURI(ConsumerContext context, java.lang.String name)
          Get URI for "Action" of current module.
static java.lang.StringBuffer getActionURI(ConsumerContext context, java.lang.StringBuffer buffer, java.lang.String name)
          Get URI for "Action" of current module.
static java.lang.StringBuffer getActionURI(ConsumerContext context, java.lang.StringBuffer buffer, java.lang.String prefix, java.lang.String name)
          Get URI for "Action".
static java.lang.String getActionURI(ConsumerContext context, java.lang.String prefix, java.lang.String name)
          Get URI for "Action".
static boolean isRequestScope(org.apache.struts.config.ActionConfig config)
          Deprecated. by FormKey.isRequestScope(org.apache.struts.config.ActionConfig)
 
Methods inherited from class jp.ne.dti.lares.foozy.pagemixer.servlet.ServletConsumerContext
encode, getContext, getRequest, getResponse, getServlet, getValue, setValue, unsetValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_SERVLET_KEY

public static final ApplicationKey ACTION_SERVLET_KEY
Key to access "ActionServlet" of Struts in application scope.

You can get ActionServlet of Struts sotred into context attribute storage class by org.apache.struts.Globals.ACTION_SERVLET_KEY .

Since:
PageMixer 3.1

CANCEL_KEY

public static final RequestKey CANCEL_KEY
Key to access "Boolean"(?) in request scope.

You may get Boolean.TRUE sotred into request attribute storage class by org.apache.struts.Globals.CANCEL_KEY (but it may be null, even though in Struts environment).

Since:
PageMixer 3.1

ERROR_KEY

public static final RequestKey ERROR_KEY
Key to access "ActionMessages" of Struts in request scope for error detail.

You can get ActionMessages of Struts sotred into request attribute storage class by org.apache.struts.Globals.ERROR_KEY (but it may be null, even though in Struts environment).

See Also:
MESSAGE_KEY
Since:
PageMixer 3.1

EXCEPTION_KEY

public static final RequestKey EXCEPTION_KEY
Key to access "Exception" in request scope.

You can get Exception sotred into request attribute storage class by org.apache.struts.Globals.EXCEPTION_KEY (but it may be null, even though in Struts environment).


LOCALE_KEY

public static final SessionKey LOCALE_KEY
Key to access "Locale" in session scope.

You can get Locale stored into session attribute storage class by org.apache.struts.Globals.LOCALE_KEY (but it may be null, even though in Struts environment).


MAPPING_KEY

public static final RequestKey MAPPING_KEY
Key to access "ActionConfig" ("ActionMapping"?) of Sttuts in request scope.

You can get ActionConfig (may be ActionMapping) of Struts stord into request attribute storage class by org.apache.struts.Globals.MAPPING_KEY.


MESSAGE_KEY

public static final RequestKey MESSAGE_KEY
Key to access "ActionMessages" of Struts in request scope.

You can access ActionMessages of Struts stored into request attribute storage class by org.apache.struts.Globals.MESSAGE_KEY (but it may be null, even though in Struts environment).

See Also:
ERROR_KEY
Since:
PageMixer 3.1

MODULE_PREFIXES_KEY

public static final ApplicationKey MODULE_PREFIXES_KEY
Key to access "String[]" in application scope.

You can get String[] stored into context attribute storage class by org.apache.struts.Globals.MODULE_PREFIXES_KEY .

Since:
PageMixer 3.1

MULTIPART_KEY

public static final RequestKey MULTIPART_KEY
Key to access "String" (MultipartRequestWrapper?) in request scope.

You can get String (MultipartRequestWrapper?) stored into request attribute storage class by org.apache.struts.Globals.MULTIPART_KEY .

Since:
PageMixer 3.1

SERVLET_KEY

public static final ApplicationKey SERVLET_KEY
Key to access String in application scope.

You can get String stored into context attribute storage class by org.apache.struts.Globals.SERVLET_KEY .

Since:
PageMixer 3.1

TRANSACTION_TOKEN_KEY

public static final SessionKey TRANSACTION_TOKEN_KEY
Key to access "transaction token" of Struts in session scope.

You can get transaction token stored into request attribute storage class by org.apache.struts.Globals.TRANSACTION_TOKEN_KEY (but it may be null, even though in Struts environment).

Since:
PageMixer 3.1

TRANSACTION_TOKEN_PARAM_KEY

public static final ParameterKey TRANSACTION_TOKEN_PARAM_KEY
Key to access "transaction token" of Struts in request parameter scope.

You can get transaction token parameter named as org.apache.struts.taglib.html.Constants.TOKEN_KEY (but it may be null, even though in Struts environment).

Since:
PageMixer 3.1

TOKEN_KEY

public static final SessionKey TOKEN_KEY
Deprecated. by TRANSACTION_TOKEN_KEY

Key to access "transaction token" of Struts in sessino scope.

ERROR_MAP_KEY

public static final RequestKey ERROR_MAP_KEY
Deprecated. this will be removed at release of next major version

Key to access the map containing "ActionMessage"s of Struts in request scope.

This value is PageMixer specific one.

You can get java.util.Map containing "ActionMessage"s with those names. These "ActionMessage"s are from "ActionMessages" looked up by org.apache.struts.Globals.ERROR_KEY.

This value is ensured not to be "null".

This map allows you to access directly to individual "ActionMessage"s by name of it. But, only one "ActionMessage" is accessble, even though "ActionMessages" of current request consists of some "ActionMessage"s having same key for some properties.


PATH_PREFIX_KEY

public static final RequestKey PATH_PREFIX_KEY
Key to access path prefix of "ActionServlet".

This value is PageMixer specific one.

You can get java.lang.String as Servlet path prefix of ActionServlet. This string value is ensured not to be "null", but may be ""(empty string).

In other words, you can get java.lang.String stored into request attribute storage class by org.apache.struts.Globals.SERVLET_KEY without tail "/*", if it ends with "/*"(e.g.: "/action/*"). Otherwise, you can get ""(empty string).


PATH_SUFFIX_KEY

public static final RequestKey PATH_SUFFIX_KEY
Key to access path suffix of "ActionServlet".

This value is PageMixer specific one.

You can get java.lang.String as Servlet path suffix of ActionServlet. This string value is ensured not to be "null", but may be ""(empty string).

In other words, you can get java.lang.String stored into request attribute storage class by org.apache.struts.Globals.SERVLET_KEY without head "*", if it starts with "*"(e.g.: "*.do"). Otherwise, you can get ""(empty string).

Constructor Detail

StrutsConsumerContext

public StrutsConsumerContext(javax.servlet.http.HttpServlet servlet,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
Construct consumer context with specified servlet environment.

In this consrructor, values identified below keys are stored into context.

Of course, values identified by other key objects (e.g.: ACTION_SERVLET_KEY) are also accessible via context.

Method Detail

getActionURI

public static java.lang.String getActionURI(ConsumerContext context,
                                            java.lang.String prefix,
                                            java.lang.String name)
Get URI for "Action".

This is equivalent to getActionURI(context, new StringBuffer(), prefix, name).toString().

Parameters:
context - to lookup
prefix - of Module
name - of Action
Since:
PageMixer 3.1

getActionURI

public static java.lang.String getActionURI(ConsumerContext context,
                                            java.lang.String name)
Get URI for "Action" of current module.

This is equivalent to getActionURI(context, null, name).

Parameters:
context - to lookup
name - of Action

getActionURI

public static java.lang.StringBuffer getActionURI(ConsumerContext context,
                                                  java.lang.StringBuffer buffer,
                                                  java.lang.String prefix,
                                                  java.lang.String name)
Get URI for "Action".

This gets context path of request by RequestMethodKey#CONTEXT_PATH at first. Then, invoke getActionPath(ConsumerContext, StringBuffer, String, String) to get path of specified action.

Parameters:
context - to lookup
buffer - to store action URI in
prefix - of Module
name - of Action
Since:
PageMixer 3.1

getActionURI

public static java.lang.StringBuffer getActionURI(ConsumerContext context,
                                                  java.lang.StringBuffer buffer,
                                                  java.lang.String name)
Get URI for "Action" of current module.

This is equivalent to getActionURI(context, buffer, null, name).

Parameters:
context - to lookup
buffer - to store action URI in
name - of Action

getActionPath

public static java.lang.String getActionPath(ConsumerContext context,
                                             java.lang.String prefix,
                                             java.lang.String name)
Get path for "Action".

This is equivalent to getActionPath(context, new StringBuffer(), prefix, name).toString().

Parameters:
context - to lookup
prefix - of Module
name - of Action
Since:
PageMixer 3.1

getActionPath

public static java.lang.String getActionPath(ConsumerContext context,
                                             java.lang.String name)
Get path for "Action" of current module.

This is equivalent to getActionPath(context, null, name).

Parameters:
context - to lookup
name - of Action

getActionPath

public static java.lang.StringBuffer getActionPath(ConsumerContext context,
                                                   java.lang.StringBuffer buffer,
                                                   java.lang.String prefix,
                                                   java.lang.String name)
Get path of "Action".

This stores only "name" into sepcified buffer, if specified "name" does not start with "/" for efficiency.

This tries to look ActionConfig up at first. Then, if ActionConfig is found, this composes fully qualified path for Action from below elements (term "URI" means as same as result of HttpServletRequest#getURI in this document).

Context Path + Path Prefix + Module Prefix + Action Path + Path Suffix

Context Path:
is from getContextPath of HttpServletRequest
Path Prefix:
is empty, if ActionServlet of Struts is mounted as "*.xxxx". Otherwise(mounted on "/xxxx/ *"), it is "/xxxx".
Module Prefix:
is not from specified "prefix" parameter, but from ModuleConfig#getPrefix on ModuleConfig of ActionConfig found, because null "prefix" parameter means "current" module
Aciton Path:
is from ActionConfig#getPath
Path Suffix:
is "xxxx", if ActionServlet of Struts is mounted as "*.xxxx". Otherwise(mounted on "/xxxx/ *"), it is empty.

Otherwise(ActionConfig is not found), this method returns specified name itself as path of Action.

Parameters:
context - to lookup
buffer - to store action path in
prefix - of Module(may be null)
name - of Action
Since:
PageMIxer 3.1

getActionPath

public static java.lang.StringBuffer getActionPath(ConsumerContext context,
                                                   java.lang.StringBuffer buffer,
                                                   java.lang.String name)
Get path for "Action" of current module.

This is equivalent to getActionPath(context, buffer, null, name).

Parameters:
context - to lookup
buffer - to store action path in
name - of Action

isRequestScope

public static boolean isRequestScope(org.apache.struts.config.ActionConfig config)
Deprecated. by FormKey.isRequestScope(org.apache.struts.config.ActionConfig)

Examine whether specified action form is in request scope or not.
Returns:
true if action form is not in session scope.

PageMixer API - 3.1