svn commit: r1389819 - /cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java

[email protected]
Newsgroups gmane.text.xml.cocoon.cvs
Message-ID <[email protected]>
Author: thorsten
Date: Tue Sep 25 11:44:40 2012
New Revision: 1389819

URL: http://svn.apache.org/viewvc?rev=1389819&view=rev
Log:
white noise - formating changes

Modified:
    cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java

Modified: cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java
URL: http://svn.apache.org/viewvc/cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java?rev=1389819&r1=1389818&r2=1389819&view=diff
==============================================================================
--- cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java (original)
+++ cocoon/subprojects/cocoon-servlet-service-impl/trunk/src/main/java/org/apache/cocoon/servletservice/ServletServiceContext.java Tue Sep 25 11:44:40 2012
@@ -47,10 +47,12 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
- * @version $Id$
+ * @version $Id: ServletServiceContext.java 664527 2008-06-08 17:19:35Z reinhard
+ *          $
  * @since 1.0.0
  */
-public class ServletServiceContext extends ServletContextWrapper implements Absolutizable {
+public class ServletServiceContext extends ServletContextWrapper implements
+        Absolutizable {
 
     public static final String SUPER = "super";
 
@@ -67,8 +69,9 @@ public class ServletServiceContext exten
     private String serviceName;
 
     /*
-     * TODO inheritance of attributes from the parent context is only partly implemented: removeAttribute and
-     * getAttributeNames doesn't respect inheritance yet.
+     * TODO inheritance of attributes from the parent context is only partly
+     * implemented: removeAttribute and getAttributeNames doesn't respect
+     * inheritance yet.
      */
     public Object getAttribute(String name) {
         Object value = this.attributes.get(name);
@@ -88,18 +91,21 @@ public class ServletServiceContext exten
     }
 
     /**
-     * @param map the attributes to set
+     * @param map
+     *            the attributes to set
      */
     public void setAttributes(Map map) {
         if (map != null) {
             this.attributes = map;
         }
     }
-
+    
+    @Override
     public URL getResource(String path) throws MalformedURLException {
         if (path == null || !path.startsWith("/")) {
-            throw new MalformedURLException("The path must begin with a '/' and is interpreted "
-                    + "as relative to the current context root.");
+            throw new MalformedURLException(
+                    "The path must begin with a '/' and is interpreted "
+                            + "as relative to the current context root.");
         }
 
         // lazy initialization of the base URL
@@ -196,7 +202,8 @@ public class ServletServiceContext exten
         ArrayList filenames = new ArrayList();
 
         if (!file.isDirectory()) {
-            filenames.add("/" + file.toString().substring(pathPrefix.length() - 1));
+            filenames.add("/"
+                    + file.toString().substring(pathPrefix.length() - 1));
             return filenames;
         }
 
@@ -268,8 +275,9 @@ public class ServletServiceContext exten
     }
 
     /**
-     * Takes the scheme specific part of a servlet service URI (the scheme is the responsibilty of the ServletSource)
-     * and resolve it with respect to the servlets mount point.
+     * Takes the scheme specific part of a servlet service URI (the scheme is
+     * the responsibilty of the ServletSource) and resolve it with respect to
+     * the servlets mount point.
      */
     public URI absolutizeURI(URI uri) throws URISyntaxException {
         String servletServiceName = uri.getScheme();
@@ -279,15 +287,18 @@ public class ServletServiceContext exten
             servletServiceContext = this;
         } else {
             // another servlet service
-            servletServiceContext = (ServletServiceContext) this.getNamedContext(servletServiceName);
+            servletServiceContext = (ServletServiceContext) this
+                    .getNamedContext(servletServiceName);
             if (servletServiceContext == null) {
-                throw new URISyntaxException(uri.toString(), "Unknown servlet service name");
+                throw new URISyntaxException(uri.toString(),
+                        "Unknown servlet service name");
             }
         }
 
         String mountPath = servletServiceContext.getMountPath();
         if (mountPath == null) {
-            throw new URISyntaxException(uri.toString(), "No mount point for this URI");
+            throw new URISyntaxException(uri.toString(),
+                    "No mount point for this URI");
         }
         if (mountPath.endsWith("/")) {
             mountPath = mountPath.substring(0, mountPath.length() - 1);
@@ -295,7 +306,8 @@ public class ServletServiceContext exten
 
         String absoluteURI = mountPath + uri.getSchemeSpecificPart();
         if (this.logger.isInfoEnabled()) {
-            this.logger.info("Resolving " + uri.toString() + " to " + absoluteURI);
+            this.logger.info("Resolving " + uri.toString() + " to "
+                    + absoluteURI);
         }
 
         return new URI(absoluteURI);
@@ -322,7 +334,8 @@ public class ServletServiceContext exten
         if (servlet == null && !name.equals(SUPER)) {
             Servlet _super = (Servlet) this.connections.get(SUPER);
             if (_super != null) {
-                ServletContext c = _super.getServletConfig().getServletContext();
+                ServletContext c = _super.getServletConfig()
+                        .getServletContext();
                 if (c instanceof ServletServiceContext) {
                     return ((ServletServiceContext) c).getNamedContext(name);
                 }
@@ -330,11 +343,13 @@ public class ServletServiceContext exten
                 return null;
             }
         }
-        return servlet != null ? servlet.getServletConfig().getServletContext() : null;
+        return servlet != null ? servlet.getServletConfig().getServletContext()
+                : null;
     }
 
     /**
-     * @param mountPath The mountPath to set.
+     * @param mountPath
+     *            The mountPath to set.
      */
     public void setMountPath(String mountPath) {
         this.mountPath = mountPath;
@@ -363,28 +378,32 @@ public class ServletServiceContext exten
     }
 
     /**
-     * @param properties The properties to set.
+     * @param properties
+     *            The properties to set.
      */
     public void setInitParams(Map properties) {
         this.properties = properties;
     }
 
     /**
-     * @param connections the connections to set
+     * @param connections
+     *            the connections to set
      */
     public void setConnections(Map connections) {
         this.connections = connections;
     }
 
     /**
-     * @param connections the service names of the connections
+     * @param connections
+     *            the service names of the connections
      */
     public void setConnectionServiceNames(Map connectionServletServiceNames) {
         this.connectionServiceNames = connectionServletServiceNames;
     }
 
     /**
-     * @param serviceName the name of the
+     * @param serviceName
+     *            the name of the
      */
     public void setServiceName(String serviceName) {
         this.serviceName = serviceName;
@@ -404,41 +423,49 @@ public class ServletServiceContext exten
 
             // Call to a named servlet service that exists in the current
             // context
-            this.context = ServletServiceContext.this.getNamedContext(this.servletServiceName);
+            this.context = ServletServiceContext.this
+                    .getNamedContext(this.servletServiceName);
         }
 
         protected boolean exists() {
             return this.context != null;
         }
 
-        public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+        public void forward(ServletRequest request, ServletResponse response)
+                throws ServletException, IOException {
             // Call to named servlet service
 
             if (ServletServiceContext.this.logger.isInfoEnabled()) {
                 ServletServiceContext.this.logger
-                        .info("Enter processing in servlet service " + this.servletServiceName);
+                        .info("Enter processing in servlet service "
+                                + this.servletServiceName);
             }
-            RequestDispatcher dispatcher = this.context.getRequestDispatcher(((HttpServletRequest) request)
-                    .getPathInfo());
+            RequestDispatcher dispatcher = this.context
+                    .getRequestDispatcher(((HttpServletRequest) request)
+                            .getPathInfo());
             if (dispatcher != null && dispatcher instanceof PathDispatcher) {
-                ((PathDispatcher) dispatcher).forward(request, response, this.superCall);
+                ((PathDispatcher) dispatcher).forward(request, response,
+                        this.superCall);
             } else {
                 // Cannot happen
                 throw new IllegalStateException();
             }
             if (ServletServiceContext.this.logger.isInfoEnabled()) {
-                ServletServiceContext.this.logger.info("Leaving processing in servlet service "
-                        + this.servletServiceName);
+                ServletServiceContext.this.logger
+                        .info("Leaving processing in servlet service "
+                                + this.servletServiceName);
             }
         }
 
-        public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+        public void include(ServletRequest request, ServletResponse response)
+                throws ServletException, IOException {
             throw new UnsupportedOperationException();
         }
     }
 
     /**
-     * Limited functionality, assumes that there is at most one servlet in the context
+     * Limited functionality, assumes that there is at most one servlet in the
+     * context
      */
     private class PathDispatcher implements RequestDispatcher {
 
@@ -451,11 +478,13 @@ public class ServletServiceContext exten
             return ServletServiceContext.this.servlet != null;
         }
 
-        public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+        public void forward(ServletRequest request, ServletResponse response)
+                throws ServletException, IOException {
             this.forward(request, response, false);
         }
 
-        protected void forward(ServletRequest request, ServletResponse response, boolean superCall)
+        protected void forward(ServletRequest request,
+                ServletResponse response, boolean superCall)
                 throws ServletException, IOException {
             try {
                 HttpServletResponseBufferingWrapper wrappedResponse = new HttpServletResponseBufferingWrapper(
@@ -467,28 +496,34 @@ public class ServletServiceContext exten
                     // It is important to set the current context each time
                     // a new context is entered, this is used for the servlet
                     // protocol
-                    CallStackHelper.enterServlet(ServletServiceContext.this, (HttpServletRequest) request,
-                            wrappedResponse);
+                    CallStackHelper.enterServlet(ServletServiceContext.this,
+                            (HttpServletRequest) request, wrappedResponse);
                 } else {
                     // A super servlet service should be called in the context
                     // of the called servlet service to get polymorphic calls
                     // resolved in the right way. We still need to register the
                     // current context for resolving super calls relative it.
-                    CallStackHelper.enterSuperServlet(ServletServiceContext.this, (HttpServletRequest) request,
-                            wrappedResponse);
+                    CallStackHelper.enterSuperServlet(
+                            ServletServiceContext.this,
+                            (HttpServletRequest) request, wrappedResponse);
                 }
 
-                ServletServiceContext.this.servlet.service(request, wrappedResponse);
+                ServletServiceContext.this.servlet.service(request,
+                        wrappedResponse);
 
                 int status = wrappedResponse.getStatusCode();
-                NamedDispatcher _super = (NamedDispatcher) ServletServiceContext.this.getNamedDispatcher(SUPER);
-                if (status == HttpServletResponse.SC_NOT_FOUND && _super != null) {
-                    // if servlet returned NOT_FOUND (404) and has super servlet declared let's reset everything and ask
+                NamedDispatcher _super = (NamedDispatcher) ServletServiceContext.this
+                        .getNamedDispatcher(SUPER);
+                if (status == HttpServletResponse.SC_NOT_FOUND
+                        && _super != null) {
+                    // if servlet returned NOT_FOUND (404) and has super servlet
+                    // declared let's reset everything and ask
                     // the super servlet
 
                     // wrapping object resets underlying response as well
                     wrappedResponse.resetBufferedResponse();
-                    // here we don't need to pass wrappedResponse object because it's not our concern to buffer response
+                    // here we don't need to pass wrappedResponse object because
+                    // it's not our concern to buffer response
                     // anymore
                     // this avoids many overlapping buffers
                     _super.forward(request, response);
@@ -500,7 +535,8 @@ public class ServletServiceContext exten
             }
         }
 
-        public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
+        public void include(ServletRequest request, ServletResponse response)
+                throws ServletException, IOException {
             throw new UnsupportedOperationException();
         }
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.