Oracle

com.bea.console.utils
Class HandleUtils

java.lang.Object
  extended by com.bea.console.utils.HandleUtils

public abstract class HandleUtils
extends Object

Contains methods to support the use of handles, which are objects that implement the Handle interface and are used to correlate a org.apache.struts.action.ActionForm bean with an underlying artifact that the bean represents, such as an MBean.


Field Summary
static int MAX_SESSION_HANDLES
           
static String SESSION_TYPED_HANDLES
           
 
Constructor Summary
HandleUtils()
           
 
Method Summary
static void clearHandlesInSession(HttpServletRequest request)
          Clears any existing handles from session context.
static Handle getHandleContext(ActionForm actionForm, HttpServletRequest request, String objectType)
           Searches an HttpServletRequest for an ActionForm that contains a handle object whose ObjectType property contains the specified value.
static Handle getHandleContextFromForm(ActionForm actionForm, String objectType)
           Searches in the HttpSession for an ActionForm that contains a handle object whose ObjectType property contains the specified value.
static Handle getHandleContextFromRequest(HttpServletRequest request, String objectType)
           Searches in the HttpServletRequest for the most recent handle object whose ObjectType property contains the specified value.
static Handle getHandleContextFromSession(HttpServletRequest request, String objectType)
           Searches in the session for the most recent handle object whose ObjectType property contains the specified value.
static void setHandleContextInSession(HttpServletRequest request, Handle handle)
          Stores the handle in the session context if it isn't already the most recent handle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SESSION_TYPED_HANDLES

public static final String SESSION_TYPED_HANDLES
See Also:
Constant Field Values

MAX_SESSION_HANDLES

public static final int MAX_SESSION_HANDLES
See Also:
Constant Field Values
Constructor Detail

HandleUtils

public HandleUtils()
Method Detail

getHandleContext

public static Handle getHandleContext(ActionForm actionForm,
                                      HttpServletRequest request,
                                      String objectType)

Searches an HttpServletRequest for an ActionForm that contains a handle object whose ObjectType property contains the specified value.

If this method does not find a match in the specified ActionForm, it searches the handle object most recently stored in the javax.servlet.http.HttpSession.

For example, if you specify getHandleContext(actionForm1, request1, "myAppMBean"), the method searces in request1 for actionForm1. If it finds actionForm1, it searches actionForm1 for a handle object whose ObjectType property contains "myAppMBean". If it does not find actionForm1, it searches in the session context for a handle object whose ObjectType property contains "myAppMBean".

Parameters:
actionForm - an org.apache.struts.action.ActionForm
request - a javax.servlet.http.HttpServletRequest
objectType - a String describing an ObjectType value. This can be an explicit value (like "myAppMBean"), "*" (which matches any ObjectType value), or an expression like "typea|typeb|typec"
Returns:
Handle, which might be null if no context was available

getHandleContextFromForm

public static Handle getHandleContextFromForm(ActionForm actionForm,
                                              String objectType)

Searches in the HttpSession for an ActionForm that contains a handle object whose ObjectType property contains the specified value.

For example, if you specify getHandleContext(actionForm1, "myAppMBean"), the method searces in the session for actionForm1. If it finds actionForm1, it searches actionForm1 for a handle object whose ObjectType property contains "myAppMBean".

Parameters:
actionForm - an org.apache.struts.action.ActionForm
objectType - a String describing an ObjectType value. This can be an explicit value (like "myAppMBean"), "*" (which matches any ObjectType value), or an expression like "typea|typeb|typec"
Returns:
Handle, which might be null if no handles matching this type were available

getHandleContextFromRequest

public static Handle getHandleContextFromRequest(HttpServletRequest request,
                                                 String objectType)

Searches in the HttpServletRequest for the most recent handle object whose ObjectType property contains the specified value.

Parameters:
request - a javax.servlet.http.HttpServletRequest
objectType - a String describing an ObjectType value. This can be an explicit value (like "myAppMBean"), "*" (which matches any ObjectType value), or an expression like "typea|typeb|typec"
Returns:
Handle, which might be null if no handles matching this type were available

clearHandlesInSession

public static void clearHandlesInSession(HttpServletRequest request)
Clears any existing handles from session context.

Parameters:
request - the current HttpServletRequest

getHandleContextFromSession

public static Handle getHandleContextFromSession(HttpServletRequest request,
                                                 String objectType)

Searches in the session for the most recent handle object whose ObjectType property contains the specified value.

Parameters:
request - a javax.servlet.http.HttpServletRequest
objectType - a String describing an ObjectType value. This can be an explicit value (like "myAppMBean"), "*" (which matches any ObjectType value), or an expression like "typea|typeb|typec"
Returns:
Handle, which might be null if no handles matching this type were available

setHandleContextInSession

public static void setHandleContextInSession(HttpServletRequest request,
                                             Handle handle)
Stores the handle in the session context if it isn't already the most recent handle.

Parameters:
request - an HttpServletRequest
handle - a Handle to a management artifact

Documentation is available at
http://edocs.bea.com/wls/docs103
Copyright 1996,2008, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.