net.sf.ewc
Class EasyWebController

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bynet.sf.ewc.EasyWebController
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class EasyWebController
extends javax.servlet.http.HttpServlet

EasyWebControlleris the EWC controller servlet. Its main responsability is performing user changes on the model, and calling the user event method after those changes.

Servlet operations

This controller servlet goes through the following stages on each request:

Accepted POST/GET parameters

Every parameter whose name has been formed with EWCSession.getFullExpression(Object,String)will be handled as a model change. This method is called by taglibs to write well formed parameter names, but can be called directly on a JSP.

There are three special parameters that this servlet accepts:

After the model changes and event processing stages, the control flow is redirected to presentation. The presentation page will be selected on the following basis:

Initialization/configuration parameters

This servlet can be configured with the following initialization parameters:

Author:
mballesteros
See Also:
Serialized Form

Field Summary
static java.lang.String EWC_DEFAULT_CONTEXT_PARAMETER
          Default context parameter
static java.lang.String EWC_EVENT_PARAMETER
          The parameter that contains the method to execute after model changes
static java.lang.String EWC_MODEL_CHANGES_PARAMETER
          Compact model changes parameter.
static java.lang.String EWC_PROCESS_GET_PARAMETER
          True to process GET
static java.lang.String EWC_REQUEST_URI_ATTRIBUTE
          Request attribute where the original request URI is stored
static java.lang.String FILEUPLOAD_CONTEXT_ATTRIBUTE
          File upload context attribute.
static java.lang.String LOG_FILE
          Log file initialization parameter name
static java.lang.String LOG_LEVEL
          Log level initialization parameter name
static java.lang.String UPLOAD_MAX_SIZE
          Upload maximum size initialization parameter name
static java.lang.String UPLOAD_THRESHOLD
          Upload threshold initialization parameter name
 
Constructor Summary
EasyWebController()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          GET requests are redirected to the root application context, except when EWC_PROCESS_GET_PARAMETERequals 'true' (this allows you to pass parameters through URL).
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Processes user requests...
 void init()
          Servlet initialization.
static void setConsoleLog(java.lang.String level)
          Sets a console log
static void setFileLog(java.lang.String logfile, java.lang.String level)
          Sets a file log
static void setLog(java.util.logging.Handler handler, java.lang.String level)
          Sets the package log
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EWC_PROCESS_GET_PARAMETER

public static final java.lang.String EWC_PROCESS_GET_PARAMETER
True to process GET

See Also:
Constant Field Values

EWC_DEFAULT_CONTEXT_PARAMETER

public static final java.lang.String EWC_DEFAULT_CONTEXT_PARAMETER
Default context parameter

See Also:
Constant Field Values

EWC_MODEL_CHANGES_PARAMETER

public static final java.lang.String EWC_MODEL_CHANGES_PARAMETER
Compact model changes parameter. This parameter can contain a CSV secuence of changes to be done on the model.

See Also:
Constant Field Values

EWC_EVENT_PARAMETER

public static final java.lang.String EWC_EVENT_PARAMETER
The parameter that contains the method to execute after model changes

See Also:
Constant Field Values

EWC_REQUEST_URI_ATTRIBUTE

public static final java.lang.String EWC_REQUEST_URI_ATTRIBUTE
Request attribute where the original request URI is stored

See Also:
Constant Field Values

LOG_FILE

public static final java.lang.String LOG_FILE
Log file initialization parameter name

See Also:
Constant Field Values

LOG_LEVEL

public static final java.lang.String LOG_LEVEL
Log level initialization parameter name

See Also:
Constant Field Values

UPLOAD_THRESHOLD

public static final java.lang.String UPLOAD_THRESHOLD
Upload threshold initialization parameter name

See Also:
Constant Field Values

UPLOAD_MAX_SIZE

public static final java.lang.String UPLOAD_MAX_SIZE
Upload maximum size initialization parameter name

See Also:
Constant Field Values

FILEUPLOAD_CONTEXT_ATTRIBUTE

public static final java.lang.String FILEUPLOAD_CONTEXT_ATTRIBUTE
File upload context attribute. This will be the name of the attribute (in the servlet context) where the FileUpload component will be placed in.

Constructor Detail

EasyWebController

public EasyWebController()
Method Detail

init

public void init()
Servlet initialization. Prepares a temporal dir for file upload


setFileLog

public static void setFileLog(java.lang.String logfile,
                              java.lang.String level)
                       throws java.lang.SecurityException,
                              java.io.IOException
Sets a file log

Parameters:
logfile -
level -
Throws:
java.lang.SecurityException
java.io.IOException

setConsoleLog

public static void setConsoleLog(java.lang.String level)
Sets a console log

Parameters:
level -

setLog

public static void setLog(java.util.logging.Handler handler,
                          java.lang.String level)
Sets the package log

Parameters:
handler -
level -

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
GET requests are redirected to the root application context, except when EWC_PROCESS_GET_PARAMETERequals 'true' (this allows you to pass parameters through URL). Images, css, and other files requested by the client browser using GET method are processed by the default servlet container as direct requests to the root application context.

Parameters:
request - The servlet request
response - The servlet response
Throws:
javax.servlet.ServletException - Thrown if the requested file cannot be found
java.io.IOException - Thrown if there's an I/O problem

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Processes user requests...

Parameters:
request -
response -
Throws:
javax.servlet.ServletException
java.io.IOException


Copyright © 2003-2004 SourceForge. All Rights Reserved.