cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r683426 - in /cocoon/whiteboard/corona/trunk/corona-sample: ./ src/main/java/org/apache/cocoon/corona/sample/controller/ src/main/resources/COB-INF/ src/main/resources/COB-INF/controller/ src/main/resources/META-INF/cocoon/spring/
Date Wed, 06 Aug 2008 22:05:08 GMT
Author: reinhard
Date: Wed Aug  6 15:05:07 2008
New Revision: 683426

URL: http://svn.apache.org/viewvc?rev=683426&view=rev
Log:
add simple restcontroller sample

Added:
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java
  (with props)
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/demo.html
  (with props)
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml
  (with props)
Modified:
    cocoon/whiteboard/corona/trunk/corona-sample/pom.xml
    cocoon/whiteboard/corona/trunk/corona-sample/rcl.properties
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap

Modified: cocoon/whiteboard/corona/trunk/corona-sample/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/pom.xml?rev=683426&r1=683425&r2=683426&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/pom.xml (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/pom.xml Wed Aug  6 15:05:07 2008
@@ -36,14 +36,13 @@
   <description>Cocoon Corona samples.</description>
 
   <dependencies>
-    <!-- Corona -->
     <dependency>
       <groupId>org.apache.cocoon.corona</groupId>
-      <artifactId>corona-servlet</artifactId>
+      <artifactId>corona-rest</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.cocoon.corona</groupId>
-      <artifactId>corona-controller</artifactId>
+      <artifactId>corona-stringtemplate</artifactId>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
@@ -69,6 +68,12 @@
   <build>
     <plugins>
       <plugin>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <configuration>
+          <useProjectReferences>false</useProjectReferences>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>org.apache.cocoon</groupId>
         <artifactId>cocoon-maven-plugin</artifactId>
         <configuration>

Modified: cocoon/whiteboard/corona/trunk/corona-sample/rcl.properties
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/rcl.properties?rev=683426&r1=683425&r2=683426&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/rcl.properties (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/rcl.properties Wed Aug  6 15:05:07 2008
@@ -15,15 +15,3 @@
 # limitations under the License.
 #
 org.apache.cocoon.corona.sample.servlet%classes-dir=./target/classes
-
-# Cocoon Corona Core
-#%classes-dir=../corona-core/target/classes
-#%exclude-lib=org.apache.cocoon:corona-core
-
-# Cocoon Corona Controller
-%classes-dir=../corona-controller/target/classes
-%exclude-lib=org.apache.cocoon:corona-controller
-
-# Cocoon Corona Sitemap
-#%classes-dir=../corona-sitemap/target/classes
-#%exclude-lib=org.apache.cocoon:corona-sitemap
\ No newline at end of file

Added: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java?rev=683426&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java
(added)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java
Wed Aug  6 15:05:07 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file 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.cocoon.corona.sample.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cocoon.corona.rest.controller.annotation.RESTController;
+import org.apache.cocoon.corona.rest.controller.annotation.SitemapParameter;
+import org.apache.cocoon.corona.rest.controller.method.Get;
+import org.apache.cocoon.corona.rest.controller.response.Page;
+import org.apache.cocoon.corona.rest.controller.response.RestResponse;
+
+@RESTController
+public class DemoRESTController implements Get {
+
+    @SitemapParameter
+    private String id;
+
+    @SitemapParameter
+    private String name;
+
+    public RestResponse doGet() throws Exception {
+        Map<String, Object> data = new HashMap<String, Object>();
+        data.put("id", this.id);
+        data.put("name", this.name);
+
+        return new Page("servlet:/controller/screen", data);
+    }
+
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/controller/DemoRESTController.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/demo.html
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/demo.html?rev=683426&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/demo.html
(added)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/demo.html
Wed Aug  6 15:05:07 2008
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  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.
+ -->
+<html>
+  <head>
+    <title>RESTController demo</title>
+  </head>
+  <body>
+    <h3>RESTController demo</h3>
+    <p>
+      name=$name$
+    </p>
+    <p>
+      id=$id$
+    </p>
+  </body>
+</html>

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/demo.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/controller/demo.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap?rev=683426&r1=683425&r2=683426&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap Wed
Aug  6 15:05:07 2008
@@ -352,8 +352,15 @@
 
     <!-- ~~~~~~~~~~~~~~~~ controller ~~~~~~~~~~~~~~~ -->
     <map:pipeline>
-      <map:match pattern="controller/invoke">
-        <controller:call controller="demo" select="org.apache.cocoon.corona.controller.sample.DemoController"
/>
+      <map:match pattern="controller/{id}/{name}">
+        <controller:call controller="rest-controller" select="org.apache.cocoon.corona.sample.controller.DemoRESTController">
+          <map:parameter name="id" value="{map:id}" />
+          <map:parameter name="name" value="{map:name}" />
+        </controller:call>
+      </map:match>
+      <map:match pattern="controller/screen">
+        <map:generate src="controller/demo.html" type="string-template" />
+        <map:serialize type="xhtml" />
       </map:match>
     </map:pipeline>
 

Added: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml?rev=683426&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml
(added)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml
Wed Aug  6 15:05:07 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  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.
+ -->
+<!-- $Id$ -->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
+  xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
+    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+  ">
+
+  <!-- Scan for all REST controllers and make them as beans available -->
+  <context:component-scan base-package="org.apache.cocoon.corona.sample.controller" use-default-filters="false"
+    name-generator="org.apache.cocoon.corona.rest.controller.ControllerBeanNameGenerator"
+    scope-resolver="org.apache.cocoon.corona.rest.controller.ControllerBeanScopeResolver">
+    <context:include-filter type="annotation" expression="org.apache.cocoon.corona.rest.controller.annotation.RESTController"
/>
+  </context:component-scan>
+  <context:annotation-config />
+
+</beans>

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-controller.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message