<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">

Oracle9i Business Components for Java API Reference
Oracle9i Jdeveloper (9.0.4)
B10391-01


oracle.jbo.http
Class HttpSessionCookieImpl

java.lang.Object
  |
  +--oracle.jbo.common.ampool.SessionCookieImpl
        |
        +--oracle.jbo.http.HttpSessionCookieImpl
All Implemented Interfaces:
ApplicationModuleHandle, ApplicationModuleRef, oracle.jbo.http.BindingListener, HttpSessionCookie, java.io.Serializable, SessionCookie
Direct Known Subclasses:
SharedSessionCookieImpl

public class HttpSessionCookieImpl
extends SessionCookieImpl
implements HttpSessionCookie, oracle.jbo.http.BindingListener, java.io.Serializable

Default HttpSessionCookie implementation.

The implementation uses a pluggable helper interface, HttpSessionCookieHelper, to generate unique session identifiers for browser sessions, to read browser cookie values, and to write browser cookie values.

Implements the BindingListener interface. When a session HttpContainer instance is unbound from an HttpSession context the BindingListeners will be notified that a timeout event occured. The timeout implementation releases the application module resource to the application pool. The release is unmanaged since the request is assumed to have already ended.

The HttpSessionCookieImpl also implements additional support for BC4J based authentication. If a single sign on module like mod_osso is not being used then an application developer can set a security principal and security credential in the HttpSession context for later authentication by the BC4J security login module. In order to enable this mode the application developer must have configured the jbo.security.enforce property. The principal and credentials should be cached in the session as follows:

session.setAttribute( JboContext.SECURITY_PRINCIPAL, (String)<principal name>); session.setAttribute( JboContext.SECURITY_CREDENTIALS, (String)<credential>);

Finally, the HttpSessionCookie implementation uses composition to implement the SessionCookie interface. All SessionCookie methods are delegated to an instance of the default SessionCookie implementation. Please see SessionCookieImpl for more infomartion regarding the default session cookie implementation.

See Also:
Serialized Form

Field Summary

 

Fields inherited from interface oracle.jbo.common.ampool.SessionCookie
FORCE_RELEASE_MODE, MANAGED_RELEASE_MODE, NULL_PASSIVATION_ID, REMOVE_RESOURCE, RESERVED_MANAGED_RELEASE_MODE, RESERVED_UNMANAGED_RELEASE_MODE, SHARED, SHARED_MANAGED_RELEASE_MODE, SHARED_RELEASE_MODE, SHARED_UNMANAGED_RELEASE_MODE, STATE_MANAGED, STATE_UNMANAGED, UNSHARED

 

Constructor Summary
HttpSessionCookieImpl(java.lang.String applicationId, java.lang.String sessionId, ApplicationPool pool)
          This constructor may be used if the sessionId is already known.
HttpSessionCookieImpl(java.lang.String applicationId, java.lang.String sessionId, ApplicationPool pool, java.security.Principal userPrincipal, javax.servlet.http.HttpServletRequest request)
           

 

Method Summary
protected  void afterApplicationModuleRelease()
           
protected  void beforeApplicationModuleRelease(ApplicationModule am)
           
 boolean isFailoverEnabled()
          Indicates that session application module state should be persisted to secondary storage immediately upon a managed release.
 java.lang.String readValue(java.lang.Object source)
          Read the cookie value to the specified data sink.
 void timeout(oracle.jbo.http.BindingEvent ev)
           
 ApplicationModule useApplicationModule(boolean lock, long waitTimeout)
          Returns an application module instance for the current thread.
 void valueBound(oracle.jbo.http.BindingEvent ev)
           
 void valueUnbound(oracle.jbo.http.BindingEvent ev)
           
 void writeValue(java.lang.Object sink)
          Write the cookie value to the specified data sink.

 

Methods inherited from class oracle.jbo.common.ampool.SessionCookieImpl
copyInto, equals, getApplicationId, getClientEnvironment, getClientEnvironment, getEnvConfigurationName, getEnvInfoProvider, getEnvironment, getEnvironment, getLastUpdate, getMostRecentStackId, getPassivationId, getPoolSignature, getProperty, getReservedPassivationId, getSessionId, getSSOSubscriber, getSSOUserName, getSyncLock, getThreadRefCount, getUserData, getValue, hashCode, isActivationRequired, isActivationRequired, isApplicationModuleReleased, isApplicationModuleReleasedByThread, isApplicationModuleReserved, isConnectionPoolingEnabled, isResetNonTransactionalState, parsePassivationId, parseSessionId, releaseApplicationModule  

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface oracle.jbo.common.ampool.SessionCookie
copyInto, equals, getApplicationId, getEnvConfigurationName, getEnvInfoProvider, getLastUpdate, getMostRecentStackId, getPassivationId, getPoolSignature, getReservedPassivationId, getSessionId, getSSOSubscriber, getSSOUserName, getSyncLock, getThreadRefCount, getValue, hashCode, isActivationRequired, isActivationRequired, isApplicationModuleReleased, isApplicationModuleReleasedByThread, isConnectionPoolingEnabled, isResetNonTransactionalState, releaseApplicationModule, releaseApplicationModule, releaseApplicationModule, releaseApplicationModule, reservePassivationId, reservePassivationId, resetStateInternal, setActivationRequired, setEnvInfoProvider, setEnvironment, setEnvironment, setMostRecentStackId, setPassivationId, setReservedPassivationId, setSessionCookieListener, toString

 

Methods inherited from interface oracle.jbo.common.ampool.ApplicationModuleRef
isApplicationModuleReserved, resetState, useApplicationModule, useApplicationModule

 

Methods inherited from interface oracle.jbo.ApplicationModuleHandle
getClientEnvironment, getClientEnvironment, getEnvironment, getEnvironment, getUserData

 

Constructor Detail

HttpSessionCookieImpl

public HttpSessionCookieImpl(java.lang.String applicationId,
                             java.lang.String sessionId,
ApplicationPool pool)
This constructor may be used if the sessionId is already known.

HttpSessionCookieImpl

public HttpSessionCookieImpl(java.lang.String applicationId,
                             java.lang.String sessionId,
ApplicationPool pool,
                             java.security.Principal userPrincipal,
                             javax.servlet.http.HttpServletRequest request)
Method Detail

valueBound

public void valueBound(oracle.jbo.http.BindingEvent ev)
Specified by:
valueBound in interface oracle.jbo.http.BindingListener

valueUnbound

public void valueUnbound(oracle.jbo.http.BindingEvent ev)
Specified by:
valueUnbound in interface oracle.jbo.http.BindingListener

timeout

public void timeout(oracle.jbo.http.BindingEvent ev)
Specified by:
timeout in interface oracle.jbo.http.BindingListener

writeValue

public void writeValue(java.lang.Object sink)
Description copied from interface: SessionCookie
Write the cookie value to the specified data sink.
Specified by:
writeValue in interface SessionCookie
Overrides:
writeValue in class SessionCookieImpl
Parameters:
sink - a data sink

readValue

public java.lang.String readValue(java.lang.Object source)
Description copied from interface: SessionCookie
Read the cookie value to the specified data sink.
Specified by:
readValue in interface SessionCookie
Overrides:
readValue in class SessionCookieImpl
Parameters:
source - a data source

isFailoverEnabled

public boolean isFailoverEnabled()
Description copied from interface: SessionCookie
Indicates that session application module state should be persisted to secondary storage immediately upon a managed release.

Session cookie developers should be careful that this value not change after a session cookie has become active.

Specified by:
isFailoverEnabled in interface SessionCookie
Overrides:
isFailoverEnabled in class SessionCookieImpl

beforeApplicationModuleRelease

protected void beforeApplicationModuleRelease(ApplicationModule am)
Overrides:
beforeApplicationModuleRelease in class SessionCookieImpl

afterApplicationModuleRelease

protected void afterApplicationModuleRelease()
Overrides:
afterApplicationModuleRelease in class SessionCookieImpl

useApplicationModule

public ApplicationModule useApplicationModule(boolean lock,
                                              long waitTimeout)
Description copied from interface: ApplicationModuleRef
Returns an application module instance for the current thread.

If the application session cookie references application state the application state should be activated in the returned application module.

The lock parameter may be specified to acquire a lock for the shared application module resource. If a lock is acquired the application should be careful to release that lock after it is done using the application module resource. Application thread starvation may occur if the lock is held indefinitely.

If another thread is holding the lock associated with the session cookie then the current thread will wait for the period specified by the waitTimeout parameter.

Best practice would be to invoke ApplicationModuleRef.useApplicationModule(boolean) in a try...finally block that invokes during finally.

Specified by:
useApplicationModule in interface ApplicationModuleRef
Overrides:
useApplicationModule in class SessionCookieImpl
Parameters:
lock - specify whether a session lock should be acquired for the shared application module resource
waitTimeout - specifies the amount of time in milliseconds that the thread should wait for the session cookie lock

Oracle9i Business Components for Java API Reference
Oracle9i Jdeveloper (9.0.4)
B10391-01


 

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