Permalink
Browse files

Updating C3 demo at cocoon.zones.apache.org with latest enhancements

git-svn-id: https://svn.apache.org/repos/asf/cocoon/trunk@1450268 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent ff97b17 commit 860f22a81015f4de335a43bfee69bc733a076549 @ilgrosso ilgrosso committed Feb 26, 2013
View
@@ -86,7 +86,42 @@
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
- <version>1.0</version>
+ <version>1.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.avalon.framework</groupId>
+ <artifactId>avalon-framework-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.avalon.framework</groupId>
+ <artifactId>avalon-framework-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.avalon.framework</groupId>
+ <artifactId>avalon-framework-api</artifactId>
+ <version>4.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.avalon.framework</groupId>
+ <artifactId>avalon-framework-impl</artifactId>
+ <version>4.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.4.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
@@ -96,18 +131,18 @@
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
- <version>1.14</version>
+ <version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
- <version>1.14</version>
+ <version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- <version>1.14</version>
- </dependency>
+ <artifactId>jersey-bundle</artifactId>
+ <version>1.17</version>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
@@ -116,12 +151,12 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <version>1.0.7</version>
+ <version>1.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.7</version>
+ <version>1.0.9</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -137,7 +172,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.10</version>
+ <version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -162,7 +197,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.11</version>
+ <version>2.13</version>
<configuration>
<excludes>
<exclude>**/cocoon/**</exclude>
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2012 Tirasa
- *
- * Licensed 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.classpath;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-
-public class ClasspathURLStreamHandlerFactory implements URLStreamHandlerFactory {
-
- /**
- * {@inheritDoc}
- *
- * @see java.net.URLStreamHandlerFactory#createURLStreamHandler(java.lang.String)
- */
- @Override
- public URLStreamHandler createURLStreamHandler(final String protocol) {
- return "classpath".equalsIgnoreCase(protocol)
- ? new ClasspathURLStreamHandler()
- : null;
- }
-
- public class ClasspathURLStreamHandler extends URLStreamHandler {
-
- @Override
- protected URLConnection openConnection(final URL url)
- throws IOException {
-
- final URL resourceUrl = Thread.currentThread().getContextClassLoader().getResource(url.getPath());
- if (resourceUrl == null) {
- throw new FileNotFoundException(url.toExternalForm());
- }
-
- return resourceUrl.openConnection();
- }
- }
-}
@@ -47,6 +47,7 @@
<li><a href="sax-pipeline/simple">SAX Pipeline</a>: Simplest possible pipeline that has a generator, transformer and serializer.</li>
<li><a href="sax-pipeline/simple-xhtml">SAX Pipeline</a>: Same as before but creates XHTML as output format.</li>
<li><a href="sax-pipeline/simple-xml">SAX Pipeline</a>: Same as before but creates XML as output format.</li>
+ <li><a href="sax-pipeline/simple-txt">SAX Pipeline</a>: Same as before but creates TXT as output format</li>
<li><a href="sax-pipeline/simple-xsd">SAX Pipeline</a>: Same as before but creates XML as output format after validating the input.</li>
<li><a href="sax-pipeline/unauthorized">Status code</a>: Set status code '401' at pipeline.</li>
</ul>
@@ -172,6 +173,13 @@
<li><a href="fop/test.pdf">PDF</a>: Create a PDF document by using Apache FOP.</li>
</ul>
</section>
+ <section id="json">
+ <h2>JSON</h2>
+ <ul>
+ <li><a href="json/xml2json">JSON</a>: Serialize pipeline to JSON string.</li>
+ <li><a href="json/json2xml">JSON</a>: Generate SAX events from JSON string.</li>
+ </ul>
+ </section>
<section id="encoding-serializers">
<h2>Encoding Serializers</h2>
<ul>
@@ -197,7 +205,7 @@
<nav>
<ul>
<li><a href="#map-read" target="_self">map:read</a></li>
- <li><a href="#sax-pipelines" target="_self">Sax Pipelines</a></li>
+ <li><a href="#sax-pipelines" target="_self">SAX Pipelines</a></li>
<li><a href="#stax-pipelines" target="_self">StAX Pipelines</a></li>
<li><a href="#caching" target="_self">Caching</a></li>
<li><a href="#error-handling" target="_self">Error handling</a></li>
@@ -212,7 +220,8 @@
<li><a href="#xslt" target="_self">XSLT</a></li>
<li><a href="#sitemap-rest-controller" target="_self">Sitemap REST Controller</a></li>
<li><a href="#jaxrs-rest-controller" target="_self">JAX-RS REST Controller</a></li>
- <li><a href="#fop" target="_self">fop</a></li>
+ <li><a href="#fop" target="_self">FOP</a></li>
+ <li><a href="#json" target="_self">JSON</a></li>
<li><a href="#encoding-serializers" target="_self">Encoding Serializers</a></li>
<li><a href="#cocoon-wicket-integration" target="_self">Cocoon-Wicket integration</a></li>
<li><a href="#stringtemplate" target="_self">StringTemplate</a></li>
@@ -10,13 +10,13 @@
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.
- -->
+ 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$ -->
<map:sitemap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:map="http://apache.org/cocoon/sitemap"
xmlns:servlet="http://apache.org/cocoon/servlet" xmlns:controller="http://apache.org/cocoon/controller">
@@ -48,7 +48,7 @@
</map:pipeline>
<!-- ~~~~~~~~~~~~~~~~ sax pipelines ~~~~~~~~~~~~~~~ -->
- <map:pipeline jmx-group-name="sax">
+ <map:pipeline jmx-group-name="sax" type="noncaching">
<map:match equals="sax-pipeline/simple">
<map:generate src="sax-pipeline/simple.xml" />
<map:transform src="sax-pipeline/simple.xslt">
@@ -80,6 +80,13 @@
</map:transform>
<map:serialize type="xml" />
</map:match>
+ <map:match pattern="sax-pipeline/simple-txt">
+ <map:generate src="sax-pipeline/simple.xml" />
+ <map:transform src="sax-pipeline/simple.xslt">
+ <map:parameter name="myParam" value="3-{jexl:cocoon.request.ssf}" />
+ </map:transform>
+ <map:serialize type="txt" />
+ </map:match>
<map:match equals="sax-pipeline/simple-xsd">
<map:generate src="sax-pipeline/simple.xml" />
<map:transform type="schema" src="sax-pipeline/simple.xsd" />
@@ -233,7 +240,7 @@
</map:pipeline>
<!-- ~~~~~~~~~~~~~~~~ advanced matching (when/otherwise) ~~~~~~~~~~~~~~~ -->
- <map:pipeline>
+ <map:pipeline type="noncaching">
<map:match pattern="advanced-matching">
<map:select value="{jexl:cocoon.request.myparam}">
<map:when equals="11">
@@ -386,7 +393,9 @@
</map:match>
<map:match equals="aggregation/xinclude-transformer">
<map:generate src="aggregation/xinclude.xml" />
- <map:transform type="xinclude" />
+ <map:transform type="xinclude">
+ <map:parameter name="cacheKey" value="{map:0}"/>
+ </map:transform>
<map:serialize type="xml" />
</map:match>
<map:match equals="aggregation/sub-request">
@@ -560,6 +569,21 @@
</map:match>
</map:pipeline>
+ <!-- JSON -->
+ <map:pipeline>
+ <map:match equals="json/xml2json">
+ <map:generate src="sax-pipeline/simple.xml" />
+ <map:transform src="sax-pipeline/simple.xslt">
+ <map:parameter name="myParam" value="1" />
+ </map:transform>
+ <map:serialize type="json"/>
+ </map:match>
+ <map:match equals="json/json2xml">
+ <map:generate type="json" src="servlet:/json/xml2json" />
+ <map:serialize/>
+ </map:match>
+ </map:pipeline>
+
<!-- Cocoon Wicket integration -->
<map:pipeline type="noncaching">
<map:match wildcard="wicket/**">
@@ -10,32 +10,38 @@
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.
- -->
+ 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
- ">
+<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.xsd
+ http://www.springframework.org/schema/aop
+ http://www.springframework.org/schema/aop/spring-aop.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Scan for all REST controllers and make them as beans available -->
<context:component-scan base-package="org.apache.cocoon.sample.controller" use-default-filters="false"
- name-generator="org.apache.cocoon.rest.controller.ControllerBeanNameGenerator"
- scope-resolver="org.apache.cocoon.rest.controller.ControllerBeanScopeResolver">
- <context:include-filter type="annotation" expression="org.apache.cocoon.rest.controller.annotation.RESTController" />
+ name-generator="org.apache.cocoon.rest.controller.ControllerBeanNameGenerator"
+ scope-resolver="org.apache.cocoon.rest.controller.ControllerBeanScopeResolver">
+ <context:include-filter type="annotation"
+ expression="org.apache.cocoon.rest.controller.annotation.RESTController" />
</context:component-scan>
<context:annotation-config />
- <bean id="org.apache.cocoon.sample.controller.aspect1" class="org.apache.cocoon.sample.controller.DemoRESTControllerAspect1" />
- <bean id="org.apache.cocoon.sample.controller.aspect2" class="org.apache.cocoon.sample.controller.DemoRESTControllerAspect2" />
+ <bean id="org.apache.cocoon.sample.controller.aspect1"
+ class="org.apache.cocoon.sample.controller.DemoRESTControllerAspect1" />
+ <bean id="org.apache.cocoon.sample.controller.aspect2"
+ class="org.apache.cocoon.sample.controller.DemoRESTControllerAspect2" />
</beans>
@@ -10,16 +10,18 @@
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.
- -->
+ 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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+<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.xsd">
<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" />
Oops, something went wrong.

0 comments on commit 860f22a

Please sign in to comment.