public class ProductSearch extends MainServlet
Modifier and Type | Class and Description |
---|---|
protected class |
ProductSearch.Context
Inner class used to store servlet context information.
|
class |
ProductSearch.SelectableAttribute
Inner class used to define a selectable attribute.
|
FlashServlet.Stack
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
The class' serialization version id.
|
protected static java.lang.String |
SN_PSSEARCH_ATTR
The session's key for the product search's current search attributes.
|
protected static java.lang.String |
SN_PSSEARCH_WORD
The session's key for the product search's current search word.
|
DISPLAY_MODE, SN_ADMINMODE, SN_CATEGORIES, SN_CATEGORIES_LISTONLY, SN_CATEGORIES_PATH, SN_CATEGORY, SN_CONTINUE_PAGEURL, SN_PRODUCTS, SN_PRODUCTS_INSTOCK, SN_PRODUCTS_NOSTOCK, SN_PRODUCTS_PAFILTERS, SN_PRODUCTS_PAGEHIST, SN_PRODUCTS_PAGENUM, SN_PRODUCTS_PAGEURL, SOURCE_CATALOG, SOURCE_FAVORITES, SOURCE_SEARCH, SOURCE_SHOPCART, SOURCE_SPECIAL
SN_CART, SN_LOGON_STATUS, SN_SECPROFILE, SN_USER, SN_USERSFI
BROWSER_IE, BROWSER_NN, BROWSER_XX, RESP_NULL, RESP_REDIRECTED, RQST_AJAX, RQST_NULL
Constructor and Description |
---|
ProductSearch() |
Modifier and Type | Method and Description |
---|---|
protected MainServlet.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates the servlet context inner class.
|
protected boolean |
editFormFields(BaseServlet.Context baseCtx)
Edits the values from the html template's form fields.
|
protected java.lang.String |
getNextURL(BaseServlet.Context baseCtx)
Returns the next URL (including parameters) to be processed when this
servlet's processing has been successfully completed (no edit errors, etc.).
|
static java.util.ArrayList<ProductSearch.SelectableAttribute> |
getSearchAttributes(FlashServletContext ctx)
Returns the set of selectable attributes that were used to generate the
current search results.
|
static ProductSearchInterface |
getSearchInterface(FlashServletContext ctx)
Returns an instance of the configured product search interface per the
"Product.Search.class" property value.
|
static java.lang.String |
getSearchWord(FlashServletContext ctx)
Returns the search word that was used to generate the current search results.
|
protected java.lang.String |
getTemplateName(BaseServlet.Context baseCtx)
Returns the name of the html template file used by the servlet.
|
static boolean |
isSearch3Interface(FlashServletContext ctx)
Answers if the configured product search interface is an instance of
or a subclasss of product search 3.
|
static boolean |
isSearchRealtimeInfoSet(FlashServletContext ctx)
Answers if realtime pricing and availablity was retrieved for the current
list of products when the search was performed.
|
static boolean |
isShowAttributes(FlashServletContext ctx)
Answers if product attributes are configured to be shown on the search page
per the
ProductSearch.Show.Attributes properties value. |
protected void |
limitSearchResults(ProductSearch.Context ctx)
Limits the size of the search results to the configured maximum allowed
and if necessary also retrieves products with stock.
|
protected void |
logSearchRequest(ProductSearch.Context ctx,
java.util.ArrayList<java.lang.String[]> searchAttrs)
Logs the search request to the database.
|
protected void |
readParameters(BaseServlet.Context baseCtx,
boolean post)
Reads the parameters passed to the servlet via the http request object.
|
protected void |
resetFormFields(BaseServlet.Context baseCtx)
Resets the values for the html template's form fields.
|
protected void |
setCookieValues(BaseServlet.Context baseCtx)
Adds one or more values to the http session cookies.
|
protected void |
setSessionValues(BaseServlet.Context baseCtx)
Adds one or more values to the http session object.
|
protected void |
setTemplateAttributes(ProductSearch.Context ctx)
Invoked by this class' implementation of
setTemplateData to
retrieve and set the product data required by the html template. |
protected void |
setTemplateData(BaseServlet.Context baseCtx)
Sets the various data required by the html template.
|
protected boolean |
setTemplateError(ProductSearch.Context ctx,
java.lang.String errName)
Sets the html template error fields for the given error name.
|
confirmSession, getPreviousCategoryList, getPreviousCategoryPath, hasSubcategories, hasSubcategories, isOmitNoStock, isPreshopRequest, isUserHelpRequest, setTemplateCategoryPath, sortCategoryProductData, writePageImpl
confirmCart, confirmRequest, confirmRetail, confirmWholesale, createNewCart, createNewSessionImpl, getPageTitle, getServletPath, getUser, initTemplateDataImpl, isLogonRequest, requestComplete, requiresLogon, resetCart, resetCategories, resetProducts, setDefaultUser, setSessionCart, setSFIShoppingUser, useExistingSessionImpl, writeCookie
createNewSession, determineBrowser, doGet, doPost, getCookie, getInvokerName, getInvokerName, getInvokerParams, getInvokerParams, getInvokerPath, getInvokerPath, getInvokerURL, getPageParams, getRequestURL, getServletName, getServletName, getServletParams, getServletParams, getServletPath, getServletURL, getServletURL, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, initTemplateData, isPrintable, isServerTomcat, log, qualifyURL, redirectURL, setP3PCompactPolicy, 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_PSSEARCH_WORD
protected static final java.lang.String SN_PSSEARCH_ATTR
protected boolean editFormFields(BaseServlet.Context baseCtx)
doPost
method.
Overrides editFormFields
in BaseServlet
.editFormFields
in class BaseServlet
baseCtx
- (Context) The current servlet context.true
if all the edits are successful,
otherwise false
.protected java.lang.String getNextURL(BaseServlet.Context baseCtx)
writeURL
method.
Overrides getNextURL
in BaseServlet
.getNextURL
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected java.lang.String getTemplateName(BaseServlet.Context baseCtx)
writePage
method.
Overrides getTemplateName
in BaseServlet
.getTemplateName
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void readParameters(BaseServlet.Context baseCtx, boolean post)
doGet
and doPost
method.
Overrides readParameters
in BaseServlet
.readParameters
in class BaseServlet
baseCtx
- (Context) The current servlet context.post
- (boolean) true
if the method is invoked from
doPost
, otherwise false
.protected void resetFormFields(BaseServlet.Context baseCtx)
doGet
and doPost
methods.
Overrides resetFormFields
in BaseServlet
.resetFormFields
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setCookieValues(BaseServlet.Context baseCtx) throws java.io.IOException
writeURL
method. Calls should be made to writeCookie
for each cookie that needs to be set.
Overrides setCookieValues
in BaseServlet
.setCookieValues
in class BaseServlet
baseCtx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.protected void setSessionValues(BaseServlet.Context baseCtx)
writeURL
method.
Overrides setSessionValues
in BaseServlet
.setSessionValues
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setTemplateData(BaseServlet.Context baseCtx)
writePage
method.
Overrides setTemplateData
in BaseServlet
.setTemplateData
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setTemplateAttributes(ProductSearch.Context ctx)
setTemplateData
to
retrieve and set the product data required by the html template.ctx
- (Context) The current servlet context.protected boolean setTemplateError(ProductSearch.Context ctx, java.lang.String errName)
ctx
- (Context) The current servlet context.errName
- (String) The name of error that is to be set, used
to determine which message (or messages) to retrieve from the
message properties.false
.protected void limitSearchResults(ProductSearch.Context ctx)
ctx
- (Context) The current servlet context.protected void logSearchRequest(ProductSearch.Context ctx, java.util.ArrayList<java.lang.String[]> searchAttrs)
ctx
- (Context) The current servlet context.public static java.util.ArrayList<ProductSearch.SelectableAttribute> getSearchAttributes(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.public static java.lang.String getSearchWord(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.public static ProductSearchInterface getSearchInterface(FlashServletContext ctx) throws java.lang.Exception
ctx
- (FlashServletContext) The current servlet context.java.lang.Exception
- - if an error occurs while obtaining the
interface instance.public static boolean isSearch3Interface(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.true
if product search 3, otherwise
false
.public static boolean isSearchRealtimeInfoSet(FlashServletContext ctx)
ctx
- (FlashServletContext) The current servlet context.true
if realtime info had been retrieved,
otherwise false
.public static boolean isShowAttributes(FlashServletContext ctx)
ProductSearch.Show.Attributes
properties value.ctx
- (FlashServletContext) The current servlet context.true
if attributes are to be shown,
otherwise false
.protected MainServlet.Context createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
createContext
in MainServlet
.
Invoked by doPost
and doGet
methods.createContext
in class MainServlet
request
- (HttpServletRequest) The servlet's incoming request.response
- (HttpServletResponse) The servlet's outgoing response.