wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r818697 - in /incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server: handlers/AbstractHandlersChain.java internal/DeploymentConfiguration.java internal/RequestProcessor.java
Date Fri, 25 Sep 2009 02:15:26 GMT
Author: bluk
Date: Fri Sep 25 02:15:26 2009
New Revision: 818697

URL: http://svn.apache.org/viewvc?rev=818697&view=rev
Log:
Add general config debug statements in wink-server

Modified:
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/handlers/AbstractHandlersChain.java
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/handlers/AbstractHandlersChain.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/handlers/AbstractHandlersChain.java?rev=818697&r1=818696&r2=818697&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/handlers/AbstractHandlersChain.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/handlers/AbstractHandlersChain.java
Fri Sep 25 02:15:26 2009
@@ -70,4 +70,8 @@
 
     protected abstract void handle(T handler, MessageContext context) throws Throwable;
 
+    @Override
+    public String toString() {
+        return String.format("Handlers chain is %1$s", list);
+    }
 }

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java?rev=818697&r1=818696&r2=818697&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
Fri Sep 25 02:15:26 2009
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -126,6 +127,8 @@
             properties = new Properties();
         }
 
+        logger.debug("Deployment configuration properties: {}", properties);
+
         // check to see if an override property was specified. if so, then
         // configure
         // the headers from there using a comma delimited string.
@@ -287,10 +290,12 @@
                 Properties lproperties = new Properties();
 
                 lproperties.load(is);
+                logger.debug("Alternative shortcuts properties: {}", lproperties);
                 alternateShortcutMap = new HashMap<String, String>();
                 for (Entry<Object, Object> entry : lproperties.entrySet()) {
                     alternateShortcutMap.put((String)entry.getKey(), (String)entry.getValue());
                 }
+                logger.debug("Alternative shortcuts map: {}", alternateShortcutMap);
             } catch (IOException e) {
                 logger.error(Messages.getMessage("alternateShortcutMapLoadFailure"), e);
                 throw new WebApplicationException(e);
@@ -335,6 +340,7 @@
         String handlersFactoryClassName = properties.getProperty(HANDLERS_FACTORY_CLASS_PROP);
         if (handlersFactoryClassName != null) {
             try {
+                logger.debug("Handlers Factory Class is: {}", handlersFactoryClassName);
                 Class<HandlersFactory> handlerFactoryClass =
                     (Class<HandlersFactory>)Class.forName(handlersFactoryClassName);
                 HandlersFactory handlersFactory = handlerFactoryClass.newInstance();
@@ -403,6 +409,7 @@
             }
         }
         handlersChain.addHandler(createHandler(InvokeMethodHandler.class));
+        logger.debug("Request handlers chain is: {}", handlersChain);
         return handlersChain;
     }
 
@@ -461,6 +468,7 @@
         }
         handlersChain.addHandler(createHandler(FlushResultHandler.class));
         handlersChain.addHandler(createHandler(HeadMethodHandler.class));
+        logger.debug("Response handlers chain is: {}", handlersChain);
         return handlersChain;
     }
 
@@ -484,12 +492,14 @@
             }
         }
         handlersChain.addHandler(createHandler(FlushResultHandler.class));
+        logger.debug("Error handlers chain is: {}", handlersChain);
         return handlersChain;
     }
 
     private <T extends Handler> T createHandler(Class<T> cls) {
         try {
             T handler = cls.newInstance();
+            logger.debug("Calling {}.init(Properties)", cls);
             handler.init(getProperties());
             return handler;
         } catch (InstantiationException e) {
@@ -501,6 +511,12 @@
 
     public void setHttpMethodOverrideHeaders(String[] httpMethodOverrideHeaders) {
         this.httpMethodOverrideHeaders = httpMethodOverrideHeaders;
+        if (logger.isDebugEnabled()) {
+            List<String> overrideHeaders =
+                (httpMethodOverrideHeaders == null) ? null : Arrays
+                    .asList(httpMethodOverrideHeaders);
+            logger.debug("Setting HTTP Method override headers: {}", overrideHeaders);
+        }
     }
 
     public String[] getHttpMethodOverrideHeaders() {

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java?rev=818697&r1=818696&r2=818697&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/RequestProcessor.java
Fri Sep 25 02:15:26 2009
@@ -76,6 +76,9 @@
             String loadWinkApplicationsProperty =
                 configuration.getProperties().getProperty(PROPERTY_LOAD_WINK_APPLICATIONS,
                                                           Boolean.toString(true));
+            logger.debug("{} property is set to: {}",
+                         PROPERTY_LOAD_WINK_APPLICATIONS,
+                         loadWinkApplicationsProperty);
             final Set<Class<?>> classes =
                 new ServletApplicationFileLoader(Boolean.parseBoolean(loadWinkApplicationsProperty))
                     .getClasses();
@@ -92,6 +95,7 @@
         Properties properties = configuration.getProperties();
         String registerRootResource =
             properties.getProperty(PROPERTY_ROOT_RESOURCE, PROPERTY_ROOT_RESOURCE_DEFAULT);
+        logger.debug("{} property is set to: {}", PROPERTY_ROOT_RESOURCE, registerRootResource);
         if (registerRootResource.equals(PROPERTY_ROOT_RESOURCE_ATOM)) {
             RegistrationUtils.InnerApplication application =
                 new RegistrationUtils.InnerApplication(RootResource.class);
@@ -101,6 +105,7 @@
             // do nothing
         } else {
             String css = properties.getProperty(PROPERTY_ROOT_RESOURCE_CSS);
+            logger.debug("{} property is set to: {}", PROPERTY_ROOT_RESOURCE_CSS, css);
             HtmlServiceDocumentResource instance = new HtmlServiceDocumentResource();
             if (css != null) {
                 instance.setServiceDocumentCssPath(css);
@@ -143,8 +148,13 @@
         try {
             ServerMessageContext msgContext = createMessageContext(request, response);
             RuntimeContextTLS.setRuntimeContext(msgContext);
+            logger.debug("Creating ServerMessageContext: {}", msgContext);
+            logger.debug("Set message context and starting request handlers chain: {}", msgContext);
             // run the request handler chain
             configuration.getRequestHandlersChain().run(msgContext);
+            logger
+                .debug("Finished request handlers chain and starting response handlers chain:
{}",
+                       msgContext);
             // run the response handler chain
             configuration.getResponseHandlersChain().run(msgContext);
         } catch (Throwable t) {
@@ -152,9 +162,12 @@
             ServerMessageContext msgContext = createMessageContext(request, response);
             RuntimeContextTLS.setRuntimeContext(msgContext);
             msgContext.setResponseEntity(t);
+            logger.debug("Creating ServerMessageContext: {}", msgContext);
             // run the error handler chain
+            logger.debug("Exception occured, starting error handlers chain: {}", msgContext);
             configuration.getErrorHandlersChain().run(msgContext);
         } finally {
+            logger.debug("Finished response handlers chain");
             RuntimeContextTLS.setRuntimeContext(null);
         }
     }
@@ -200,7 +213,12 @@
         if (attributeName == null) {
             attributeName = RequestProcessor.class.getName();
         }
-        return (RequestProcessor)servletContext.getAttribute(attributeName);
+        RequestProcessor requestProcessor =
+            (RequestProcessor)servletContext.getAttribute(attributeName);
+        logger
+            .debug("Retrieving request processor {} using attribute name {} in servlet context
{}",
+                   new Object[] {requestProcessor, attributeName, servletContext});
+        return requestProcessor;
     }
 
     public void storeRequestProcessorOnServletContext(ServletContext servletContext,
@@ -208,7 +226,8 @@
         if (attributeName == null || attributeName.length() == 0) {
             attributeName = RequestProcessor.class.getName();
         }
+        logger.debug("Storing request processor {} using attribute name {} in servlet context
{}",
+                     new Object[] {this, attributeName, servletContext});
         servletContext.setAttribute(attributeName, this);
     }
-
 }



Mime
View raw message