|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectForwardConfig
ActionForward
Forward
public class Forward
An object of this type is returned from an action methods in a PageFlowController
to
determine the next URI to be displayed. It is constructed on the name of a forward defined
by the @@Jpf.Forward
annotation, and resolves to the URI
specified in that forward.
Field Summary | |
---|---|
static int |
RETURN_TO_ACTION
Deprecated. Use RETURN_TO_PREVIOUS_ACTION instead. |
static int |
RETURN_TO_CURRENT_PAGE
|
static int |
RETURN_TO_NONE
|
static int |
RETURN_TO_PAGE
Deprecated. Use RETURN_TO_CURRENT_PAGE or RETURN_TO_PREVIOUS_PAGE instead. |
static int |
RETURN_TO_PREVIOUS_ACTION
|
static int |
RETURN_TO_PREVIOUS_PAGE
|
Fields inherited from class ForwardConfig |
---|
configured, contextRelative, name, path, redirect |
Constructor Summary | |
---|---|
protected |
Forward(ActionForward initFwd,
ServletContext servletContext)
Internal. |
protected |
Forward(Forward init)
Construct based on an initializer Forward. |
protected |
Forward(HttpServletRequest request)
Construct based on a given request. |
|
Forward(String forwardName)
Constructor which accepts the name of a forward defined by the @Jpf.Forward
annotation. |
protected |
Forward(String path,
boolean doRedirect)
Construct based on the given webapp-relative path. |
|
Forward(String forwardName,
Object outputFormBean)
Constructor which accepts the name of a forward defined by the @Jpf.Forward
annotation. |
|
Forward(String forwardName,
String actionOutputName,
Object actionOutputValue)
Constructor which accepts the name of a forward defined by the @Jpf.Forward
annotation. |
|
Forward(URI uri)
Constructs a Forward that returns the given URI for getPath() . |
|
Forward(URI uri,
boolean doRedirect)
Constructs a Forward that returns the given URI for getPath() . |
|
Forward(URL url)
Constructs a Forward that returns the given URL for getPath() . |
Method Summary | |
---|---|
void |
addActionOutput(String paramName,
Object value)
Adds an action output that will be made available in the request, through PageFlowUtils.getActionOutput(java.lang.String, javax.servlet.ServletRequest) . |
void |
addOutputForm(Object formBean)
Add a form bean that will be made available in the request (or user session, as appropriate) if this Forward is returned by an action method in a PageFlowController . |
void |
addPageInput(String paramName,
Object value)
Deprecated. Use addActionOutput(java.lang.String, java.lang.Object) instead. |
void |
addQueryParam(String paramName)
Add a query parameter with no value to the URI returned by getPath() . |
void |
addQueryParam(String paramName,
String value)
Add a query parameter to the URI returned by getPath() . |
boolean |
doesResolve()
Tell whether getPath() will be successful, i.e., whether one of the following two
conditions is met:
the name around which this object was constructed resolves to a path defined
by a @Jpf.Forward , or
this object was constructed around an explicit path, by
Forward(URI) or Forward(URL) . |
boolean |
doesRestoreQueryString()
Tell whether this Forward will restore the original query string on the page restored when a @Jpf.Forward ,
@Jpf.SimpleAction ,
or @Jpf.ConditionalForward
with navigateTo= is used. |
protected ActionForward |
findForward(String forwardName)
Resolves the forward with the given name, from the stored ActionMapping if possible, or from the stored alternate ModuleConfig as a last resort. |
boolean |
forwardsToPageFlow()
Tell whether the URI returned by getPath() is for a page flow. |
Map |
getActionOutputs()
Get all action outputs that have been set on this Forward. |
ActionForm |
getFirstOutputForm(HttpServletRequest request)
Get the first output form bean that was added to this Forward. |
ActionForm[] |
getOutputForms()
Get all form-beans attached to this forward through addOutputForm(java.lang.Object) or Forward(String, Object) . |
Map |
getPageInputs()
Deprecated. Use getActionOutputs() instead. |
String |
getPath()
Get the URI path associated with this object. |
String |
getQueryString()
Get the query string that will be appended to the URI returned by getPath() . |
int |
getReturnToType()
Get the type of return, if this is a return-to type. |
String |
getReturnToTypeAsString()
Get the type of return as a String, if this is a return-to type. |
boolean |
hasExplicitRedirectValue()
Tell whether this Forward was configured explicitly (through @Jpf.Forward(redirect=...) ,
setRedirect(boolean) , or Forward(URI, boolean) ) to perform a redirect. |
boolean |
hasRelativeToPath()
Tell whether this Forward is relative to a particular directory path (as is the case when inheriting local paths from base classes). |
void |
initialize(ActionMapping mapping,
FlowController flowController)
Deprecated. Use initialize(ActionMapping, FlowController, ServletRequest) instead. |
void |
initialize(ActionMapping mapping,
FlowController flowController,
ServletRequest request)
Set the current ActionMapping and associated FlowController. |
void |
initializeRelativePath(ServletRequest request,
String relativeTo)
If this is a local path, change it so it's relative to the given path prefix, and remember that we did it in a flag (_outsidePageFlowDirectory). |
boolean |
isExternalRedirect()
Tell whether this is a redirect to a URI outside of the current web application. |
boolean |
isNestedReturn()
Tell whether returning this forward from an action method will cause a return from a nested PageFlowController . |
boolean |
isRedirect()
Tell whether the URI resolved by this Forward should be redirected to. |
boolean |
isReturnToAction()
Tell whether returning this forward from an action method will cause the previous action to be re-run. |
boolean |
isReturnToPage()
Tell whether returning this forward from an action method will cause a previous page to be displayed. |
void |
setAlternateModuleConfig(ModuleConfig mc)
Set an alternate ModuleConfig from which to resolve forwards if they are not resolved from the stored ActionMapping (and its stored ModuleConfig). |
void |
setExternalRedirect(boolean externalRedirect)
Specify that this is a redirect to a URI outside of the current web application. |
void |
setPath(String contextRelativePath)
Set the path to be returned by getPath() . |
void |
setQueryString(String queryString)
Set the query string that will be appended to the URI returned by getPath() . |
void |
setRedirect(boolean doRedirect)
Set whether the URI resolved by this Forward should be redirected to. |
void |
setRestoreQueryString(boolean doesRestoreQueryString)
Set whether this Forward will restore the original query string query string on the page restored when a @Jpf.Forward ,
@Jpf.SimpleAction ,
or @Jpf.ConditionalForward
with navigateTo= is used. |
Methods inherited from class ForwardConfig |
---|
freeze, getContextRelative, getName, getRedirect, setContextRelative, setName, toString |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int RETURN_TO_NONE
public static final int RETURN_TO_CURRENT_PAGE
public static final int RETURN_TO_PREVIOUS_PAGE
public static final int RETURN_TO_PREVIOUS_ACTION
public static final int RETURN_TO_PAGE
RETURN_TO_CURRENT_PAGE
or RETURN_TO_PREVIOUS_PAGE
instead.public static final int RETURN_TO_ACTION
RETURN_TO_PREVIOUS_ACTION
instead.Constructor Detail |
---|
protected Forward(Forward init)
protected Forward(HttpServletRequest request)
public Forward(String forwardName)
@Jpf.Forward
annotation. The values returned from getPath()
, ForwardConfig.getRedirect()
and
ForwardConfig.contextRelative
are resolved from this forward.
forwardName
- the name of the forward
(@Jpf.Forward
) to resolve.public Forward(String forwardName, Object outputFormBean)
@Jpf.Forward
annotation. The values returned from getPath()
, ForwardConfig.getRedirect()
and
ForwardConfig.contextRelative
are resolved from this forward. Also accepts a form bean
to make available in the request (or user session, as appropriate).
forwardName
- the name of the forward
(@Jpf.Forward
) to resolve.outputFormBean
- a form bean instance to make available in the request (or user session, as appropriate).
See addOutputForm(java.lang.Object)
for details about how this manifests itself.public Forward(String forwardName, String actionOutputName, Object actionOutputValue)
@Jpf.Forward
annotation. The values returned from getPath()
, ForwardConfig.getRedirect()
and
ForwardConfig.contextRelative
are resolved from this forward. Also accepts a named action output
to make available in the request, through PageFlowUtils.getActionOutput(java.lang.String, javax.servlet.ServletRequest)
..
forwardName
- the name of the forward
(@Jpf.Forward
) to resolve.actionOutputName
- the name of a action output to make available in the request.actionOutputValue
- the action output object to make available in the request.public Forward(URI uri)
getPath()
. By default
the Forward will cause server forward (not a browser redirect); to change this, use
setRedirect(boolean)
.
uri
- the URI to return for getPath()
.public Forward(URI uri, boolean doRedirect)
getPath()
.
uri
- the URI to return for getPath()
.doRedirect
- set to true
if this Forward should cause a browser redirect;
false
if it should cause a server forward.protected Forward(String path, boolean doRedirect)
public Forward(URL url)
getPath()
. Because the URL path
is absolute by nature, this Forward will cause a browser redirect.
url
- the URL to return for getPath()
.protected Forward(ActionForward initFwd, ServletContext servletContext)
Method Detail |
---|
public void setRedirect(boolean doRedirect)
setRedirect
in class ForwardConfig
doRedirect
- if true
, the controller will send a browser redirect to
the URI for this Forward; otherwise, it will do a server forward to
the URI.public boolean isRedirect()
true
if the controller will send a browser redirect to the URI for
this Forward; false
if it will do a server forward to the URI.public final void addOutputForm(Object formBean)
PageFlowController
.
Specifically, each form bean is stored as a request attribute with a name determined by
PageFlowUtils.getFormBeanName(org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest)
.
formBean
- the form bean instance to add.public final ActionForm[] getOutputForms()
addOutputForm(java.lang.Object)
or Forward(String, Object)
.
public ActionForm getFirstOutputForm(HttpServletRequest request)
public boolean doesResolve()
getPath()
will be successful, i.e., whether one of the following two
conditions is met:
@Jpf.Forward
, orForward(URI)
or Forward(URL)
.
true
if this forward does resolve to a URI path.protected ActionForward findForward(String forwardName)
forwardName
- the name of the forward to resolve.
null
if none is found.public void setAlternateModuleConfig(ModuleConfig mc)
public void initialize(ActionMapping mapping, FlowController flowController)
initialize(ActionMapping, FlowController, ServletRequest)
instead.
getPath()
.
mapping
- the current ActionMapping; this can be obtained from FlowController.getMapping()
.flowController
- the object in which to look for referenced return-form members.public void initialize(ActionMapping mapping, FlowController flowController, ServletRequest request)
getPath()
.
mapping
- the current ActionMapping; this can be obtained from FlowController.getMapping()
.flowController
- the object in which to look for referenced return-form members.public void setPath(String contextRelativePath)
getPath()
. This overrides any path or forward name
set in a constructor.
setPath
in class ForwardConfig
contextRelativePath
- the path to be returned by getPath()
.public boolean hasExplicitRedirectValue()
@Jpf.Forward(redirect=...)
,
setRedirect(boolean)
, or Forward(URI, boolean)
) to perform a redirect. Otherwise, a redirect is
implied by a URI that does not resolve to the current server.
public String getPath()
@Jpf.Forward
) if necessary.
getPath
in class ForwardConfig
Forward(String)
,
Forward(String, Object)
,
Forward(URI)
,
Forward(URL)
,
setPath(java.lang.String)
public boolean isNestedReturn()
PageFlowController
.
true
if this forward will cause a return from nesting.public boolean isReturnToPage()
true
if returning this forward from an action method will cause
a previous page to be displayed.public boolean isReturnToAction()
true
if returning this forward from an action method will cause the
previous action to be re-run, i.e., whether the URI returned by getPath()
will end
in "previous-action-name.do".public boolean isExternalRedirect()
public void setExternalRedirect(boolean externalRedirect)
public boolean doesRestoreQueryString()
@Jpf.Forward
,
@Jpf.SimpleAction
,
or @Jpf.ConditionalForward
with navigateTo=Jpf.NavigateTo.previousAction
is used.
public void setRestoreQueryString(boolean doesRestoreQueryString)
@Jpf.Forward
,
@Jpf.SimpleAction
,
or @Jpf.ConditionalForward
with navigateTo=Jpf.NavigateTo.previousAction
is used.
public boolean forwardsToPageFlow()
getPath()
is for a page flow.
true
if the URI returned by getPath()
is for a page flow, i.e.,
if it ends in ".jpf".public void setQueryString(String queryString)
getPath()
.
queryString
- the query string that will be appended to the URI. If this string does not
start with '?'
, then this character will be prepended; if the string is
null
, the query string will be removed.public String getQueryString()
getPath()
.
null
if there
is no query string.public void addQueryParam(String paramName, String value)
getPath()
.
paramName
- the name of the query parameter.value
- the value of the query parameter, or null
if there is no value.public final void addQueryParam(String paramName)
getPath()
.
paramName
- the name of the query parameter.public void addPageInput(String paramName, Object value)
addActionOutput(java.lang.String, java.lang.Object)
instead.
PageFlowUtils.getActionOutput(java.lang.String, javax.servlet.ServletRequest)
.
paramName
- the name of the action output.value
- the action output value.public void addActionOutput(String paramName, Object value)
PageFlowUtils.getActionOutput(java.lang.String, javax.servlet.ServletRequest)
.
paramName
- the name of the action output.value
- the action output value.public Map getPageInputs()
getActionOutputs()
instead.
addActionOutput(java.lang.String, java.lang.Object)
public Map getActionOutputs()
addActionOutput(java.lang.String, java.lang.Object)
public int getReturnToType()
return-to
type.
RETURN_TO_CURRENT_PAGE
, RETURN_TO_PREVIOUS_PAGE
,
RETURN_TO_PAGE
, RETURN_TO_PREVIOUS_ACTION
, RETURN_TO_ACTION
, or
RETURN_TO_NONE
if this Forward is not a return-to
type.isReturnToAction()
,
isReturnToPage()
public String getReturnToTypeAsString()
return-to
type.
currentPage
, previousPage
, page
,
(deprecated), previousAction
, action
(deprecated), or null
if this is not a return-to
type.isReturnToAction()
,
isReturnToPage()
public boolean hasRelativeToPath()
This is a framework-invoked method that should not normally be called directly.
public void initializeRelativePath(ServletRequest request, String relativeTo)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |