cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r689771 - /cocoon/whiteboard/corona/trunk/corona-rest/src/main/java/org/apache/cocoon/corona/rest/controller/SpringRESTController.java
Date Thu, 28 Aug 2008 09:49:21 GMT
Author: reinhard
Date: Thu Aug 28 02:49:21 2008
New Revision: 689771

URL: http://svn.apache.org/viewvc?rev=689771&view=rev
Log:
slash causes problems when the servlet sub-protocols are used (e.g. servlet:xyz:/foo)

Modified:
    cocoon/whiteboard/corona/trunk/corona-rest/src/main/java/org/apache/cocoon/corona/rest/controller/SpringRESTController.java

Modified: cocoon/whiteboard/corona/trunk/corona-rest/src/main/java/org/apache/cocoon/corona/rest/controller/SpringRESTController.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-rest/src/main/java/org/apache/cocoon/corona/rest/controller/SpringRESTController.java?rev=689771&r1=689770&r2=689771&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-rest/src/main/java/org/apache/cocoon/corona/rest/controller/SpringRESTController.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-rest/src/main/java/org/apache/cocoon/corona/rest/controller/SpringRESTController.java
Thu Aug 28 02:49:21 2008
@@ -92,7 +92,7 @@
 
                 ControllerContextHelper.storeContext(page.getData(), inputParameters);
 
-                URL pageUri = new URL(new URL("servlet:/"), page.getUri());
+                URL pageUri = new URL(new URL("servlet:"), page.getUri());
                 URLConnection servletConnection = pageUri.openConnection();
                 IOUtils.copy(servletConnection.getInputStream(), outputStream);
                 URLConnectionUtils.closeQuietly(servletConnection);
@@ -213,6 +213,16 @@
                 if (parameter != null) {
                     field.set(controller, parameter);
                 }
+            } else if (fieldType == int.class) {
+                String parameter = request.getParameter(requestParameterName);
+                if (parameter != null) {
+                    field.set(controller, Integer.parseInt(parameter));
+                }
+            } else if (fieldType == boolean.class) {
+                String parameter = request.getParameter(requestParameterName);
+                if (parameter != null) {
+                    field.set(controller, Boolean.parseBoolean(parameter));
+                }
             } else if (fieldType == String[].class) {
                 String[] parameterValues = request.getParameterValues(requestParameterName);
                 if (parameterValues != null) {
@@ -220,9 +230,9 @@
                 }
             } else {
                 throw new Exception("The annotation " + RequestParameter.class.getName()
-                        + " can only be set on fields of type " + String.class.getName()
+ " or "
-                        + String[].class.getName() + ". " + "(field=" + field.getName() +
", type="
-                        + fieldType.getName() + ")");
+                        + " can only be set on fields of type " + String.class.getName()
+ ", "
+                        + String[].class.getName() + ", " + int.class.getName() + " or "
+ boolean.class.getName()
+                        + ". (field=" + field.getName() + ", type=" + fieldType.getName()
+ ")");
             }
         }
     }



Mime
View raw message