EAF 7.6 Implementation

org.enhydra.util.chiba
Class ServletAdapter

java.lang.Object
  extended by AbstractChibaAdapter
      extended by org.enhydra.util.chiba.BaseAdapter
          extended by org.enhydra.util.chiba.ServletAdapter
All Implemented Interfaces:
org.w3c.dom.events.EventListener

public class ServletAdapter
extends BaseAdapter
implements org.w3c.dom.events.EventListener

integrates XForms Processor into Web-applications and handles request processing. This is the default implementation of ChibaAdapter and besides handling the interaction it also manages a UIGenerator to build the rendered output for the browser.

Version:
$Id: ServletAdapter.java,v 1.6 2007/05/04 12:02:23 sasa Exp $
Author:
Joern Turner, Slobodan Vujasinovic

Field Summary
static java.lang.String HTTP_SERVLET_REQUEST
           
static java.lang.String HTTP_UPLOAD_DIR
           
static java.lang.String USERAGENT
           
static java.lang.Object XSLT_PATH
           
 
Fields inherited from class org.enhydra.util.chiba.BaseAdapter
clean
 
Constructor Summary
ServletAdapter()
          Creates a new ServletAdapter object.
 
Method Summary
 void dispatch(ChibaEvent event)
          ServletAdapter knows and executes only one ChibaEvent: 'http-request' which will contain the HttpServletRequest as contextInfo.
 void forward(java.util.Map response)
          Instructs the application environment to forward the given response.
protected  HttpRequestHandler getNewInteractionHandler()
          return a new InteractionHandler.
 void handleEvent(org.w3c.dom.events.Event event)
          This method is called whenever an event occurs of the type for which the EventListener interface was registered.
 void handleLoadURI(java.lang.String targetId, java.lang.String uri, java.lang.String show)
           
 void handleMessage(java.lang.String targetId, java.lang.String message, java.lang.String level)
           
 void handleReplaceAll(java.lang.String targetId, java.util.Map header, java.lang.Object body)
           
 void init()
          place to put application-specific params or configurations before actually starting off the XFormsProcessor.
 void setBaseURI(java.lang.String aURI)
           
 void setContext(java.util.Map contextParams)
          passes Map containing arbitrary context parameters to the Adapter.
 void setUploadDestination(java.lang.String uploadDir)
           
 void shutdown()
          terminates the XForms processing.
 
Methods inherited from class org.enhydra.util.chiba.BaseAdapter
isClean, setClean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_SERVLET_REQUEST

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

HTTP_UPLOAD_DIR

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

USERAGENT

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

XSLT_PATH

public static final java.lang.Object XSLT_PATH
Constructor Detail

ServletAdapter

public ServletAdapter()
Creates a new ServletAdapter object.

Method Detail

init

public void init()
          throws XFormsException
place to put application-specific params or configurations before actually starting off the XFormsProcessor. It's the responsibility of this method to call chibaBean.init() to finish up the processor setup.

Throws:
XFormsException - If an error occurs

dispatch

public void dispatch(ChibaEvent event)
              throws XFormsException
ServletAdapter knows and executes only one ChibaEvent: 'http-request' which will contain the HttpServletRequest as contextInfo.

Parameters:
event - only events of type 'http-request' will be handled
Throws:
XFormsException

shutdown

public void shutdown()
              throws XFormsException
terminates the XForms processing. right place to do cleanup of resources.

Throws:
org.chiba.xml.xforms.exception.XFormsException
XFormsException

forward

public void forward(java.util.Map response)
Instructs the application environment to forward the given response.

Parameters:
response - a map containing at least a response stream and optional header information.

getNewInteractionHandler

protected HttpRequestHandler getNewInteractionHandler()
                                               throws XFormsException
return a new InteractionHandler.

This method returns a new HttpRequestHandler.

Returns:
returns a new
Throws:
XFormsException

setUploadDestination

public void setUploadDestination(java.lang.String uploadDir)

handleEvent

public void handleEvent(org.w3c.dom.events.Event event)
This method is called whenever an event occurs of the type for which the EventListener interface was registered.

Specified by:
handleEvent in interface org.w3c.dom.events.EventListener
Parameters:
event - The Event contains contextual information about the event. It also contains the stopPropagation and preventDefault methods which are used in determining the event's flow and default action.

handleLoadURI

public void handleLoadURI(java.lang.String targetId,
                          java.lang.String uri,
                          java.lang.String show)

handleMessage

public void handleMessage(java.lang.String targetId,
                          java.lang.String message,
                          java.lang.String level)

handleReplaceAll

public void handleReplaceAll(java.lang.String targetId,
                             java.util.Map header,
                             java.lang.Object body)

setBaseURI

public void setBaseURI(java.lang.String aURI)

setContext

public void setContext(java.util.Map contextParams)
passes Map containing arbitrary context parameters to the Adapter.

Parameters:
contextParams - Map of arbitrary params passed to the processor

EAF 7.6 Implementation