cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r728438 - in /cocoon/cocoon3/trunk: cocoon-docs/src/changes/changes.xml cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/SpringRESTController.java
Date Sun, 21 Dec 2008 13:55:17 GMT
Author: reinhard
Date: Sun Dec 21 05:55:16 2008
New Revision: 728438

URL: http://svn.apache.org/viewvc?rev=728438&view=rev
Log:
<action dev="reinahrd" type="add">
  [cocoon-rest] The @Inject annotation supports org.apache.cocoon.configuration.Settings and

  javax.servlet.ServletContext injections.
</action>

Modified:
    cocoon/cocoon3/trunk/cocoon-docs/src/changes/changes.xml
    cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/SpringRESTController.java

Modified: cocoon/cocoon3/trunk/cocoon-docs/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-docs/src/changes/changes.xml?rev=728438&r1=728437&r2=728438&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-docs/src/changes/changes.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-docs/src/changes/changes.xml Sun Dec 21 05:55:16 2008
@@ -25,6 +25,10 @@
 <document>
   <body>
     <release version="3.0.0-alpha-2" date="2008-00-00" description="unreleased">
+      <action dev="reinahrd" type="add">
+        [cocoon-rest] The @Inject annotation supports org.apache.cocoon.configuration.Settings
and 
+        javax.servlet.ServletContext injections.
+      </action>
       <action dev="steven" type="add">
         [cocoon-pipeline] Support expires caching: CachingPipeline and AsyncCachingPipeline
can be configured to
         be valid for a particular period. This 'expires caching' doesn't check if any of
the pipeline components

Modified: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/SpringRESTController.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/SpringRESTController.java?rev=728438&r1=728437&r2=728438&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/SpringRESTController.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/SpringRESTController.java
Sun Dec 21 05:55:16 2008
@@ -25,11 +25,13 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.ServletContext;
 import javax.servlet.ServletInputStream;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.controller.Controller;
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.rest.controller.annotation.BaseURL;
@@ -44,6 +46,7 @@
 import org.apache.cocoon.rest.controller.util.AnnotationCollector;
 import org.apache.cocoon.servlet.node.StatusCodeCollector;
 import org.apache.cocoon.servlet.util.HttpContextHelper;
+import org.apache.cocoon.servlet.util.SettingsHelper;
 import org.apache.cocoon.sitemap.util.ExceptionHandler;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -158,6 +161,7 @@
 
         HttpServletRequest request = HttpContextHelper.getRequest(parameters);
         HttpServletResponse response = HttpContextHelper.getResponse(parameters);
+
         for (Field field : injectFields) {
             field.setAccessible(true);
 
@@ -172,6 +176,12 @@
                 field.set(controller, request.getInputStream());
             } else if (fieldType == ServletOutputStream.class || fieldType == OutputStream.class)
{
                 field.set(controller, response.getOutputStream());
+            } else if (fieldType == ServletContext.class) {
+                ServletContext servletContext = HttpContextHelper.getServletContext(parameters);
+                field.set(controller, servletContext);
+            } else if (fieldType == Settings.class) {
+                Settings settings = SettingsHelper.getSettings(parameters);
+                field.set(controller, settings);
             } else {
                 throw new Exception("The annotation " + Inject.class.getName()
                         + " doesn't support the injection of type " + fieldType.getName()
+ "." + " " + "(field="



Mime
View raw message