wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1023041 - /incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
Date Fri, 15 Oct 2010 17:57:18 GMT
Author: bluk
Date: Fri Oct 15 17:57:18 2010
New Revision: 1023041

URL: http://svn.apache.org/viewvc?rev=1023041&view=rev
Log:
Simplify addition of Request/Response handlers

Thanks to Luciano Resende for the patch.

See [WINK-319]

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

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=1023041&r1=1023040&r2=1023041&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 Oct 15 17:57:18 2010
@@ -6,16 +6,16 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *  
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
  *  under the License.
- *  
+ *
  *******************************************************************************/
 package org.apache.wink.server.internal;
 
@@ -101,6 +101,7 @@ public class DeploymentConfiguration imp
     private static final String       USE_ACCEPT_CHARSET                  =
                                                                               "wink.response.useAcceptCharset";
             // $NON-NLS-1$
     // handler chains
+    private boolean                   isChainInitialized                  = false;
     private RequestHandlersChain      requestHandlersChain;
     private ResponseHandlersChain     responseHandlersChain;
     private ResponseHandlersChain     errorHandlersChain;
@@ -161,6 +162,9 @@ public class DeploymentConfiguration imp
     }
 
     public RequestHandlersChain getRequestHandlersChain() {
+        if (!isChainInitialized) {
+            initHandlersChain();
+        }
         return requestHandlersChain;
     }
 
@@ -169,6 +173,9 @@ public class DeploymentConfiguration imp
     }
 
     public ResponseHandlersChain getResponseHandlersChain() {
+        if (!isChainInitialized) {
+            initHandlersChain();
+        }
         return responseHandlersChain;
     }
 
@@ -177,6 +184,9 @@ public class DeploymentConfiguration imp
     }
 
     public ResponseHandlersChain getErrorHandlersChain() {
+        if (!isChainInitialized) {
+            initHandlersChain();
+        }
         return errorHandlersChain;
     }
 
@@ -300,7 +310,8 @@ public class DeploymentConfiguration imp
         }
         ApplicationValidator applicationValidator = new ApplicationValidator();
         providersRegistry = new ProvidersRegistry(ofFactoryRegistry, applicationValidator);
-        resourceRegistry = new ResourceRegistry(ofFactoryRegistry, applicationValidator,
properties);
+        resourceRegistry =
+            new ResourceRegistry(ofFactoryRegistry, applicationValidator, properties);
     }
 
     /**
@@ -429,6 +440,9 @@ public class DeploymentConfiguration imp
             errorUserHandlers = initErrorUserHandlers();
         }
 
+    }
+
+    private void initHandlersChain() {
         if (requestHandlersChain == null) {
             requestHandlersChain = initRequestHandlersChain();
         }
@@ -438,6 +452,8 @@ public class DeploymentConfiguration imp
         if (errorHandlersChain == null) {
             errorHandlersChain = initErrorHandlersChain();
         }
+
+        isChainInitialized = true;
     }
 
     /**



Mime
View raw message