com.ibm.websphere.samples.i18nctx.currencyexchangewar
Class CurrencyServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.ibm.websphere.samples.i18nctx.currencyexchangewar.CurrencyServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class CurrencyServlet
extends javax.servlet.http.HttpServlet

See Also:
Serialized Form

Field Summary
protected  AccInfoJBean accInfo
           
protected  java.lang.String account
           
protected  CustomerJBean customerInfo
           
protected static Exchange exc
           
static java.lang.String EXCHANGE_EJBHOME
           
protected  ExchangeHome exchangeHome
           
protected  java.util.Locale iLocale
           
protected  com.ibm.websphere.i18n.context.InvocationInternationalization invI18n
           
protected  java.lang.String name
           
protected  java.lang.String password
           
protected  com.ibm.websphere.i18n.context.UserInternationalization userI18n
           
static java.lang.String USERI18N_URL
           
 
Constructor Summary
CurrencyServlet()
           
 
Method Summary
protected  void deposit(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method lets customers exchange US dollars by using other currencies.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process incoming HTTP GET requests.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process incoming HTTP POST requests.
 double getRate(java.lang.String localeStr)
           
 java.lang.String getServletInfo()
          Return the servlet info string.
 void init()
          Initialize this servlet.
protected  void moreExchange(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void verifyPrincipal(javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request)
          Verify the customer's login and password.
protected  void withdraw(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method lets customers exchange other currencies by using US dollars.
 
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, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userI18n

protected com.ibm.websphere.i18n.context.UserInternationalization userI18n

invI18n

protected com.ibm.websphere.i18n.context.InvocationInternationalization invI18n

USERI18N_URL

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

EXCHANGE_EJBHOME

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

exc

protected static Exchange exc

iLocale

protected java.util.Locale iLocale

exchangeHome

protected ExchangeHome exchangeHome

accInfo

protected AccInfoJBean accInfo

customerInfo

protected CustomerJBean customerInfo

account

protected java.lang.String account

name

protected java.lang.String name

password

protected java.lang.String password
Constructor Detail

CurrencyServlet

public CurrencyServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initialize this servlet.

Resolve all references enabling remote operation, including the JNDI initial context, any EJBs, and the Internationalization service API

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Process incoming HTTP GET requests.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - Object that encapsulates the request to the servlet
response - Object that encapsulates the response from the servlet
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Process incoming HTTP POST requests.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - Object that encapsulates the request to the servlet.
response - Object that encapsulates the response from the servlet.
Throws:
javax.servlet.ServletException
java.io.IOException

verifyPrincipal

public void verifyPrincipal(javax.servlet.http.HttpServletResponse response,
                            javax.servlet.http.HttpServletRequest request)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Verify the customer's login and password.

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

withdraw

protected void withdraw(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                 throws javax.servlet.ServletException,
                        java.io.IOException
This method lets customers exchange other currencies by using US dollars.

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

deposit

protected void deposit(javax.servlet.http.HttpServletRequest request,
                       javax.servlet.http.HttpServletResponse response)
                throws javax.servlet.ServletException,
                       java.io.IOException
This method lets customers exchange US dollars by using other currencies.

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

moreExchange

protected void moreExchange(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

getRate

public double getRate(java.lang.String localeStr)

getServletInfo

public java.lang.String getServletInfo()
Return the servlet info string.

Specified by:
getServletInfo in interface javax.servlet.Servlet
Overrides:
getServletInfo in class javax.servlet.GenericServlet