Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


oracle.dss.thin.servlet
Class ServletRequestHandler

java.lang.Object
  |
  +--oracle.dss.thin.servlet.ServletRequestHandler

public class ServletRequestHandler
extends java.lang.Object

ServletRequestHandler is an implementation of a simple servlet controller for ThinBeans. In order to use the ServletRequestHandler, an servlet would create a ServletRequestHandler and place it on its HttpSession. ThinBeans that exist across requests ( are stored in the HttpSession ) should also be registered with the ServletRequestHandler. When a request reaches the servlet, the servlet should make sure that all of the ThinBeans that are needed for the request have been created and registered with the ServletRequestHandler and then call the handleRequest() method on its ServletRequestHandler, which will perform the following tasks on the ThinBeans registered with the ServletRequestHandler:



If an application needs to set state and process events at different times an application can call setState() and handleEvent(), which is equivalent to calling handleRequest(). If an application wants to customize state or event handling, they can either implement their own controller or they can subclass the ServletRequestHandler and implement their own setState(), handleEvent(), and getState() methods.

If the servlet wants to place the state of the registered ThinBeans onto subsequent events then it needs to call getStateStrings() add the list of state strings as hidden form fields on the HTML form that contains the ThinBean.


Constructor Summary
ServletRequestHandler()
          Default Constructor

 

Method Summary
 java.util.Locale getLocale()
          Retrieves the Locale that the ThinBeanUIs uses.
 java.util.Dictionary getState(oracle.cabo.share.url.URLEncoder encoder)
          Retrieves a dictionary of state strings, which can be placed onto URLs for subsequent events by adding hidden forms to the form(s) that contain ThinBeans.
 ThinBean getThinBean(java.lang.String thinBeanName)
          Returns a registered ThinBean by name
 java.util.Enumeration getThinBeanNames()
          Retrieves an Enumeration of the names, as Strings, of ThinBeans registered with this instance of the ServletRequestHandler.
 int handleEvent(QueryParameterProvider provider)
          Routes the current event to the correct ThinBean.
 int handleRequest(QueryParameterProvider provider)
          Handles the request by setting state on registered ThinBeans and then routing the current event to the correct ThinBean.
 int handleRequest(QueryParameterProvider provider, oracle.cabo.servlet.state.State[] states)
          Handles the request by setting state on registered ThinBeans and then routing the current event to the correct ThinBean.
 void registerThinBean(ThinBean bean)
          Registers a ThinBean with the RequestHandler.
 void registerThinBean(ThinBeanUI bean)
          Registers a ThinBeanUI with the RequestHandler.
 void setLocale(java.util.Locale locale)
          Specifies the Locale for all of the ThinBeanUIs.
 void setState(QueryParameterProvider provider)
          Sets state on registered ThinBeans
 void setState(oracle.cabo.servlet.state.State state)
          Sets state on registered ThinBeans that is stored in a oracle.cabo.servlet.state.State object instead of on the URL.
 boolean unregisterThinBean(ThinBean bean)
          Unregisters a ThinBean with the RequestHandler.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

ServletRequestHandler

public ServletRequestHandler()
Default Constructor
Method Detail

handleRequest

public int handleRequest(QueryParameterProvider provider)
                  throws ThinException
Handles the request by setting state on registered ThinBeans and then routing the current event to the correct ThinBean. This is the equivalent of calling setState(provider) and then handleEvent(). NOTE : This method should only be called if all of the ThinBean state is on the URL. If the state is split between the URL and session variables, such as a StateManager, then handleRequest(provider, states) should be called.
Parameters:
provider - the QueryParameterProvider for the current request
Returns:
the status of the request processing, which is either ThinBeanUI.EVENT_NOT_HANDLED, ThinBeanUI.EVENT_HANDLED, or ThinBeanUI.EVENT_REQUEST_DONE

handleRequest

public int handleRequest(QueryParameterProvider provider,
                         oracle.cabo.servlet.state.State[] states)
                  throws ThinException
Handles the request by setting state on registered ThinBeans and then routing the current event to the correct ThinBean. This is the equivalent of calling setState(provider), setState(state) for every State object, and then handleEvent().
Parameters:
provider - the QueryParameterProvider for the current request
states - an array of State objects that contain ThinBean state.
Returns:
the status of the request processing, which is either ThinBeanUI.EVENT_NOT_HANDLED, ThinBeanUI.EVENT_HANDLED, or ThinBeanUI.EVENT_REQUEST_DONE

setState

public void setState(QueryParameterProvider provider)
              throws ThinException
Sets state on registered ThinBeans
Parameters:
provider - the QueryParameterProvider for the current request

setState

public void setState(oracle.cabo.servlet.state.State state)
              throws ThinException
Sets state on registered ThinBeans that is stored in a oracle.cabo.servlet.state.State object instead of on the URL. ThinBean state can be placed into a state object and the state object's id should be placed onto the URL. The state is fetched from its oracle.cabo.servlet.state.StateManager by id. This method assumes that the names of the state properties coorespond to the names of registered ThinBeans.

If ThinBean state is contained by in the URL and in the State object, then this method should be called in addition to setState(QueryParameterProvider).

If an application has stored ThinBean state in multiple State object, then this method can be called multiple times.

Parameters:
state - a State instance
Throws:
ThinException -  

handleEvent

public int handleEvent(QueryParameterProvider provider)
                throws ThinException
Routes the current event to the correct ThinBean.
Parameters:
provider - the QueryParameterProvider for the current request
Returns:
the status of the request processing, which is either ThinBeanUI.EVENT_NOT_HANDLED, ThinBeanUI.EVENT_HANDLED, or ThinBeanUI.EVENT_REQUEST_DONE

getState

public java.util.Dictionary getState(oracle.cabo.share.url.URLEncoder encoder)
Retrieves a dictionary of state strings, which can be placed onto URLs for subsequent events by adding hidden forms to the form(s) that contain ThinBeans.
Parameters:
encoder - the URLEncoder to use when determining parameter names
Returns:
a dictionary of state strings

setLocale

public void setLocale(java.util.Locale locale)
Specifies the Locale for all of the ThinBeanUIs.
Parameters:
locale - The Locale for this ThinBeanUI.

getLocale

public java.util.Locale getLocale()
Retrieves the Locale that the ThinBeanUIs uses.
Returns:
The Locale for the ThinBeanUIs.

registerThinBean

public void registerThinBean(ThinBean bean)
Registers a ThinBean with the RequestHandler.
Parameters:
bean - the ThinBean being registered.

registerThinBean

public void registerThinBean(ThinBeanUI bean)
Registers a ThinBeanUI with the RequestHandler.
Parameters:
bean - the ThinBeanUI being registered.

unregisterThinBean

public boolean unregisterThinBean(ThinBean bean)
Unregisters a ThinBean with the RequestHandler.
Parameters:
bean - the ThinBean being unregistered.

getThinBean

public ThinBean getThinBean(java.lang.String thinBeanName)
Returns a registered ThinBean by name
Parameters:
thinBeanName - the name of the registered ThinBean
Returns:
the registered ThinBean, or null if it is not present

getThinBeanNames

public java.util.Enumeration getThinBeanNames()
Retrieves an Enumeration of the names, as Strings, of ThinBeans registered with this instance of the ServletRequestHandler.
Returns:
an Enumeration of ThinBean names.

Oracle™ Business Intelligence Beans Java API Reference
Release 10
g (9.0.4)
Part number B12159_01


Copyright © 2003, Oracle. All Rights Reserved.