org.apache.beehive.netui.tags.internal
Class PageFlowTagUtils

Object
  extended by PageFlowTagUtils

public class PageFlowTagUtils
extends Object

This is a utility class for the beehive tags with routines for helping with URL rewriting.

Includes methods to create a fully-rewritten url based on an initial url with query parameters and an anchor (location on page), checking if it needs to be secure and rewriting. There's also a method to check if a url is an action.


Nested Class Summary
static class PageFlowTagUtils.MappingAndController
           
 
Constructor Summary
PageFlowTagUtils()
           
 
Method Summary
static PageFlowTagUtils.MappingAndController getActionMapping(HttpServletRequest request, FlowController flowController, String action)
           
static String getToken(HttpServletRequest request, ActionMapping mapping)
          Get or generate a token used to prevent double submits to an action.
static String getToken(HttpServletRequest request, String action)
          Get or generate a token used to prevent double submits to an action.
static boolean isAction(HttpServletRequest request, String action)
          Determine whether a given URI is an Action.
static String rewriteActionURL(PageContext pageContext, String action, Map params, String location)
          Create a fully-rewritten url from an initial action url with query parameters and an anchor (location on page), checking if it needs to be secure then call the rewriter service using a type of URLType.ACTION.
static String rewriteHrefURL(PageContext pageContext, String url, Map params, String location)
          Create a fully-rewritten url from an initial href url with query parameters and an anchor (location on page), checking if it needs to be secure then call the rewriter service using a type of URLType.ACTION.
static String rewriteResourceURL(PageContext pageContext, String url, Map params, String location)
          Create a fully-rewritten url from an initial resource url with query parameters and an anchor (location on page), checking if it needs to be secure then call the rewriter service using a type of URLType.RESOURCE.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageFlowTagUtils

public PageFlowTagUtils()
Method Detail

rewriteActionURL

public static String rewriteActionURL(PageContext pageContext,
                                      String action,
                                      Map params,
                                      String location)
                               throws URISyntaxException
Create a fully-rewritten url from an initial action url with query parameters and an anchor (location on page), checking if it needs to be secure then call the rewriter service using a type of URLType.ACTION.

Parameters:
pageContext - the current PageContext.
action - the action url to rewrite.
params - the query parameters for this url.
location - the location (anchor or fragment) for this url.
Returns:
a uri that has been run through the URL rewriter service.
Throws:
URISyntaxException

rewriteHrefURL

public static String rewriteHrefURL(PageContext pageContext,
                                    String url,
                                    Map params,
                                    String location)
                             throws URISyntaxException
Create a fully-rewritten url from an initial href url with query parameters and an anchor (location on page), checking if it needs to be secure then call the rewriter service using a type of URLType.ACTION.

Parameters:
pageContext - the current PageContext.
url - the href url to rewrite.
params - the query parameters for this url.
location - the location (anchor or fragment) for this url.
Returns:
a url that has been run through the URL rewriter service.
Throws:
URISyntaxException
See Also:
PageFlowUtils.getRewrittenHrefURI(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, String, java.util.Map, String, boolean)

rewriteResourceURL

public static String rewriteResourceURL(PageContext pageContext,
                                        String url,
                                        Map params,
                                        String location)
                                 throws URISyntaxException
Create a fully-rewritten url from an initial resource url with query parameters and an anchor (location on page), checking if it needs to be secure then call the rewriter service using a type of URLType.RESOURCE.

Parameters:
pageContext - the current PageContext.
url - the resource url to rewrite.
params - the query parameters for this url.
location - the location (anchor or fragment) for this url.
Returns:
a url that has been run through the URL rewriter service.
Throws:
URISyntaxException
See Also:
PageFlowUtils.getRewrittenResourceURI(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, String, java.util.Map, String, boolean)

isAction

public static boolean isAction(HttpServletRequest request,
                               String action)
Determine whether a given URI is an Action.

Parameters:
request - the current HttpServletRequest.
action - the URI to check.
Returns:
true if the action is defined in the current page flow or in a shared flow. Otherwise, return false.

getToken

public static String getToken(HttpServletRequest request,
                              String action)
Get or generate a token used to prevent double submits to an action. The token is stored in the session, and checked (and removed) when processing an action with the preventDoubleSubmit attribute set to true.


getToken

public static String getToken(HttpServletRequest request,
                              ActionMapping mapping)
Get or generate a token used to prevent double submits to an action. The token is stored in the session, and checked (and removed) when processing an action with the preventDoubleSubmit attribute set to true.


getActionMapping

public static PageFlowTagUtils.MappingAndController getActionMapping(HttpServletRequest request,
                                                                     FlowController flowController,
                                                                     String action)