Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

oracle.jbo.http
Class HttpContainer

java.lang.Object
  extended byoracle.jbo.http.HttpContainer
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, java.io.Serializable, SessionCookieListener

public class HttpContainer
extends java.lang.Object
implements javax.servlet.http.HttpSessionBindingListener, SessionCookieListener, java.io.Serializable

A container for BC4J HTTP context resources. This class is intended for use by BC4J classes that must cache application resources in one of the servlet/jsp contexts. This may include the HttpSession, the HttpServletRequest, the HttpServletResponse, and the PageContext.

The container provides a listener interface to notify cached BC4J resources when they are bound and unbound from the context container.

See Also:
Serialized Form

Field Summary
static java.lang.String APPLICATION_BINDING_LISTENER_PREFIX
           
static java.lang.String APPLICATION_COOKIE_PREFIX
           
static java.lang.String APPLICATION_PREFIX
           
static java.lang.String PAGE_CONTEXT_CONTAINER_NAME
           
static java.lang.String SESSION_CONTEXT_CONTAINER_NAME
           
 
Constructor Summary
HttpContainer()
          Should not be invoked directly.
HttpContainer(java.lang.Object contextRef)
          Deprecated. This class should not be instantiated directly. Use getInstanceFromSession(HttpSession) instead.
 
Method Summary
 void clear(java.util.Properties userProperties)
           
 void cookieUpdated()
           
 java.lang.String encodeURL(java.lang.String url)
          Encode a URL with the values of the session cookies that are contained by this container.
static SessionCookie findSessionCookie(javax.servlet.http.HttpSession session, java.lang.String applicationId, java.lang.String applicationDefinitionName, java.util.Properties cookieProperties)
          Locates a SessionCookie instance with the specified applicationId in the HttpContainer associated with this session.
static SessionCookie findSessionCookie(javax.servlet.http.HttpSession session, java.lang.String applicationId, java.lang.String poolName, java.lang.String configPackage, java.lang.String configSection, java.util.Properties poolProps, java.util.Properties cookieProps)
          Locates a SessionCookie instance with the specified applicationId in the HttpContainer associated with this session.
static HttpContainer getInstanceFromSession(javax.servlet.http.HttpSession session)
          Retrieve an http container instance from the http session context.
 SessionCookie getSessionCookie(java.lang.String applicationId)
          Get a session cookie instance from the http session container.
 SessionCookie[] getSessionCookies()
          Get all session cookie instances from the http session container.
 java.lang.Object getValue(java.lang.Object key)
           
 java.lang.Object putValue(java.lang.Object key, java.lang.Object value, java.util.Properties userProperties)
           
 java.lang.Object removeValue(java.lang.Object key, java.util.Properties userProperties)
           
 java.lang.Object removeValueInternal(java.lang.Object key)
           
 void setSessionCookie(java.lang.String applicationId, SessionCookie cookie)
          Set a session cookie instance in the http session container.
 void timeout(java.util.Properties userProperties)
           
 void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
           
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAGE_CONTEXT_CONTAINER_NAME

public static final java.lang.String PAGE_CONTEXT_CONTAINER_NAME
See Also:
Constant Field Values

SESSION_CONTEXT_CONTAINER_NAME

public static final java.lang.String SESSION_CONTEXT_CONTAINER_NAME
See Also:
Constant Field Values

APPLICATION_COOKIE_PREFIX

public static final java.lang.String APPLICATION_COOKIE_PREFIX
See Also:
Constant Field Values

APPLICATION_BINDING_LISTENER_PREFIX

public static final java.lang.String APPLICATION_BINDING_LISTENER_PREFIX
See Also:
Constant Field Values

APPLICATION_PREFIX

public static final java.lang.String APPLICATION_PREFIX
See Also:
Constant Field Values
Constructor Detail

HttpContainer

public HttpContainer(java.lang.Object contextRef)
Deprecated. This class should not be instantiated directly. Use getInstanceFromSession(HttpSession) instead.

Constructor


HttpContainer

public HttpContainer()
Should not be invoked directly. Use getInstanceFromSession(HttpSession) instead. Public for backwards compatibility only.

Method Detail

getValue

public java.lang.Object getValue(java.lang.Object key)

removeValue

public java.lang.Object removeValue(java.lang.Object key,
                                    java.util.Properties userProperties)

removeValueInternal

public java.lang.Object removeValueInternal(java.lang.Object key)

clear

public void clear(java.util.Properties userProperties)

timeout

public void timeout(java.util.Properties userProperties)

putValue

public java.lang.Object putValue(java.lang.Object key,
                                 java.lang.Object value,
                                 java.util.Properties userProperties)

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent e)
Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent e)
Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener

getInstanceFromSession

public static HttpContainer getInstanceFromSession(javax.servlet.http.HttpSession session)
Retrieve an http container instance from the http session context.

Parameters:
session - the target http session context

getSessionCookie

public SessionCookie getSessionCookie(java.lang.String applicationId)
Get a session cookie instance from the http session container.

Parameters:
applicationId - the application id that will be used to reference the session cookie

getSessionCookies

public SessionCookie[] getSessionCookies()
Get all session cookie instances from the http session container.


setSessionCookie

public void setSessionCookie(java.lang.String applicationId,
                             SessionCookie cookie)
Set a session cookie instance in the http session container. The cookie name will be used to store the session cookie.

Parameters:
applicationId - the application id that will be used to reference the session cookie
cookie - the session cookie instance that will be stored

encodeURL

public java.lang.String encodeURL(java.lang.String url)
Encode a URL with the values of the session cookies that are contained by this container. The encoded values will be decoded by the default implementation of SessionCookie.readValue(Object) when and if the session cookie is re-instantiated.


cookieUpdated

public void cookieUpdated()
Specified by:
cookieUpdated in interface SessionCookieListener

findSessionCookie

public static SessionCookie findSessionCookie(javax.servlet.http.HttpSession session,
                                              java.lang.String applicationId,
                                              java.lang.String applicationDefinitionName,
                                              java.util.Properties cookieProperties)
Locates a SessionCookie instance with the specified applicationId in the HttpContainer associated with this session. If a cookie is not located then one will be created.

This method will use an application defintion (defined in a .cpx file) to create/locate an ApplicationPool. That ApplicationPool will be used to generate the requested SessionCookie.

The optional cookie properties parameter may be used to pass properties through to the SessionCookieFactory instance which will create the SessionCookie. For example, the HttpSessionCookieFactory may be passed the current HttpServletRequest in the properties object with the oracle.jbo.http.HttpSessionCookieFactory.HTTP_SERVLET_REQUEST key. The request will be used to acquire a sessionId from the HttpSession and to determine if a BC4J application cookie, representing a failed over ApplicationModule state, was written in a previous request.

This method will register an HttpSessionCookieFactory with the target pool unless a custom SessionCookieFactory has been specified.

Please see the javadoc for the SessionCookieFactory implementation which has been specified for more information about supported properties.

Parameters:
session - - the session in which the cookie will be cached
applicationId - - the cookie cache key. The application id will also be used as part of the cookie identity if a cookie must be created.
applicationDefinitionName - - a named ApplicationDefinition. The applicationDefintionName will be used to locate/create an ApplicationPool.
cookieProperties - - a collection of Properties to be used during cookie creation (see SessionCookieFactory.createSessionCookie(String, String, ApplicationPool, Properties)).
See Also:
SessionCookie, ApplicationPool, JUMetaObjectManager, HttpSessionCookieFactory, SharedSessionCookieFactory,


findSessionCookie

public static SessionCookie findSessionCookie(javax.servlet.http.HttpSession session,
                                              java.lang.String applicationId,
                                              java.lang.String poolName,
                                              java.lang.String configPackage,
                                              java.lang.String configSection,
                                              java.util.Properties poolProps,
                                              java.util.Properties cookieProps)
Locates a SessionCookie instance with the specified applicationId in the HttpContainer associated with this session. If a cookie is not located then one will be created.

This method will use the pool name and a named configuration (defined in a .xcfg file) to create/locate an ApplicationPool. That ApplicationPool will be used to generate the requested SessionCookie if a cookie is not located.

The optional pool properties parameter may be used to configure the pool at runtime. If a pool must be created then the pool properties will be merged with the specified configuration (please note that the properties will not be used if the pool already exists). In the case of property conflicts between the runtime specified properties and the Configuration properties, the runtime properties will take precendence. The merged Configuration and pool properties will be copied into the ApplicationPool environment and eventually into the SessionCookie environment. Examples of valid pool properties include:

PropertyConstants.ENV_DO_FAILOVER PropertyConstants.ENV_DO_CONNECTION_POOLING PropertyConstants.ENV_AMPOOL_DYNAMIC_JDBC_CREDENTIALS PropertyConstants.ENV_AMPOOL_RESET_NON_TRANSACTIONAL_STATE PropertyConstants.ENV_AMPOOL_MAX_POOL_SIZE PropertyConstants.ENV_AMPOOL_INIT_POOL_SIZE PropertyConstants.ENV_AMPOOL_MONITOR_SLEEP_INTERVAL PropertyConstants.ENV_AMPOOL_MIN_AVAIL_SIZE PropertyConstants.ENV_AMPOOL_MAX_AVAIL_SIZE PropertyConstants.ENV_AMPOOL_MAX_INACTIVE_AGE

Please see the BC4J documentation for a description of each of these properties.

The optional cookie properties parameter may be used to pass properties through to the tory instance which will create the SessionCookie. For example, the HttpSessionCookieFactory may be passed the current HttpServletRequest in the properties object with the oracle.jbo.http.HttpSessionCookieFactory.HTTP_SERVLET_REQUEST key. The request will be used to acquire a sessionId from the HttpSession and to determine if a BC4J application cookie, representing a failed over ApplicationModule state, was written in a previous request.

This method will register an HttpSessionCookieFactory with the target pool unless a custom SessionCookieFactory has been specified.

Please see the javadoc for the SessionCookieFactory implementation which has been specified for more information about supported properties.

Parameters:
session - - the session in which the cookie will be cached
applicationId - - the cookie cache key. The application id will also be used as part of the cookie identity if a cookie must be created.
poolName - - the pool key of the ApplicationPool which will be used to generate the SessionCookie (see Mgr#findPool(String, String, String, Properties)).

configPackage - - the configuration package. For instance, if the configuration is defined for an ApplicationModule with the full name, "hrpackage.HRAppModule", then the configPackage name is "hrpackage".

configSection - - the configuration name. In the example for the configuration package above the configuration name might be "HRAppModuleLocal".

poolProps - - a collection of properties to be used during pool creation.

cookieProps - - a collection of Properties to be used during cookie creation (see ry#createSessionCookie(String, String, ApplicationPool, Properties)).
See Also:
SessionCookie, ApplicationPool, JUMetaObjectManager, HttpSessionCookieFactory, SharedSessionCookieFactory,


Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

 

Copyright © 1997, 2004, Oracle. All rights reserved.