com.konakart.actions
Class BaseAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by com.konakart.actions.BaseAction
Direct Known Subclasses:
AddressBookAction, AddToCartFromProdIdAction, AddToCartSubmitAction, AdminLoginSubmitAction, AdvancedSearchAction, AdvancedSearchSubmitAction, BaseGatewayAction, CatalogAfterLoginAction, CatalogMainPageAction, ChangeDeliveryAddrAction, ChangeDeliveryAddrSubmitAction, ChangePasswordAction, ChangePasswordSubmitAction, ChangePaymentAddrAction, ChangePaymentAddrSubmitAction, CheckoutConfirmationAction, CheckoutConfirmationSubmitAction, CheckoutDeliveryAction, CheckoutDeliverySubmitAction, CheckoutFinishedAction, CheckoutFinishedSubmitAction, CheckoutPaymentAction, CheckoutPaymentErrorAction, CheckoutPaymentSubmitAction, CheckoutServerPaymentAction, CheckoutServerPaymentSubmitAction, ChronoPayAction, ConditionsOfUseAction, ContactUsAction, CustomerRegistrationAction, CustomerRegistrationSubmitAction, DeleteAddrAction, DeleteAddrSubmitAction, DigitalDownloadAction, EditAddrAction, EditAddrSubmitAction, EditCartSubmitAction, EditCustomerAction, EditCustomerSubmitAction, EditNewsletterAction, EditNewsletterSubmitAction, EditNotifiedProductsAction, EditNotifiedProductsSubmitAction, EPaybgAction, FilterProductAction, FilterProductByCategoryAction, FilterProductByTagsAction, ForgotPasswordSubmitAction, LoginAction, LoginSubmitAction, LogoutAction, ManufacturerBaseAction, MyAccountAction, NavigateAllOrdersAction, NavigateAllReviewAction, NavigateProductAction, NavigateReviewAction, NewAddrAction, NewAddrSubmitAction, PayPalAction, PrivacyNoticeAction, QuickSearchAction, RemoveAllTagsFromFilterAction, RepeatOrderAction, ResetNotificationAction, SelectCategoryAction1, SetLocaleAction, SetNotificationAction, ShippingAndReturnsAction, ShowAllNewProdsAction, ShowAllOrdersAction, ShowAllReviewsAction, ShowAllSpecialsAction, ShowCartItemsAction, ShowHomepageAction, ShowImageAction, ShowOrderDetailsAction, ShowProductDetailsAction, ShowRandomReviewDetailsAction, ShowReviewDetailsAction, ShowReviewsAction, SortProductAction, WorldPayAction, WriteReviewAction, WriteReviewSubmitAction, XMLOverHTTPAction

public class BaseAction
extends org.apache.struts.action.Action

Base Action for KonaKart application. All of the other action classes extend this class.


Field Summary
protected  org.apache.commons.logging.Log log
          The Log instance for this application.
protected static java.lang.String loginForward
           
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
BaseAction()
           
 
Method Summary
protected  org.apache.struts.action.ActionForward checkSSL(javax.servlet.http.HttpServletRequest request, int custId, boolean forceSSL)
          Determines whether we are using SSL or not.
protected  void clearErrors(javax.servlet.http.HttpServletRequest request)
          Method called to clear the current error stack.
protected  org.apache.struts.action.ActionForward getForward(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request, java.lang.Exception e, java.lang.String cause, java.lang.String message, java.lang.String forward)
          If the application sends us a KKException with the cause equal to a more detailed exception such as KKPasswordDoesntMatchException, sometimes the application has to be able to detect this so that it can handle the exception by sending an error message back to the screen.
protected  KKAppEng getKKAppEng(javax.servlet.http.HttpServletRequest request)
          Sets the variable kkAppEng to the KKAppEng instance saved in the session.
protected  java.lang.String handleException(javax.servlet.http.HttpServletRequest request, java.lang.Exception e)
          A common method that contains the code to deal with exceptions
protected  boolean isOnePageCheckout(KKAppEng kkAppEng)
          Returns true if configured for one page checkout
protected  int loggedIn(KKAppEng kkAppEng, java.lang.String forwardAfterLogin)
          Checks to see whether we are logged in.
protected  boolean runningInPortal(KKAppEng kkAppEng)
          Returns true if we are running in a portal
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log
The Log instance for this application.


loginForward

protected static final java.lang.String loginForward
See Also:
Constant Field Values
Constructor Detail

BaseAction

public BaseAction()
Method Detail

getKKAppEng

protected KKAppEng getKKAppEng(javax.servlet.http.HttpServletRequest request)
                        throws KKAppException,
                               com.konakart.app.KKException
Sets the variable kkAppEng to the KKAppEng instance saved in the session. If cannot be found, then it is instantiated and attached.

Parameters:
request -
Returns:
Returns a KonaKart client engine instance
Throws:
com.konakart.app.KKException
KKAppException

handleException

protected java.lang.String handleException(javax.servlet.http.HttpServletRequest request,
                                           java.lang.Exception e)
A common method that contains the code to deal with exceptions

Parameters:
request -
e -
Returns:
Returns a string

loggedIn

protected int loggedIn(KKAppEng kkAppEng,
                       java.lang.String forwardAfterLogin)
                throws com.konakart.app.KKException
Checks to see whether we are logged in.

Parameters:
kkAppEng - The KonaKart client engine instance
forwardAfterLogin - tells us which page to forward to after login.
Returns:
Returns the CustomerId if logged in. Otherwise a negative number.
Throws:
com.konakart.app.KKException

clearErrors

protected void clearErrors(javax.servlet.http.HttpServletRequest request)
Method called to clear the current error stack. This is useful because we may be diverted to the login page when we click the submit button of another form such as writeReview (if the system detects that we are no longer logged in). We don't want to display the errors of this form on the login page.

Parameters:
request -

getForward

protected org.apache.struts.action.ActionForward getForward(org.apache.struts.action.ActionMapping mapping,
                                                            javax.servlet.http.HttpServletRequest request,
                                                            java.lang.Exception e,
                                                            java.lang.String cause,
                                                            java.lang.String message,
                                                            java.lang.String forward)
If the application sends us a KKException with the cause equal to a more detailed exception such as KKPasswordDoesntMatchException, sometimes the application has to be able to detect this so that it can handle the exception by sending an error message back to the screen.

Parameters:
mapping -
request -
e - The exception that has been captured
cause - The name of the cause Exception to look for i.e. KKPasswordDoesntMatchException
message - The message to send out to the application
forward - The forward if we detect the cause
Returns:
ActionForward

checkSSL

protected org.apache.struts.action.ActionForward checkSSL(javax.servlet.http.HttpServletRequest request,
                                                          int custId,
                                                          boolean forceSSL)
                                                   throws com.konakart.app.KKException
Determines whether we are using SSL or not. If we are logged in, then we should be using SSL. SSL can also be forced by setting the forceSSL boolean. If we should be using SSL but aren't (or vice versa) we do a redirect by returning an action forward with the correct URL to redirect to. Otherwise we return null

Parameters:
request -
custId - The customer id
forceSSL - Set to true if we should force SSL.
Returns:
ActionForward
Throws:
com.konakart.app.KKException

runningInPortal

protected boolean runningInPortal(KKAppEng kkAppEng)
Returns true if we are running in a portal

Parameters:
kkAppEng -
Returns:
Returns true if we are running in a portal

isOnePageCheckout

protected boolean isOnePageCheckout(KKAppEng kkAppEng)
Returns true if configured for one page checkout

Parameters:
kkAppEng -
Returns:
Returns true if configured for one page checkout


Copyright © 2006 DS Data Systems UK Ltd.