public abstract class FlashServlet extends BaseServlet
BaseServlet
that provides default
functionality for Flash-specific servlet processing and defines method
signatures for specific servlet requirements.Modifier and Type | Class and Description |
---|---|
class |
FlashServlet.Context
Inner class used to store servlet context information.
|
class |
FlashServlet.Stack
Inner class used to store servlet request information.
|
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
The class' serialization version id.
|
protected static java.lang.String |
SN_CART
The session's key for the shopping cart.
|
protected static java.lang.String |
SN_LOGON_STATUS
The session's key for the logon status.
|
protected static java.lang.String |
SN_SECPROFILE
The session's key for the current security profile.
|
protected static java.lang.String |
SN_USER
The session's key for the current user.
|
protected static java.lang.String |
SN_USERSFI
The session's key for the current SFI/CSR selected user.
|
BROWSER_IE, BROWSER_NN, BROWSER_XX, RESP_NULL, RESP_REDIRECTED, RQST_AJAX, RQST_NULL
Constructor and Description |
---|
FlashServlet() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
confirmCart(FlashServlet.Context ctx)
Determines if a shopping cart is associated with the current user session.
|
protected int |
confirmRequest(FlashServlet.Context ctx)
Determines if a servlet is being accessed with a valid request id.
|
protected int |
confirmRetail(FlashServlet.Context ctx)
Determines if the servlet is being accessed within the context of a valid
retail user session.
|
protected int |
confirmSession(BaseServlet.Context baseCtx)
Determines if the servlet is being accessed within the context of a valid
user session.
|
protected int |
confirmWholesale(FlashServlet.Context ctx)
Determines if the servlet is being accessed within the context of a valid
wholesale user session.
|
protected BaseServlet.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates the servlet context inner class.
|
protected void |
createNewCart(FlashServlet.Context ctx)
Creates a new shopping cart and attaches it to the current session.
|
protected void |
createNewSessionImpl(BaseServlet.Context baseCtx)
Provides additional application-specific functionality for creating a new
session.
|
protected java.lang.String |
getPageTitle(BaseServlet.Context baseCtx)
Returns the title of the servlet page to be displayed to the user.
|
protected java.lang.String |
getServletPath(BaseServlet.Context ctx,
boolean inclSlash)
Returns the current servlet's path.
|
protected User |
getUser(FlashServlet.Context ctx,
java.lang.String userid)
Returns a
User object for the given user id. |
protected void |
initTemplateDataImpl(BaseServlet.Context baseCtx,
org.apache.velocity.VelocityContext vc,
boolean cookies)
Provides additional application-specific functionality for initializing
a new set of Velocity template data.
|
protected boolean |
isLogonRequest(FlashServlet.Context ctx)
Answers if the current request is for a logon servlet.
|
protected void |
requestComplete(BaseServlet.Context baseCtx,
boolean post)
Handles completion processing for a request, such as any housekeeping
tasks that might need to be performed after all other processing for a
request has been completed.
|
protected boolean |
requiresLogon(BaseServlet.Context baseCtx)
Answers if the servlet requires a valid non-default user to log on in
order to continue processing.
|
protected void |
resetCart(FlashServlet.Context ctx)
Resets various shopping cart values and forces a refresh of the cart's
cart lines.
|
protected void |
resetCategories(FlashServlet.Context ctx,
boolean newlist,
boolean listonly)
Resets the session values that control the display of the product
categories list.
|
protected void |
resetProducts(FlashServlet.Context ctx)
Resets the session values that control the display of products.
|
protected boolean |
setDefaultUser(FlashServlet.Context ctx)
Sets the current session to point to the default user or to the user saved
as a cookie from a previous session's logon.
|
protected void |
setSessionCart(FlashServlet.Context ctx,
Cart cart,
boolean newCart)
Sets the session's shopping cart to the given cart.
|
protected void |
setSFIShoppingUser(FlashServlet.Context ctx,
User user)
Sets the SFI/CSR shopping user (the sales rep's selected account).
|
protected void |
useExistingSessionImpl(BaseServlet.Context baseCtx)
Provides additional application-specific functionality for using an
existing session.
|
protected void |
writeCookie(BaseServlet.Context baseCtx,
java.lang.String name,
java.lang.String value)
Adds a given cookie name and value to the response header and sets the
cookie to expire based on the value for "Site.Cookie.Expires" or the
value for "Store.Cart.Expires" or to a quasi-permanent default of one year.
|
protected void |
writePageImpl(BaseServlet.Context baseCtx)
Provides additional application-specific functionality for writing a page.
|
createNewSession, determineBrowser, doGet, doPost, editFormFields, getCookie, getInvokerName, getInvokerName, getInvokerParams, getInvokerParams, getInvokerPath, getInvokerPath, getInvokerURL, getNextURL, getPageParams, getRequestURL, getServletName, getServletName, getServletParams, getServletParams, getServletPath, getServletURL, getServletURL, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateName, initTemplateData, isPrintable, isServerTomcat, log, qualifyURL, readParameters, redirectURL, resetFormFields, setCookieValues, setP3PCompactPolicy, setSessionValues, setTemplateData, showSiteError, showSiteError, showSiteError, useExistingSession, writeCookie, writeTempCookie
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
private static final long serialVersionUID
protected static final java.lang.String SN_CART
protected static final java.lang.String SN_LOGON_STATUS
protected static final java.lang.String SN_SECPROFILE
protected static final java.lang.String SN_USER
protected static final java.lang.String SN_USERSFI
protected int confirmSession(BaseServlet.Context baseCtx) throws java.io.IOException
doGet
and doPost
methods.
Overrides confirmSession
in BaseServlet
.confirmSession
in class BaseServlet
baseCtx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while confirming the
user session.protected void createNewSessionImpl(BaseServlet.Context baseCtx)
createNewSession
method.
Overrides createNewSessionImpl
in BaseServlet
.createNewSessionImpl
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void useExistingSessionImpl(BaseServlet.Context baseCtx)
useExistingSession
method.
Overrides useExistingSessionImpl
in BaseServlet
.useExistingSessionImpl
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected java.lang.String getPageTitle(BaseServlet.Context baseCtx)
writePage
method. This implementation retrieves
the title from the servlet's html template.
Overrides getPageTitle
in BaseServlet
.getPageTitle
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected java.lang.String getServletPath(BaseServlet.Context ctx, boolean inclSlash)
getServletPath
in BaseServlet
.getServletPath
in class BaseServlet
ctx
- (Context) The current servlet context.inclSlash
- (boolean) true
to include the leading slash,
otherwise false
.protected void initTemplateDataImpl(BaseServlet.Context baseCtx, org.apache.velocity.VelocityContext vc, boolean cookies)
initTemplateData
method.
Overrides initTemplateDataImpl
in BaseServlet
.initTemplateDataImpl
in class BaseServlet
baseCtx
- (Context) The current servlet context.vc
- (VelocityContext) The current set of Velocity template data.cookies
- (boolean) true
if any relevant cookies are to
be written, otherwise false
.protected void requestComplete(BaseServlet.Context baseCtx, boolean post)
doGet
and doPost
as the very last action to be performed for each and every request, even
if exceptions are thrown during the request's processing.
Overrides requestComplete
in BaseServlet
.requestComplete
in class BaseServlet
baseCtx
- (Context) The current servlet context.post
- (boolean) true
if the activity occurred during
a POST operation, otherwise false
.protected boolean requiresLogon(BaseServlet.Context baseCtx)
false
for public
shopping functions and true
for admin, SAT and SFI/CSR functions.
This method should be overridden by a subclass if the subclass requires
something different than the default.
Overrides requiresLogon
in BaseServlet
.requiresLogon
in class BaseServlet
baseCtx
- (Context) The current servlet context.true
if the servlet requires a non-default
user to log on, otherwise false
.protected void writeCookie(BaseServlet.Context baseCtx, java.lang.String name, java.lang.String value) throws java.io.IOException
setCookieValues
method.
Overrides writeCookie
in BaseServlet
.writeCookie
in class BaseServlet
baseCtx
- (Context) The current servlet context.name
- (String) The name by which the cookies will be referred.value
- (String) The value associated with the cookie.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.protected void writePageImpl(BaseServlet.Context baseCtx)
writePage
method.
Overrides writePageImpl
in BaseServlet
.writePageImpl
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected boolean confirmCart(FlashServlet.Context ctx) throws java.io.IOException
confirmSession
method.ctx
- (Context) The current servlet context.true
if a valid cart is created or found,
false
if error occurred.java.io.IOException
- - if an error occurs while confirming the
shopping cart.protected int confirmRequest(FlashServlet.Context ctx) throws java.io.IOException
ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while confirming the
request id.protected int confirmRetail(FlashServlet.Context ctx) throws java.io.IOException
ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while confirming the
user session.protected int confirmWholesale(FlashServlet.Context ctx) throws java.io.IOException
ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while confirming the
user session.protected void createNewCart(FlashServlet.Context ctx) throws java.io.IOException
ctx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs while creating the
new shopping cart.protected User getUser(FlashServlet.Context ctx, java.lang.String userid)
User
object for the given user id. The given user id
will typically be the default user User.DEFAULT_USER
or the user
id obtained from the SN_USER
cookie.ctx
- (Context) The current servlet context.userid
- (String) The id for the user to be retrieved.User
object for the specified user id, or
null
if the user does not exist or cannot be found.protected boolean isLogonRequest(FlashServlet.Context ctx)
ctx
- (Context) The current servlet context.true
if the current request is for logon,
otherwise false
.protected void resetCart(FlashServlet.Context ctx)
ctx
- (Context) The current servlet context.protected void resetCategories(FlashServlet.Context ctx, boolean newlist, boolean listonly)
ctx
- (Context) The current servlet context.newlist
- (boolean) true
if the list of categories
should be reset, otherwise false
.listonly
- (boolean) true
if only the list of
categories is to be rebuilt. This controls whether a product
catalog or category-specific description page should be shown,
as would be the normal case. Sometimes we only want to reshow
the list of categories, such as when the user has just logged
on and they are about to be redirected to checkout, favorite
items, order history, etc. We do not want to overwrite the
redirection with a product catalog or category description.protected void resetProducts(FlashServlet.Context ctx)
ctx
- (Context) The current servlet context.protected boolean setDefaultUser(FlashServlet.Context ctx)
confirmSessionRetail
method.ctx
- (Context) The current servlet context.true
if the default user was successfully set,
otherwise false
.protected void setSessionCart(FlashServlet.Context ctx, Cart cart, boolean newCart) throws java.io.IOException
ctx
- (Context) The current servlet context.cart
- (Cart) The cart to attach to the session.newCart
- (boolean) true
if the cart is a new cart,
otherwise false
.java.io.IOException
- - if an error occurs while setting the
session's shopping cart.protected void setSFIShoppingUser(FlashServlet.Context ctx, User user)
ctx
- (Context) The current servlet context.user
- (User) The selected account or null
to reset
or void the shopping user.protected BaseServlet.Context createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
createContext
in BaseServlet
.
Invoked by doPost
and doGet
methods.createContext
in class BaseServlet
request
- (HttpServletRequest) The servlet's incoming request.response
- (HttpServletResponse) The servlet's outgoing response.