svn commit: r1846789 - /ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1846789 - /ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java

jleroux@apache.org
Author: jleroux
Date: Sat Nov 17 09:41:17 2018
New Revision: 1846789

URL: http://svn.apache.org/viewvc?rev=1846789&view=rev
Log:
Improved: Override ‘GenericServlet::init’ instead of ‘Servlet::init’
(OFBIZ-10446)

This is done to remove the manual call to {{super}} which is done in
{{GenericServlet}} instead.

Thanks: Mathieu Lirzin

Modified:
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java

Modified: ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java?rev=1846789&r1=1846788&r2=1846789&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java Sat Nov 17 09:41:17 2018
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.util.Enumeration;
 
 import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -67,18 +66,17 @@ public class ControlServlet extends Http
      * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
      */
     @Override
-    public void init(ServletConfig config) throws ServletException {
-        super.init(config);
-        ServletContext servletContext = config.getServletContext();
+    public void init() throws ServletException {
+        ServletContext ctx = getServletContext();
         if (Debug.infoOn()) {
-            String webappName = servletContext.getContextPath().length() != 0 ? servletContext.getContextPath().substring(1) : "";
-            Debug.logInfo("Loading webapp [" + webappName + "], located at " + servletContext.getRealPath("/"), module);
+            String path = ctx.getContextPath();
+            String webappName = path.isEmpty() ? path : path.substring(1);
+            Debug.logInfo("Loading webapp [" + webappName + "], located at " + ctx.getRealPath("/"), module);
         }
 
         // Initialize the request handler.
-        RequestHandler.getRequestHandler(servletContext);
+        RequestHandler.getRequestHandler(ctx);
     }
-
     /**
      * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */