Keel 2.1RC2

org.keel.clients.struts
Class StrutsClientConnector

java.lang.Object
  extended byorg.keel.clients.AbstractClientConnector
      extended byorg.keel.clients.webapp.AbstractWebappClientConnector
          extended byorg.keel.clients.struts.StrutsClientConnector
All Implemented Interfaces:
ClientConnector, WebappClientConnector

public class StrutsClientConnector
extends AbstractWebappClientConnector

The glue to connect Struts to Keel

Version:
$Revision: 1.25 $ $Date: 2004/05/12 12:13:06 $
Author:
Michael Nash, Schatterjee Created on May 24, 2003

Field Summary
private static int BUFFER_SIZE
          Write Buffer for writing files.
private  ActionForm form
           
protected  HttpServletRequest hreq
           
protected  HttpServletResponse hres
           
private  ActionServlet servlet
           
 
Fields inherited from class org.keel.clients.webapp.AbstractWebappClientConnector
COMMAND_PARAM, COMMAND_PARAM_LEN, initParamsParsed, KEEL_MODEL_PARAM, MODEL_PARAM, PARAMETER_PARAM
 
Fields inherited from class org.keel.clients.AbstractClientConnector
clientContext, log, myClients
 
Constructor Summary
protected StrutsClientConnector()
           
  StrutsClientConnector(HttpServletRequest hreq, HttpServletResponse hres, ActionForm form, ActionServlet servlet)
           
 
Method Summary
 boolean allowed(java.lang.String resource, java.lang.String operation)
           
protected  void createDynaBean(KeelResponse kres, WebappRequest wreq, WebappResponse wres, java.lang.String modelName)
          
 KeelResponse execute()
          Run the business model, using a request/response pair The description sounds curious since the method doesn't take a request as an argument! This is because although most webapps use the HttpServletRequest/HttpServletResponse pair, some, particularly Cocoon, do not and use their own abstraction.
 java.lang.String getForward(KeelResponse kres)
          Determine a string that tells the client where to navigate next
protected  MessageResources getMessageResources(KeelResponse kres, WebappRequest wreq, WebappResponse wres, java.lang.String modelName)
           
private  ActionServlet getServlet()
           
protected  void handleErrors(KeelResponse kres, WebappRequest wreq, WebappResponse wres, java.lang.String modelName)
           
protected  void internationalize(ResponseElement re, MessageResources messages)
           
private  java.lang.Object[] makeArgArray(java.lang.String msg)
           
protected  java.lang.String preProcessParamName(java.lang.String oneParamName)
           
protected  void setRequestParameters(WebappRequest wreq, KeelRequest kreq)
           
protected  java.lang.Object[] tokenize(java.lang.String orig, MessageResources messages)
           
private  Message translateMessage(Message message, MessageResources messages)
          Utility method to translate a message.
protected  java.lang.String translateString(java.lang.String orig, MessageResources messages)
           
 
Methods inherited from class org.keel.clients.webapp.AbstractWebappClientConnector
createRequest, execute, getWebappPath, makeKeelRequest, makeWebappResponse, parseInitParameters, processCommandParam, processNonCommandParam, setRequestAttributes, setRequestCookies, setRequestModel, setResponseCookies
 
Methods inherited from class org.keel.clients.AbstractClientConnector
createClients, execute, getClient, removeClient, setContext, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.keel.clients.ClientConnector
execute, setContext, setLogger
 

Field Detail

hreq

protected HttpServletRequest hreq

hres

protected HttpServletResponse hres

servlet

private ActionServlet servlet

form

private ActionForm form

BUFFER_SIZE

private static final int BUFFER_SIZE
Write Buffer for writing files.

See Also:
Constant Field Values
Constructor Detail

StrutsClientConnector

protected StrutsClientConnector()

StrutsClientConnector

public StrutsClientConnector(HttpServletRequest hreq,
                             HttpServletResponse hres,
                             ActionForm form,
                             ActionServlet servlet)
Method Detail

execute

public KeelResponse execute()
                     throws ClientException,
                            ModelException
Description copied from interface: WebappClientConnector
Run the business model, using a request/response pair The description sounds curious since the method doesn't take a request as an argument! This is because although most webapps use the HttpServletRequest/HttpServletResponse pair, some, particularly Cocoon, do not and use their own abstraction. So, the method preferred here, is that the WebappClientConnector implementation will pass in the the appropriate request/response and other paramters in the constructor and use those during the execution of this method. See org.keel.clients.struts.StrutsClientConnector and org.keel.clients.cocoon.CocoocClientConnector for examples.

Returns:
The Keel response
Throws:
ModelException
ClientException
See Also:
org.keel.clients.webapp.WebappClientConnector#execute(org.keel.clients.webapp.WebappRequest, org.keel.clients.webapp.WebappResponse, java.lang.String)

getForward

public java.lang.String getForward(KeelResponse kres)
Description copied from interface: WebappClientConnector
Determine a string that tells the client where to navigate next

Parameters:
kres - The Keel response returned by execute()
Returns:
See Also:
org.keel.clients.webapp.WebappClientConnector#getForward()

createDynaBean

protected void createDynaBean(KeelResponse kres,
                              WebappRequest wreq,
                              WebappResponse wres,
                              java.lang.String modelName)
                       throws ClientException

Parameters:
kres -
wres -
Throws:
ClientException

preProcessParamName

protected java.lang.String preProcessParamName(java.lang.String oneParamName)
Overrides:
preProcessParamName in class AbstractWebappClientConnector
See Also:
AbstractWebappClientConnector.preProcessParamName(java.lang.String)

setRequestParameters

protected void setRequestParameters(WebappRequest wreq,
                                    KeelRequest kreq)
                             throws ClientException
Overrides:
setRequestParameters in class AbstractWebappClientConnector
Throws:
ClientException
See Also:
org.keel.clients.webapp.AbstractWebappClientConnector#setKeelRequestParameters(javax.servlet.http.HttpServletRequest, org.keel.services.model.KeelRequest)

handleErrors

protected void handleErrors(KeelResponse kres,
                            WebappRequest wreq,
                            WebappResponse wres,
                            java.lang.String modelName)

makeArgArray

private java.lang.Object[] makeArgArray(java.lang.String msg)
Returns:

getServlet

private ActionServlet getServlet()

getMessageResources

protected MessageResources getMessageResources(KeelResponse kres,
                                               WebappRequest wreq,
                                               WebappResponse wres,
                                               java.lang.String modelName)

translateString

protected java.lang.String translateString(java.lang.String orig,
                                           MessageResources messages)

translateMessage

private Message translateMessage(Message message,
                                 MessageResources messages)
Utility method to translate a message. The result is stored back in the Message object itself. The Message may or may not specify a message bundle key to be used for the translation. If it does not, we use the application-specific bundle we would normally use for a string instead.


internationalize

protected void internationalize(ResponseElement re,
                                MessageResources messages)

tokenize

protected java.lang.Object[] tokenize(java.lang.String orig,
                                      MessageResources messages)

allowed

public boolean allowed(java.lang.String resource,
                       java.lang.String operation)

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.