com.ibm.commerce.context.preview.servlet

Class PreviewServlet

  • java.lang.Object
    • javax.servlet.GenericServlet
      • javax.servlet.http.HttpServlet
        • com.ibm.commerce.context.preview.servlet.PreviewServlet
  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig


    public class PreviewServlet
    extends javax.servlet.http.HttpServlet
    This class defines a specialized servlet that acts as a proxy and forwards the request to the Stores application for processing. It will first check to see if any of the request plug-ins can handle the request. If none of them accept the request then the request is forwarded on to the Stores web application.

    The list of registered preview request plug-ins will be loaded from the WEB-INF/wc-preview-plugin.xml file. This file is associated with the web application that has registered this servlet. This file will specify any request plug-ins that will process the preview request before sending the request to the Stores web application. The file WEB-INF/wc-preview-plugin.xml is loaded at initialization. If it cannot be found then the servlet assumes that there are no plug-ins. In this case, all requests are forwarded directly to the Stores web application.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      static java.lang.String PATHINFO_NULL
      This is a constant that represents a null pathinfo when forwarding the servlet request.
      static java.lang.String PREVIEW_DEFAULT_WEBAPP_NAME
      This is the default name of the target web application.
      static java.lang.String PREVIEW_PLUGIN_XML
      This is the preview plug-in XML file.
      static java.lang.String PREVIEW_TARGET_WEBAPP_PARAM_NAME
      This is the name of the servlet initialization parameter to specify the target web application name.
    • Constructor Summary

      Constructors 
      Constructor and Description
      PreviewServlet()
      This is the default constructor for this class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void init()
      This method performs the common initialization procedures that all web applications must perform.
      void refresh()
      This method reloads the preview request plug-in to add, remove or update the current preview request plug-ins that are loaded.
      • Methods inherited from class javax.servlet.http.HttpServlet

        service
      • Methods inherited from class javax.servlet.GenericServlet

        destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • PATHINFO_NULL

        public static final java.lang.String PATHINFO_NULL
        This is a constant that represents a null pathinfo when forwarding the servlet request.
        See Also:
        Constant Field Values
      • PREVIEW_PLUGIN_XML

        public static final java.lang.String PREVIEW_PLUGIN_XML
        This is the preview plug-in XML file.
        See Also:
        Constant Field Values
      • PREVIEW_TARGET_WEBAPP_PARAM_NAME

        public static final java.lang.String PREVIEW_TARGET_WEBAPP_PARAM_NAME
        This is the name of the servlet initialization parameter to specify the target web application name. This is the web application name defined in the <instance_name>.xml of the server and is the web application that all requests will be forwarded to.
        See Also:
        Constant Field Values
      • PREVIEW_DEFAULT_WEBAPP_NAME

        public static final java.lang.String PREVIEW_DEFAULT_WEBAPP_NAME
        This is the default name of the target web application. The default is Stores.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PreviewServlet

        public PreviewServlet()
        This is the default constructor for this class. It calls the constructor from the superclass.
    • Method Detail

      • init

        public void init()
                  throws javax.servlet.ServletException
        This method performs the common initialization procedures that all web applications must perform. This involves registering itself to the static WebApp object but not forcing an initialization. This method also performs preview initialization. It registers all the request plug-ins that may want to handle the request instead of being forwarded to the Stores web application.

        Initialization of the request plug-ins are performed by first reading the WEB-INF/wc-preview-plugin.xml file. The each is loaded in the order determined in the file. This is also the same order in which they will be called to handle requests.

        Overrides:
        init in class javax.servlet.GenericServlet
        Throws:
        javax.servlet.ServletException - This is thrown when a problem occurs during initialization.
        See Also:
        GenericServlet.init()
      • refresh

        public void refresh()
                     throws javax.servlet.ServletException
        This method reloads the preview request plug-in to add, remove or update the current preview request plug-ins that are loaded.
        Throws:
        javax.servlet.ServletException - This is thrown when a problem occurs while refreshing the plug-in list.