cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r771968 - in /cocoon/cocoon3/trunk: cocoon-docs/src/docbkx/reference/ cocoon-rest/ cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/ cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/ cocoon-rest/src/main/java/org/apach...
Date Tue, 05 May 2009 18:53:26 GMT
Author: reinhard
Date: Tue May  5 18:53:25 2009
New Revision: 771968

URL: http://svn.apache.org/viewvc?rev=771968&view=rev
Log:
Initial work on a JAX-RS (JSR311) integration + basic documentation

Added:
    cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/
    cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/
    cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java   (with props)
    cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/
    cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java   (with props)
    cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java   (with props)
    cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/
    cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java   (with props)
    cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java   (with props)
    cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/
    cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties   (with props)
Modified:
    cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml
    cocoon/cocoon3/trunk/cocoon-rest/pom.xml
    cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/ControllerTest.java
    cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/SaxPipelineTest.java
    cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/controller/DemoRESTController.java
    cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/controller/demo.html
    cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/overview.html
    cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-jaxrs.xml
    cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-servlet-service.xml
    cocoon/cocoon3/trunk/parent/pom.xml

Modified: cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-docs/src/docbkx/reference/web-applications.xml Tue May  5 18:53:25 2009
@@ -28,7 +28,7 @@
 
   <section id="webapps.servlet-service-fw">
     <title>Servlet-Service framework integration</title>
-    <para>TBW: Composition, servlet: protocol, inheritence</para>
+    <para>TBW: Composition, servlet: protocol, inheritance</para>
   </section>
 
   <section id="webapps.http-environments">
@@ -48,7 +48,251 @@
 
   <section id="webapps.rest">
     <title>RESTful web services</title>
-    <para>TBW: REST controller, Rendering views using StringTemplate, Request-wide transactions (incl. Subrequests)</para>
+    <para>
+    
+    </para>
+    <section id="webapps.rest.sitemap">
+      <title>Sitemap based RESTful web services</title>
+      <section>
+        <title>Introduction</title>
+        <para>
+          TBW: REST controller, Rendering views using StringTemplate, Request-wide transactions (incl. Subrequests) 
+        </para>
+      </section>
+    </section>
+    <section id="webapps.rest.jaxrs">
+      <title>JAX-RS based controllers (JSR311) </title>
+      <section>
+        <title>Introduction</title>
+        <para>
+          JAX-RS (JSR 311) is the Java standard for the development of RESTful web services. It provides a
+          set of annotations that, when being applied, define resources that are exposed by using Uniform Resource 
+          Identifiers (URIs).
+        </para>
+        <para>
+          The <ulink url="http://wikis.sun.com/display/Jersey/Main">wiki of the Jersey project</ulink> that provides 
+          the Reference Implementation of JAX-RS contains a lot of useful information about how to define REST resources.
+        </para>
+        <para>
+          The main pieces of the JAX-RS/Cocoon-integration are
+            <itemizedlist>
+              <listitem><para>the <literal>CocoonJAXRSServlet</literal> Servlet-Service, which is responsible for
+              the JAX-RS integration into the Cocoon Servlet-Service framework, and </para></listitem>
+              <listitem><para>the <literal>URLResponseBuilder</literal> class, which allows calling  resources
+              provided by other Servlet-Services (usually Cocoon pipelines exposed by sitemaps).
+              </para></listitem>
+            </itemizedlist>
+        </para>
+      </section>
+      
+      <section id="webapps.rest.jaxrs.sample">
+        <title>Cocoon and JAX-RS by example</title>
+        <para>
+          Adding support for JAX-RS services to your Cocoon application requires following three steps: 
+            <itemizedlist>
+              <listitem><para>Add the <literal>cocoon-rest</literal> module as a dependency.</para></listitem>
+              <listitem><para>Add the <literal>CocoonJAXRSServlet</literal> Servlet-Service</para></listitem>
+              <listitem><para>Add at least one JAX-RS root resource</para></listitem>
+            </itemizedlist>
+        </para>
+        
+        <section id="webapps.rest.jaxrs.sample.dependency">
+          <title>Cocoon-Rest dependency</title>
+          <para>
+            The first step is to add the <literal>cocoon-rest</literal> module to your Cocoon application:
+          </para>
+          <programlisting language="xml"><![CDATA[    <dependency>
+      <groupId>org.apache.cocoon.rest</groupId>
+      <artifactId>cocoon-rest</artifactId>
+    </dependency>]]></programlisting>
+        </section>
+        
+        <section id="webapps.rest.jaxrs.sample.resource">
+          <title>JAX-RS resource</title>
+          <para>
+            Then at least one JAX-RS resource is required:
+          </para>
+          <programlistingco>
+          <areaspec>
+            <area id="webapps.rest.jaxrs.sample.resource.path1" coords="1" />
+            <area id="webapps.rest.jaxrs.sample.resource.class" coords="2" />
+            <area id="webapps.rest.jaxrs.sample.resource.method" coords="6" />
+            <area id="webapps.rest.jaxrs.sample.resource.path2" coords="7" />
+            <area id="webapps.rest.jaxrs.sample.resource.param.id" coords="9" />
+            <area id="webapps.rest.jaxrs.sample.resource.param.req" coords="10" />
+            <area id="webapps.rest.jaxrs.sample.resource.param.uriinfo" coords="11" />
+            <area id="webapps.rest.jaxrs.sample.resource.param.request" coords="12" />
+            <area id="webapps.rest.jaxrs.sample.resource.data" coords="14" />
+            <area id="webapps.rest.jaxrs.sample.resource.responsebuilder" coords="20" />
+            <area id="webapps.rest.jaxrs.sample.resource.beansetter" coords="25" />
+          </areaspec>
+          <programlisting language="java"><![CDATA[@Path("/sample")
+public class SampleRestResource {
+
+    private Settings settings;
+
+    @GET
+    @Path("/parameter-passing/{id}")
+    public Response anotherService(
+        @PathParam("id") String id, 
+        @QueryParam("req-param") String reqParam,
+        @Context UriInfo uriInfo, 
+        @Context Request request) {
+        
+        Map<String, Object> data = new HashMap<String, Object>();
+        data.put("name", "Donald Duck");
+        data.put("id", id);
+        data.put("reqparam", reqParam);
+        data.put("runningMode", this.settings.getProperty("testProperty"));
+
+        return URLResponseBuilder.newInstance("servlet:sample:/controller/screen", data)
+          .build();
+    }
+
+    public void setSettings(Settings settings) {
+        this.settings = settings;
+    }
+}]]></programlisting>
+          <calloutlist>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.path1">
+              <para>The <literal>@javax.ws.rs.Path</literal> annotation identifies the URI path 
+                that this resource class or class method will serve requests for. The path is
+                relative to the mount point of the servlet-service that references this resource.
+              </para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.class">
+              <para>A JAX-RS root resource.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.method">
+              <para>The <literal>@javax.ws.rs.GET</literal> annotations indicates that
+              this method responds to HTTP GET requests.</para> 
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.path2">
+              <para>Again a <literal>@Path</literal> annotation, but this time at
+              method level. In this example requests for <literal>sample/parameter-passing/NNN</literal>
+              will be handled by the <literal>anotherService()</literal> method.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.param.id">
+              <para>The <literal>@PathParam</literal> annoation binds the URI template
+              value of <literal>id</literal> to the method parameter <literal>id</literal>.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.param.req">
+              <para>The <literal>@QueryParam</literal> annotation binds the request parameter
+              <literal>req-param</literal> to the method parameter <literal>reqParam</literal>.
+              </para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.param.uriinfo">
+              <para>By annotating the <literal>URIInfo</literal> method parameter with the 
+                <literal>@Context</literal> annotations, a current instance of <literal>URIInfo</literal>
+                is passed to the method.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.param.request">
+              <para>By annotating the <literal>Request</literal> method parameter with the 
+                <literal>@Context</literal> annotations, a current instance of <literal>Request</literal>
+                is passed to the method.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.data">
+              <para>A map of <literal>String/Object</literal> is collected.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.responsebuilder">
+              <para>The <literal>URLResponseBuilder</literal> sends the result of the
+                passed URL as response. It allows passing a map of <literal>String/Object</literal> 
+                which are available in the called resource (usually a pipeline).</para>
+              <para>In this case the <literal>servlet:</literal> protocol is used.
+                It allows accessing URLs (that usually expose pipelines) defined by other
+                Servlet-Services.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.resource.beansetter">
+              <para>A setter method to allow injecting the <literal>Setting</literal> bean.</para>
+            </callout>       
+          </calloutlist>
+          </programlistingco>        
+        </section>
+        
+        <section id="webapps.rest.jaxrs.sample.spring">
+          <title>JAX-RS resource as Spring bean</title>  
+          <para>This resource has to be configured as Spring bean:</para>
+          <programlistingco>
+          <areaspec>
+            <area id="webapps.rest.jaxrs.sample.bean.definition" coords="6" />
+          </areaspec>
+          <programlisting language="xml"><![CDATA[<beans xmlns="http://www.springframework.org/schema/beans" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans 
+    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+  <bean id="org.apache.cocoon.sample.rest.resource.one" 
+    class="org.apache.cocoon.sample.jaxrs.SampleRestResource">
+    <property name="settings" 
+      ref="org.apache.cocoon.configuration.Settings" />
+  </bean>
+
+</beans>]]></programlisting>
+          <calloutlist>
+            <callout arearefs="webapps.rest.jaxrs.sample.bean.definition">
+              <para>The <literal>SampleRestResource</literal> is a usual Spring bean and in this example it gets
+              the <literal>org.apache.cocoon.configuration.Settings</literal> bean injected.</para>
+            </callout>
+          </calloutlist>
+        </programlistingco>
+        </section>
+        
+        <section id="webapps.rest.jaxrs.sample.servlet-service">
+          <title>Servlet-Service integration</title>
+          <para>Finally the Spring bean has to be exposed by the <literal>CocoonJAXRSServlet</literal>:</para>   
+          <programlistingco>
+          <areaspec>
+            <area id="webapps.rest.jaxrs.sample.servlet-service.definition" coords="10" />
+            <area id="webapps.rest.jaxrs.sample.servlet-service.mount-path" coords="12" />
+            <area id="webapps.rest.jaxrs.sample.servlet-service.connections" coords="14" />
+            <area id="webapps.rest.jaxrs.sample.servlet-service.resources" coords="19" />
+          </areaspec>
+          <programlisting language="xml"><![CDATA[<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:servlet="http://cocoon.apache.org/schema/servlet"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans 
+    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+  http://cocoon.apache.org/schema/servlet 
+    http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd>
+  
+  <!-- A servlet-service that exposes JAX-RS REST endpoints. -->
+  <bean id="org.apache.cocoon.sample.rest.servlet" 
+    class="org.apache.cocoon.rest.jaxrs.container.CocoonJAXRSServlet">
+    <servlet:context mount-path="/jax-rs" 
+      context-path="blockcontext:/cocoon-sample/">
+      <servlet:connections>
+        <entry key="sample" value-ref="org.apache.cocoon.sample.servlet" />
+      </servlet:connections>      
+    </servlet:context>
+    
+    <property name="restResourcesList">
+      <list>
+        <ref bean="org.apache.cocoon.sample.rest.resource.one" />
+      </list>
+    </property>
+  </bean>
+</beans>]]></programlisting>
+          <calloutlist>
+            <callout arearefs="webapps.rest.jaxrs.sample.servlet-service.definition">
+              <para>The <literal>CocoonJAXRSServlet</literal> exposes REST resources.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.servlet-service.mount-path">
+              <para>The mount path of this Servlet-Service is <literal>/jax-rs</literal>.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.servlet-service.connections">
+              <para>Connections to other Servlet-Services.</para>
+            </callout>
+            <callout arearefs="webapps.rest.jaxrs.sample.servlet-service.resources">
+              <para>A list of JAX-RS resources, which also have to be Spring beans, is
+                exposed.</para>
+              <para>Alternativly a <literal>&lt;map&gt;</literal> of resources can be injected
+                by the <literal>restResourceMap</literal> property.</para>
+            </callout>
+          </calloutlist>
+          </programlistingco>
+        </section>
+      </section>
+    </section>
   </section>
 
   <section id="webapps.caching">

Modified: cocoon/cocoon3/trunk/cocoon-rest/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/pom.xml?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-rest/pom.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-rest/pom.xml Tue May  5 18:53:25 2009
@@ -50,6 +50,16 @@
       <artifactId>servlet-api</artifactId>
       <scope>provided</scope>
     </dependency>    
+
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency> 
+
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>

Added: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java?rev=771968&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java (added)
+++ cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java Tue May  5 18:53:25 2009
@@ -0,0 +1,117 @@
+/*
+ * 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.rest.jaxrs.container;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.util.ClassUtils;
+
+import com.sun.jersey.api.core.DefaultResourceConfig;
+import com.sun.jersey.api.core.ResourceConfig;
+import com.sun.jersey.spi.container.WebApplication;
+import com.sun.jersey.spi.container.servlet.ServletContainer;
+
+/**
+ * A {@link Servlet} that can be used in the Cocoon Servlet-Service framework. Extending the
+ * {@link ServletContainer} provided by Jersey it registers all passed REST resources (
+ * {@link #setRestResources(Map)} and {@link #setRestResourcesList(List)}.
+ */
+public class CocoonJAXRSServlet extends ServletContainer {
+
+    private static final long serialVersionUID = -8658985429213333769L;
+    private boolean lazyInit;
+    private final Log logger = LogFactory.getLog(this.getClass());
+    private ResourceConfig rc;
+    private List<Object> restResourcesList;
+    private Map<Object, Object> restResourcesMap;
+    private WebApplication wa;
+
+    @Override
+    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+        if (!this.lazyInit) {
+            this.lazyInitiate();
+        }
+
+        super.service(request, response);
+    }
+
+    public void setRestResourcesMap(Map<Object, Object> restResourcesMap) {
+        this.restResourcesMap = restResourcesMap;
+    }
+
+    public void setRestResourcesList(List<Object> restResourcesList) {
+        this.restResourcesList = restResourcesList;
+    }
+
+    @Override
+    protected ResourceConfig getDefaultResourceConfig(Map<String, Object> props, ServletConfig servletConfig)
+            throws ServletException {
+        DefaultResourceConfig rc = new DefaultResourceConfig();
+        rc.setPropertiesAndFeatures(props);
+        return rc;
+    }
+
+    @Override
+    protected void initiate(ResourceConfig rc, WebApplication wa) {
+        this.rc = rc;
+        this.wa = wa;
+    }
+
+    /*
+     * Only initialize this servlet once.
+     */
+    private synchronized void lazyInitiate() {
+        if (this.lazyInit) {
+            return;
+        }
+
+        List<Object> restResources = new ArrayList<Object>();
+        if (this.restResourcesMap != null) {
+            restResources.addAll(this.restResourcesMap.values());
+        }
+        if (this.restResourcesList != null) {
+            restResources.addAll(this.restResourcesList);
+        }
+
+        for (Object bean : restResources) {
+            Class<?> type = ClassUtils.getUserClass(bean);
+            if (ResourceConfig.isProviderClass(type)) {
+                this.logger.info("Registering Spring bean of type " + type.getName() + " as a provider class");
+                // this.rc.getClasses().add(type);
+                this.rc.getSingletons().add(bean);
+            } else if (ResourceConfig.isRootResourceClass(type)) {
+                this.logger.info("Registering Spring bean of type " + type.getName() + " as a root resource class");
+                // this.rc.getClasses().add(type);
+                this.rc.getSingletons().add(bean);
+            }
+        }
+
+        this.wa.initiate(this.rc);
+        this.lazyInit = true;
+    }
+}
\ No newline at end of file

Propchange: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/container/CocoonJAXRSServlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java?rev=771968&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java (added)
+++ cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java Tue May  5 18:53:25 2009
@@ -0,0 +1,132 @@
+/*
+ * 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.rest.jaxrs.response;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import org.apache.cocoon.callstack.environment.CallFrameHelper;
+import org.apache.cocoon.rest.jaxrs.container.CocoonJAXRSServlet;
+import org.apache.cocoon.servlet.controller.ControllerContextHelper;
+import org.apache.commons.io.IOUtils;
+
+/**
+ * A class to get a {@link ResponseBuilder} that has all information set correctly that is provided
+ * by a {@link URLConnection}. It must be used when the JAX-RS container runs within the Cocoon
+ * Servlet-Service framework.
+ * 
+ * @see CocoonJAXRSServlet
+ */
+public abstract class URLResponseBuilder extends ResponseBuilder {
+
+    /**
+     * The same as {@link #newInstance(URL)} but the URL is passed as {@link String}.
+     */
+    @SuppressWarnings("unchecked")
+    public static ResponseBuilder newInstance(final String url) {
+        return newInstance(url, Collections.EMPTY_MAP);
+    }
+
+    /**
+     * The same as {@link #newInstance(URL, Map)} but the URL is passed as {@link String}.
+     */
+    public static ResponseBuilder newInstance(final String url, final Map<String, Object> data) {
+        try {
+            return newInstance(new URL(url), data);
+        } catch (MalformedURLException e) {
+            throw new WebApplicationException(500);
+        }
+    }
+
+    /**
+     * The same as {@link #newInstance(URL, Map)} but no objects are passed to the URL.
+     */
+    @SuppressWarnings("unchecked")
+    public static ResponseBuilder newInstance(final URL url) {
+        return newInstance(url, Collections.EMPTY_MAP);
+    }
+
+    /**
+     * Create a {@link ResponseBuilder} that retrieves all available information (header parameters,
+     * Last-Modified, Content-Type) from the {@link URLConnection} opened on the passed {@link URL}.
+     * 
+     * @param url The {@link URL} that provides the content for the entity.
+     * @param data A {@link Map} of objects passed to the {@link URL}.
+     * @return A {@link ResponseBuilder}
+     */
+    public static ResponseBuilder newInstance(final URL url, final Map<String, Object> data) {
+        ResponseBuilder builder = ResponseBuilder.newInstance();
+        URLConnection urlConnection = null;
+
+        try {
+            urlConnection = url.openConnection();
+            if (urlConnection instanceof HttpURLConnection) {
+                HttpURLConnection httpUrlConnection = (HttpURLConnection) urlConnection;
+                HttpServletRequest request = CallFrameHelper.getRequest();
+                ControllerContextHelper.storeContext(data, request);
+
+                // content type
+                String contentType = httpUrlConnection.getContentType();
+                if (contentType != null && !"".equals(contentType) && !"content/unknown".equals(contentType)) {
+                    builder.type(contentType);
+                }
+
+                // headers
+                Map<String, List<String>> headerFields = httpUrlConnection.getHeaderFields();
+                for (Entry<String, List<String>> eachHeader : headerFields.entrySet()) {
+                    List<String> headerValueList = eachHeader.getValue();
+                    String value = null;
+                    if (!headerValueList.isEmpty()) {
+                        value = headerValueList.get(0);
+                    }
+                    builder.header(eachHeader.getKey(), value == null ? "" : value);
+                }
+
+                // status code
+                int statusCode = httpUrlConnection.getResponseCode();
+                builder.status(statusCode);
+
+                // last modified
+                long lastModified = urlConnection.getLastModified();
+                if (lastModified >= 0) {
+                    builder.lastModified(new Date(lastModified));
+                }
+
+                // entity
+                builder.entity(IOUtils.toString(httpUrlConnection.getInputStream()));
+
+                return builder;
+            }
+        } catch (IOException e) {
+            throw new WebApplicationException(e, 500);
+        }
+
+        throw new WebApplicationException(500);
+    }
+}

Propchange: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/jaxrs/response/URLResponseBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/ControllerTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/ControllerTest.java?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/ControllerTest.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/ControllerTest.java Tue May  5 18:53:25 2009
@@ -33,6 +33,6 @@
         this.assertXPath("/html/body/p[1]", "name=foo");
         this.assertXPath("/html/body/p[2]", "id=abc");
         this.assertXPath("/html/body/p[3]", "reqparam=1");
+        this.assertXPath("/html/body/p[4]", "testProperty=test");
     }
-
 }

Added: cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java?rev=771968&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java (added)
+++ cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java Tue May  5 18:53:25 2009
@@ -0,0 +1,75 @@
+/*
+ * 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.it;
+
+/**
+ * Test the usage of servlet services in Cocoon sitemaps.
+ */
+public class JAXRSTest extends CocoonHtmlUnitTestCase {
+
+    public void testDummy() {
+    }
+
+    // public void test401StatusCode() throws Exception {
+    // this.loadResponse("/jax-rs/sample/sax-pipeline/unauthorized");
+    // int statusCode = this.response.getStatusCode();
+    // assertTrue(statusCode == 401);
+    //
+    // String lastModified = this.response.getResponseHeaderValue("Last-Modified");
+    // assertNotNull(lastModified);
+    // assertFalse(lastModified.equals(""));
+    //
+    // String cocoonVersion = this.response.getResponseHeaderValue("X-Cocoon-Version");
+    // assertNotNull(cocoonVersion);
+    // assertFalse(cocoonVersion.equals(""));
+    // }
+    //
+    // public void test404() throws Exception {
+    // this.loadResponse("/jax-rs/sample/not-exisiting");
+    // int statusCode = this.response.getStatusCode();
+    // assertTrue(statusCode == 404);
+    // }
+    //
+    // public void testPassingParameters() throws Exception {
+    // this.loadXmlPage("/jax-rs/sample/parameter-passing/1?req-param=1");
+    // int statusCode = this.response.getStatusCode();
+    // assertTrue(statusCode == 200);
+    // assertEquals("text/xml", this.response.getContentType());
+    //
+    // this.assertXPath("/html/body/p[1]", "name=Donald Duck");
+    // this.assertXPath("/html/body/p[2]", "id=1");
+    // this.assertXPath("/html/body/p[3]", "reqparam=1");
+    // this.assertXPath("/html/body/p[4]", "testProperty=test");
+    // }
+    //
+    // public void testAnotherResource() throws Exception {
+    // this.loadResponse("jax-rs/sample2/read/javascript-resource-implicit.js");
+    // assertTrue(this.response.getStatusCode() == 200);
+    // assertEquals(this.response.getContentType(), "application/x-javascript");
+    // }
+    //
+    // public void testConditionalGet() throws Exception {
+    // this.loadResponse("jax-rs/sample2/read/javascript-resource-implicit.js");
+    // String lastModified = this.response.getResponseHeaderValue("Last-Modified");
+    // assertNotNull("Last-Modified has to be set at this point!", lastModified);
+    // assertFalse("Last-Modified has to be set at this point!", "".equals(lastModified));
+    //
+    // this.webClient.addRequestHeader("If-Modified-Since", lastModified);
+    // this.loadResponse("read/javascript-resource-implicit.js");
+    // assertEquals(304, this.response.getStatusCode());
+    // }
+}

Propchange: cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/JAXRSTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/SaxPipelineTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/SaxPipelineTest.java?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/SaxPipelineTest.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample-webapp/src/test/java/org/apache/cocoon/it/SaxPipelineTest.java Tue May  5 18:53:25 2009
@@ -32,8 +32,8 @@
     }
 
     /**
-     * A simple pipeline that produces an XHTML 1.0 document. This implicitly tests if the configuration of serializers
-     * works properly.
+     * A simple pipeline that produces an XHTML 1.0 document. This implicitly tests if the
+     * configuration of serializers works properly.
      */
     public void testSimplePipelineXhtml() throws Exception {
         this.loadResponse("/sax-pipeline/simple-xhtml");
@@ -63,5 +63,4 @@
         assertNotNull(lastModified);
         assertFalse(lastModified.equals(""));
     }
-
 }

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/controller/DemoRESTController.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/controller/DemoRESTController.java?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/controller/DemoRESTController.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/controller/DemoRESTController.java Tue May  5 18:53:25 2009
@@ -19,12 +19,14 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.rest.controller.annotation.RESTController;
 import org.apache.cocoon.rest.controller.annotation.RequestParameter;
 import org.apache.cocoon.rest.controller.annotation.SitemapParameter;
 import org.apache.cocoon.rest.controller.method.Get;
 import org.apache.cocoon.rest.controller.response.RestResponse;
 import org.apache.cocoon.rest.controller.response.URLResponse;
+import org.springframework.beans.factory.annotation.Autowired;
 
 @RESTController
 public class DemoRESTController implements Get {
@@ -38,11 +40,15 @@
     @RequestParameter
     private String reqparam;
 
+    @Autowired
+    private Settings settings;
+
     public RestResponse doGet() throws Exception {
         Map<String, Object> data = new HashMap<String, Object>();
         data.put("id", this.id);
         data.put("name", this.name);
         data.put("reqparam", this.reqparam);
+        data.put("testProperty", this.settings.getProperty("testProperty"));
 
         return new URLResponse("servlet:/controller/screen", data);
     }

Added: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java?rev=771968&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java (added)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java Tue May  5 18:53:25 2009
@@ -0,0 +1,61 @@
+/*
+ * 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.sample.jaxrs;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.cocoon.configuration.Settings;
+import org.apache.cocoon.rest.jaxrs.response.URLResponseBuilder;
+
+@Path("/sample")
+public class SampleJaxRsResource1 {
+
+    private Settings settings;
+
+    @GET
+    @Path("/parameter-passing/{id}")
+    public Response anotherService(@PathParam("id") String id, @QueryParam("req-param") String reqParam,
+            @Context UriInfo uriInfo, @Context Request request) {
+        Map<String, Object> data = new HashMap<String, Object>();
+        data.put("name", "Donald Duck");
+        data.put("id", id);
+        data.put("reqparam", reqParam);
+        data.put("testProperty", this.settings.getProperty("testProperty"));
+
+        return URLResponseBuilder.newInstance("servlet:sample:/controller/screen", data).build();
+    }
+
+    @GET
+    @Path("/sax-pipeline/unauthorized")
+    public Response saxPipelineUnauthorized() {
+        return URLResponseBuilder.newInstance("servlet:sample:/sax-pipeline/unauthorized").build();
+    }
+
+    public void setSettings(Settings settings) {
+        this.settings = settings;
+    }
+}

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource1.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java?rev=771968&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java (added)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java Tue May  5 18:53:25 2009
@@ -0,0 +1,33 @@
+/*
+ * 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.sample.jaxrs;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+import org.apache.cocoon.rest.jaxrs.response.URLResponseBuilder;
+
+@Path("/sample2")
+public class SampleJaxRsResource2 {
+
+    @GET
+    @Path("/read/javascript-resource-implicit.js")
+    public Response conditionalGet() {
+        return URLResponseBuilder.newInstance("servlet:sample:/read/javascript-resource-implicit.js").build();
+    }
+}

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/jaxrs/SampleJaxRsResource2.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/controller/demo.html
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/controller/demo.html?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/controller/demo.html (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/controller/demo.html Tue May  5 18:53:25 2009
@@ -19,12 +19,13 @@
  -->
 <html>
   <head>
-    <title>RESTController demo</title>
+    <title>REST demo</title>
   </head>
   <body>
-    <h3>RESTController demo</h3>
+    <h3>REST demo</h3>
     <p>name=$name$</p>
     <p>id=$id$</p>
     <p>reqparam=$reqparam$</p>
+    <p>testProperty=$testProperty$</p>
   </body>
 </html>

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/overview.html
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/overview.html?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/overview.html (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/overview.html Tue May  5 18:53:25 2009
@@ -97,10 +97,14 @@
   <ul>
     <li><a href="xslt/main">XSLT Transformation</a>: An XSLT transformation that includes stylesheets via file and servlet protocol.</li>
   </ul>
-  <h2>Controller</h2>
+  <h2>Sitemap REST Controller</h2>
   <ul>
     <li><a href="controller/abc/foo?reqparam=1">Invoke a controller</a>: Invoke a controller and pass two parameters</li>
   </ul>
+  <h2>JAX-RS REST Controller</h2>
+  <ul>
+    <li><a href="jax-rs/sample/parameter-passing/5?req-param=7">JAX-RS REST endpoint</a>: A JAX-RS resources as a controller that returns a Cocoon resources.</li>
+  </ul>
   <h2>FOP</h2>
   <ul>
   	<li><a href="fop/test.pdf">PDF</a>: Create a PDF document by using Apache FOP.</li>

Added: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties?rev=771968&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties (added)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties Tue May  5 18:53:25 2009
@@ -0,0 +1,16 @@
+# 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.
+
+testProperty=test
\ No newline at end of file

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/properties/cocoon-sample.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-jaxrs.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-jaxrs.xml?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-jaxrs.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-jaxrs.xml Tue May  5 18:53:25 2009
@@ -21,10 +21,8 @@
 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 
-  <!-- 
-  <bean id="org.apache.cocoon.sample.rest.resource.one" class="org.apache.cocoon.sample.jaxrs.SampleRestResource">
+  <bean id="org.apache.cocoon.sample.rest.resource.one" class="org.apache.cocoon.sample.jaxrs.SampleJaxRsResource1">
     <property name="settings" ref="org.apache.cocoon.configuration.Settings" />
   </bean>
-  <bean id="org.apache.cocoon.sample.rest.resource.two" class="org.apache.cocoon.sample.jaxrs.Sample2RestResource" />
-  -->
+  <bean id="org.apache.cocoon.sample.rest.resource.two" class="org.apache.cocoon.sample.jaxrs.SampleJaxRsResource2" />
 </beans>

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-servlet-service.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-servlet-service.xml?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-servlet-service.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/META-INF/cocoon/spring/cocoon-sample-servlet-service.xml Tue May  5 18:53:25 2009
@@ -32,7 +32,6 @@
   </bean>
   
   <!-- A servlet-service that exposes JAX-RS REST endpoints. -->
-  <!-- 
   <bean id="org.apache.cocoon.sample.rest.servlet" class="org.apache.cocoon.rest.jaxrs.container.CocoonJAXRSServlet">
     <servlet:context mount-path="/jax-rs" context-path="blockcontext:/cocoon-sample/">
       <servlet:connections>
@@ -47,5 +46,4 @@
       </list>
     </property>
   </bean>
-  -->
 </beans>

Modified: cocoon/cocoon3/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/parent/pom.xml?rev=771968&r1=771967&r2=771968&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/parent/pom.xml (original)
+++ cocoon/cocoon3/trunk/parent/pom.xml Tue May  5 18:53:25 2009
@@ -186,6 +186,16 @@
 
       <!-- Other libraries -->
       <dependency>
+        <groupId>com.sun.jersey</groupId>
+        <artifactId>jersey-core</artifactId>
+        <version>1.0.3</version>
+      </dependency>
+      <dependency>
+        <groupId>com.sun.jersey</groupId>
+        <artifactId>jersey-server</artifactId>
+        <version>1.0.3</version>
+      </dependency>       
+      <dependency>
         <groupId>commons-betwixt</groupId>
         <artifactId>commons-betwixt</artifactId>
         <version>0.8</version>
@@ -355,6 +365,14 @@
     </dependencies>
   </dependencyManagement>
 
+  <repositories>
+    <repository>
+      <id>maven2-repository.dev.java.net</id>
+      <name>Java.net Repository for Maven</name>
+      <url>http://download.java.net/maven/2/</url>
+    </repository> 
+  </repositories>
+
   <build>
     <plugins>
       <plugin>
@@ -715,22 +733,22 @@
           <dependency>
             <groupId>org.apache.cocoon</groupId>
             <artifactId>cocoon-servlet-service-impl</artifactId>
-            <version>1.2.0-SNAPSHOT</version>
+            <version>1.3.0-SNAPSHOT</version>
           </dependency>
           <dependency>
             <groupId>org.apache.cocoon</groupId>
             <artifactId>cocoon-spring-configurator</artifactId>
-            <version>2.1.0-SNAPSHOT</version>
+            <version>2.2.0-SNAPSHOT</version>
           </dependency>
           <dependency>
             <groupId>org.apache.cocoon</groupId>
             <artifactId>cocoon-block-deployment</artifactId>
-            <version>1.1.0-SNAPSHOT</version>
+            <version>1.2.0-SNAPSHOT</version>
           </dependency>
           <dependency>
             <groupId>org.apache.cocoon</groupId>
             <artifactId>cocoon-jnet</artifactId>
-            <version>1.1.0-SNAPSHOT</version>
+            <version>1.2.0-SNAPSHOT</version>
           </dependency>
         </dependencies>
       </dependencyManagement>



Mime
View raw message