You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ni...@apache.org on 2008/02/19 23:36:51 UTC

svn commit: r629255 - in /struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context: PreparatorServlet.java ServletContextHolderListener.java

Author: nilsga
Date: Tue Feb 19 14:36:48 2008
New Revision: 629255

URL: http://svn.apache.org/viewvc?rev=629255&view=rev
Log:
WW-2101 Added back classes with deprecation

Added:
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java
      - copied, changed from r564598, struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java
      - copied, changed from r564601, struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java

Copied: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java (from r564598, struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java)
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java?p2=struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java&p1=struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java&r1=564598&r2=629255&rev=629255&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PreparatorServlet.java Tue Feb 19 14:36:48 2008
@@ -20,47 +20,30 @@
  */
 package org.apache.struts2.portlet.context;
 
-import java.io.IOException;
-
-import javax.servlet.ServletContext;
+import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.struts2.StrutsStatics;
 
-import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
 
 /**
- * Since a portlet is not dispatched the same way as a servlet, the
- * {@link org.apache.struts2.ServletActionContext} is not immediately available, as it
- * depends on objects from the servlet API. However, the WW2 view implementations require access
- * to the objects in the {@link org.apache.struts2.ServletActionContext}, and this servlet
- * makes sure that these are available when the portlet actions are executing the render results.
+ * @deprecated
+ * 
+ * This servlet has been deprecated. Do not use it (WW-2101)
  *
  */
 public class PreparatorServlet extends HttpServlet implements StrutsStatics {
 
     private static final long serialVersionUID = 1853399729352984089L;
 
-    private final static Log LOG = LogFactory.getLog(PreparatorServlet.class);
+    private final static Logger LOG = LoggerFactory.getLogger(PreparatorServlet.class);
 
-    /**
-     * Prepares the {@link org.apache.struts2.ServletActionContext} with the
-     * {@link ServletContext}, {@link HttpServletRequest} and {@link HttpServletResponse}.
-     */
-    public void service(HttpServletRequest servletRequest,
-            HttpServletResponse servletResponse) throws ServletException,
-            IOException {
-        LOG.debug("Preparing servlet objects for dispatch");
-        ServletContext ctx = getServletContext();
-        ActionContext.getContext().put(SERVLET_CONTEXT, ctx);
-        ActionContext.getContext().put(HTTP_REQUEST, servletRequest);
-        ActionContext.getContext().put(HTTP_RESPONSE, servletResponse);
-        LOG.debug("Preparation complete");
-    }
+	@Override
+	public void init(ServletConfig config) throws ServletException {
+		LOG.warn("The preparator servlet has been deprecated. It can safely be removed from your web.xml file");
+	}
 
 }

Copied: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java (from r564601, struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java)
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java?p2=struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java&p1=struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java&r1=564601&r2=629255&rev=629255&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/ServletContextHolderListener.java Tue Feb 19 14:36:48 2008
@@ -24,17 +24,20 @@
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
+
 /**
- * Some of the factory/managers (e.g. the ObjectFactory) need access to
- * the {@link org.apache.struts2.ServletActionContext} object when initializing.
- * This {@link javax.servlet.ServletContextListener} keeps a reference to the
- * {@link javax.servlet.ServletContext} and exposes it through a <code>public static</code>
- * method.
+ * @deprecated
+ * 
+ * This listener has been deprecated. Do not use it. (WW-2101)
  *
  */
 public class ServletContextHolderListener implements ServletContextListener {
 
     private static ServletContext context = null;
+    
+    private final static Logger LOG = LoggerFactory.getLogger(ServletContextHolderListener.class);
 
     /**
      * @return The current servlet context
@@ -49,8 +52,8 @@
      * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
      */
     public void contextInitialized(ServletContextEvent event) {
+    	LOG.warn("The ServletContextHolderListener has been deprecated. It can safely be removed from your web.xml file");
         context = event.getServletContext();
-
     }
 
     /**