## de.ix.jspTutorial.controller
Class RequestProcessor

    java.lang.Object
      |
      +--de.ix.jspTutorial.controller.RequestProcessor

public class RequestProcessor
extends java.lang.Object
implements RequestParameterConstants, MailConstants

This class processes all requests recived from the applications main entry point and generates all depending and necessary events

Version:
  $Id:$
Author:
  Peter Rossbach (pr@webapp.de), Lars Röwekamp ( lars.roewekamp@openKnowledge.de)

Field Summary
`private javax.servlet.http.HttpSession` `httpSession` current session of user
`private javax.servlet.ServletContext` `myApplication` the application
`private ModelManager` `pizzaModelManager` main manager for all models
`static java.lang.String` `vcid` version of the source

Fields inherited from interface de.ix.jspTutorial.constants.RequestParameterConstants
`CUS_ADDRESS1, CUS_ADDRESS2, CUS_EMAIL, CUS_FIRSTNAME, CUS_ID, CUS_LASTNAME, CUS_TOWN, CUS_ZIP, DO_ACTION, DO_CHOICE, DO_CHOICE_PARAMS, DO_LOGIN, DO_LOGIN_PARAMS, DO_LOGOUT, DO_ORDER, DO_ORDER_PARAMS, ERROR, INGREDIENT_IDS, MIP_ERROR, PIZZA_ID, REQUESTED_URL, SHOW_CHOICE, SHOW_LOGIN`

Fields inherited from interface de.ix.jspTutorial.constants.MailConstants
`C_CONFIG_MAIL_DEBUG, C_CONFIG_MAIL_RECIPIENT, C_CONFIG_MAIL_SMTP_HOST, C_CONFIG_USE_EMAIL, MAIL_DEBUG, MAIL_RECIPIENT, MAIL_SMTP_HOST, USE_EMAIL`

Constructor Summary
`RequestProcessor()`

Method Summary
`void` `checkParameters(java.lang.String action, javax.servlet.http.HttpServletRequest request)` Method to check all given parameters depending on the current request type.
`boolean` `getMailDebug()` Is Mail debug.
`java.lang.String` `getMailRecipient()` get Mail Recipient You can it config at web.xml as ServletContext Init parameter "MAIL_RECIPIENT"
`java.lang.String` `getMailSmtpHost()` get Mail Smtp Host You can it config at web.xml as ServletContext Init parameter "MAIL_SMTP_HOST"
`boolean` `getUseEMail()` Is Use Email order.
`void` `handleChoiseEvent(javax.servlet.http.HttpServletRequest request)` Handler-method for choice request.
`void` `handleEvent(java.lang.String action, javax.servlet.http.HttpServletRequest request)` Method to delegate the differnt request types to specialized handler-method.
`void` `handleLoginEvent(javax.servlet.http.HttpServletRequest request)` Handler-method for login request.
`void` `handleLogoutEvent(javax.servlet.http.HttpServletRequest request)` Handler-method for logout request.
`void` `handleOrderEvent(javax.servlet.http.HttpServletRequest request)` Handler-method for order request.
`void` `init(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpSession httpSession)` This method initializes all private attributes of the the given `RequestProcessor` instance
`void` `log(java.lang.String msg)` Output of a message to the servlet log of the container.
`void` `log(java.lang.String message, java.lang.Throwable throwable)` Put the given message and exception the servlet log of the container.
`void` `processRequest(javax.servlet.http.HttpServletRequest request)` This method proceesses the actual http request.

Methods inherited from class java.lang.Object
`<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### vcid

    public static java.lang.String vcid

  version of the source

### httpSession

    private javax.servlet.http.HttpSession httpSession

  current session of user

### myApplication

    private javax.servlet.ServletContext myApplication

  the application

### pizzaModelManager

    private ModelManager pizzaModelManager

  main manager for all models

Constructor Detail

### RequestProcessor

    public RequestProcessor()

Method Detail

### init

    public void init(javax.servlet.ServletContext servletContext,
                     javax.servlet.http.HttpSession httpSession)

  This method initializes all private attributes of the the given `RequestProcessor` instance
  Parameters:
    `servletContext` - actual Servlet Context
    `httpSession` - actual HTTP Session

### processRequest

    public void processRequest(javax.servlet.http.HttpServletRequest request)
                        throws de.ix.jspTutorial.exception.MissingInputParamsException

  This method proceesses the actual http request. Doing this, it checks the given parameters of the current request and delegates this request to a request specific handler-method.
  Parameters:
    `request` - actual HttpServletRequest

### handleLogoutEvent

    public void handleLogoutEvent(javax.servlet.http.HttpServletRequest request)

  Handler-method for logout request.
  Parameters:
    `request` - Current httpRequest

### handleLoginEvent

    public void handleLoginEvent(javax.servlet.http.HttpServletRequest request)

  Handler-method for login request. Checks if the given customer exists and creates a new one if necessary.
  Parameters:
    `request` - Current httpRequest

### handleChoiseEvent

    public void handleChoiseEvent(javax.servlet.http.HttpServletRequest request)

  Handler-method for choice request. Creates a `PersonalPizza` with the help of the current request.
  Parameters:
    `request` - Current httpRequest

### handleOrderEvent

    public void handleOrderEvent(javax.servlet.http.HttpServletRequest request)

  Handler-method for order request. Saves the current order and changes also the current customer if necessary. Additional create XML order and send this to via eMail to pizza online service.
  Parameters:
    `request` - Current httpRequest

### handleEvent

    public void handleEvent(java.lang.String action,
                            javax.servlet.http.HttpServletRequest request)

  Method to delegate the differnt request types to specialized handler-method.
  Parameters:
    `action` - Current request type
    `request` - Current httpRequest

### checkParameters

    public void checkParameters(java.lang.String action,
                                javax.servlet.http.HttpServletRequest request)
                         throws de.ix.jspTutorial.exception.MissingInputParamsException

  Method to check all given parameters depending on the current request type.
  Parameters:
    `action` - Current request type
    `request` - Current httpRequest

### log

    public void log(java.lang.String msg)

  Output of a message to the servlet log of the container.
  Parameters:
    `msg` - The message

### log

    public void log(java.lang.String message,
                    java.lang.Throwable throwable)

  Put the given message and exception the servlet log of the container.
  Parameters:
    `message` - Error message
    `throwable` - Exception

### getUseEMail

    public boolean getUseEMail()

  Is Use Email order. You can it config at web.xml as ServletContext Init parameter "USE_EMAIL"

### getMailDebug

    public boolean getMailDebug()

  Is Mail debug. You can it config at web.xml as ServletContext Init parameter "MAIL_DEBUG"

### getMailRecipient

    public java.lang.String getMailRecipient()

  get Mail Recipient You can it config at web.xml as ServletContext Init parameter "MAIL_RECIPIENT"

### getMailSmtpHost

    public java.lang.String getMailSmtpHost()

  get Mail Smtp Host You can it config at web.xml as ServletContext Init parameter "MAIL_SMTP_HOST"

~ Das iX JSP Tutorial III - © 2000 by Peter Roßbach ~