[1/2] git commit: CAMEL-7354: Rest DSL. Integrate with camel-servlet.
Repository: camel Updated Branches: refs/heads/master 4cbc22b24 - c5adfe634 CAMEL-7354: Rest DSL. Integrate with camel-servlet. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c5adfe63 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c5adfe63 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c5adfe63 Branch: refs/heads/master Commit: c5adfe634404f314c61687f2953eb2ba2326b9b0 Parents: a5cecf8 Author: Claus Ibsen davscl...@apache.org Authored: Mon Jul 28 20:58:12 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 08:08:58 2014 +0200 -- .../processor/binding/RestBindingProcessor.java | 39 ++-- .../README.txt | 32 +++ .../camel-example-servlet-rest-tomcat/pom.xml | 84 .../org/apache/camel/example/rest/User.java | 47 + .../camel/example/rest/UserRouteBuilder.java| 49 + .../apache/camel/example/rest/UserService.java | 64 ++ .../src/main/resources/META-INF/LICENSE.txt | 203 +++ .../src/main/resources/META-INF/NOTICE.txt | 11 + .../src/main/resources/camel-config.xml | 36 .../src/main/resources/log4j.properties | 28 +++ .../src/main/webapp/WEB-INF/web.xml | 49 + .../src/main/webapp/index.html | 66 ++ .../camel-example-spark-rest-tomcat/README.txt | 10 +- .../src/main/webapp/index.html | 6 +- examples/pom.xml| 1 + parent/pom.xml | 5 + 16 files changed, 704 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/c5adfe63/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java -- diff --git a/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java index 0ae78d8..03fea60 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/processor/binding/RestBindingProcessor.java @@ -105,12 +105,6 @@ public class RestBindingProcessor extends ServiceSupport implements AsyncProcess return true; } -// is the body empty -if (exchange.getIn().getBody() == null) { -callback.done(true); -return true; -} - boolean isXml = false; boolean isJson = false; @@ -137,20 +131,24 @@ public class RestBindingProcessor extends ServiceSupport implements AsyncProcess isJson = bindingMode.equals(auto) || bindingMode.contains(json); } -// okay we have a binding mode, so need to check for empty body as that can cause the marshaller to fail -// as they assume a non-empty body String body = null; -if (isXml || isJson) { -// we have binding enabled, so we need to know if there body is empty or not\ -// so force reading the body as a String which we can work with -body = MessageHelper.extractBodyAsString(exchange.getIn()); -if (body != null) { -exchange.getIn().setBody(body); - -if (isXml isJson) { -// we have still not determined between xml or json, so check the body if its xml based or not -isXml = body.startsWith(); -isJson = !isXml; + +if (exchange.getIn().getBody() != null) { + + // okay we have a binding mode, so need to check for empty body as that can cause the marshaller to fail +// as they assume a non-empty body +if (isXml || isJson) { +// we have binding enabled, so we need to know if there body is empty or not\ +// so force reading the body as a String which we can work with +body = MessageHelper.extractBodyAsString(exchange.getIn()); +if (body != null) { +exchange.getIn().setBody(body); + +if (isXml isJson) { +// we have still not determined between xml or json, so check the body if its xml based or not +isXml = body.startsWith(); +isJson = !isXml; +} } } } @@ -178,6 +176,7 @@ public class RestBindingProcessor extends ServiceSupport implements AsyncProcess // we could not bind if (bindingMode.equals(auto)) { // okay for auto we do not mind if we could not bind +
[2/2] git commit: Merge branch 'netty' of https://github.com/ssogabe/camel
Merge branch 'netty' of https://github.com/ssogabe/camel Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e79c3aea Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e79c3aea Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e79c3aea Branch: refs/heads/master Commit: e79c3aeac588845270b847535141b282a3317e89 Parents: c5adfe6 1af2b8c Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 08:48:45 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 08:48:45 2014 +0200 -- .../apache/camel/component/netty/ClientPipelineFactory.java| 2 +- .../apache/camel/component/netty/ServerPipelineFactory.java| 6 +++--- .../camel/component/netty/handlers/ServerChannelHandler.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) --
[2/2] git commit: Fixed some java doc typos of camel-netty4
Fixed some java doc typos of camel-netty4 Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d58fd110 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d58fd110 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d58fd110 Branch: refs/heads/master Commit: d58fd1107cd1c165e94d9883c449e51a5750869e Parents: 167232d Author: Willem Jiang willem.ji...@gmail.com Authored: Tue Jul 29 15:08:34 2014 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Tue Jul 29 15:08:43 2014 +0800 -- .../org/apache/camel/component/netty4/ClientPipelineFactory.java | 2 +- .../org/apache/camel/component/netty4/ServerPipelineFactory.java | 4 ++-- .../camel/component/netty4/handlers/ServerChannelHandler.java| 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d58fd110/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientPipelineFactory.java -- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientPipelineFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientPipelineFactory.java index 415ecfe..318c6eb 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientPipelineFactory.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ClientPipelineFactory.java @@ -35,7 +35,7 @@ public abstract class ClientPipelineFactory extends ChannelInitializerChannel * Creates a new {@link ClientPipelineFactory} using the given {@link NettyProducer} * * @param producer the associated producers - * @return the {@link ClientPipelineFactory} associated to ghe given producer. + * @return the {@link ClientPipelineFactory} associated to the given producer. */ public abstract ClientPipelineFactory createPipelineFactory(NettyProducer producer); http://git-wip-us.apache.org/repos/asf/camel/blob/d58fd110/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerPipelineFactory.java -- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerPipelineFactory.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerPipelineFactory.java index 901c298..9d731e0 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerPipelineFactory.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ServerPipelineFactory.java @@ -33,10 +33,10 @@ import io.netty.channel.ChannelPipeline; public abstract class ServerPipelineFactory extends ChannelInitializerChannel { /** - * Creates a new {@link ClientPipelineFactory} using the given {@link NettyConsumer} + * Creates a new {@link ServerPipelineFactory} using the given {@link NettyConsumer} * * @param consumer the associated consumer - * @return the {@link ClientPipelineFactory} associated to ghe given consumer. + * @return the {@link ServerPipelineFactory} associated to the given consumer. */ public abstract ServerPipelineFactory createPipelineFactory(NettyConsumer consumer); http://git-wip-us.apache.org/repos/asf/camel/blob/d58fd110/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ServerChannelHandler.java -- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ServerChannelHandler.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ServerChannelHandler.java index a03a99e..0bb93fc 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ServerChannelHandler.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ServerChannelHandler.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Client handler which cannot be shared + * Server handler which cannot be shared */ public class ServerChannelHandler extends SimpleChannelInboundHandlerObject { // use NettyConsumer as logger to make it easier to read the logs as this is part of the consumer
[CONF] Apache Camel Rest DSL
Claus Ibsen edited the page: Rest DSL ... The following Camel components supports the Rest DSL. See the bottom of this page for how to integrate a component with the Rest DSL. camel-netty-http camel-jetty camel-restlet camel-servlet camel-spark-rest Rest DSL with Java To use the Rest DSL in Java then just do as with regular Camel routes by extending theRouteBuilder and define the routes in theconfigure method. ... Any Apache Camel component can integrate with the Rest DSL if they can be used as a REST service (eg as a REST consumer in Camel lingo). To integrate with the Rest DSL, then the component should implement theorg.apache.camel.spi.RestConsumerFactory. The Rest DSL will then invoke thecreateConsumer method when it setup the Camel routes from the defined DSL. The component should then implement logic to create a Camel consumer that exposes the REST services based on the given parameters, such as path, verb, and other options. For example see the source code for camel-restlet, camel-spark-rest. See Also DSL Rest Restlet Spark-rest View Online Like View Changes Stop watching space Manage Notifications This message was sent by Atlassian Confluence 5.0.3, Team Collaboration Software
[2/2] git commit: CAMEL-7354: Rest DSL. Integrate with camel-netty-http.
CAMEL-7354: Rest DSL. Integrate with camel-netty-http. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/248f8cd7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/248f8cd7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/248f8cd7 Branch: refs/heads/master Commit: 248f8cd74885521abe8e8f0456a4323d2733a79b Parents: d58fd11 Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 09:08:24 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 10:12:10 2014 +0200 -- .../netty/http/DefaultContextPathMatcher.java | 4 + .../netty/http/NettyHttpComponent.java | 86 -- .../netty/http/RestContextPathMatcher.java | 95 .../netty/http/RestNettyHttpBinding.java| 91 +++ .../HttpServerMultiplexChannelHandler.java | 9 +- .../netty/http/rest/RestNettyHttpGetTest.java | 56 6 files changed, 331 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/248f8cd7/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultContextPathMatcher.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultContextPathMatcher.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultContextPathMatcher.java index 55bfb58..2efc357 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultContextPathMatcher.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultContextPathMatcher.java @@ -42,6 +42,10 @@ public class DefaultContextPathMatcher implements ContextPathMatcher { } } +public String getPath() { +return path; +} + @Override public boolean equals(Object o) { if (this == o) { http://git-wip-us.apache.org/repos/asf/camel/blob/248f8cd7/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java -- diff --git a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java index 3732454..90f09f1 100644 --- a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java +++ b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpComponent.java @@ -18,15 +18,22 @@ package org.apache.camel.component.netty.http; import java.net.URI; import java.util.HashMap; +import java.util.Locale; import java.util.Map; +import org.apache.camel.CamelContext; +import org.apache.camel.Consumer; import org.apache.camel.Endpoint; +import org.apache.camel.Processor; import org.apache.camel.component.netty.NettyComponent; import org.apache.camel.component.netty.NettyConfiguration; import org.apache.camel.component.netty.NettyServerBootstrapConfiguration; import org.apache.camel.component.netty.http.handlers.HttpServerMultiplexChannelHandler; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategyAware; +import org.apache.camel.spi.RestConfiguration; +import org.apache.camel.spi.RestConsumerFactory; +import org.apache.camel.util.FileUtil; import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.ServiceHelper; import org.apache.camel.util.URISupport; @@ -37,7 +44,7 @@ import org.slf4j.LoggerFactory; /** * Netty HTTP based component. */ -public class NettyHttpComponent extends NettyComponent implements HeaderFilterStrategyAware { +public class NettyHttpComponent extends NettyComponent implements HeaderFilterStrategyAware, RestConsumerFactory { private static final Logger LOG = LoggerFactory.getLogger(NettyHttpComponent.class); @@ -53,7 +60,8 @@ public class NettyHttpComponent extends NettyComponent implements HeaderFilterSt super(NettyHttpEndpoint.class); setConfiguration(new NettyHttpConfiguration()); setHeaderFilterStrategy(new NettyHttpHeaderFilterStrategy()); -setNettyHttpBinding(new DefaultNettyHttpBinding(getHeaderFilterStrategy())); +// use the binding that supports Rest DSL +setNettyHttpBinding(new RestNettyHttpBinding(getHeaderFilterStrategy())); } @Override @@ -102,12 +110,16 @@ public class NettyHttpComponent extends NettyComponent implements HeaderFilterSt NettyHttpEndpoint answer = new NettyHttpEndpoint(addressUri, this, config);
svn commit: r917775 - in /websites/production/camel/content: cache/main.pageCache rest-dsl.html
Author: buildbot Date: Tue Jul 29 08:18:32 2014 New Revision: 917775 Log: Production update by buildbot for camel Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/rest-dsl.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/rest-dsl.html == --- websites/production/camel/content/rest-dsl.html (original) +++ websites/production/camel/content/rest-dsl.html Tue Jul 29 08:18:32 2014 @@ -84,7 +84,7 @@ tbody tr td valign=top width=100% -div class=wiki-content maincontenth2 id=RestDSL-RestDSLRest DSL/h2pstrongAvailable as of Camel 2.14/strong/ppApache Camel offers a REST styled DSL which can be used with Java or XML. The intention is to allow end users to define REST services using a REST style with verbs such as get, post, delete etc./ph4 id=RestDSL-HowitworksHow it works/h4pThe Rest DSL is a facade that builds a shape=rect href=rest.htmlRest/a#160;endpoints as consumers for Camel routes. The actual REST transport is leveraged by using Camel REST components such as#160;a shape=rect href=restlet.htmlRestlet/a,#160;a shape=rect href=spark-rest.htmlSpark-rest/a, and others that has native REST integration./ph3 id=RestDSL-ComponentssupportingRestDSLComponents supporting Rest DSL/h3pThe following Camel components supports the Rest DSL. See the bottom of this page for how to integrate a component with the Rest DSL./pullicamel-jetty/lilicamel-res tlet/lilicamel-servlet/lilicamel-spark-rest/li/ulh3 id=RestDSL-RestDSLwithJavaRest DSL with Java/h3pTo use the Rest DSL in Java then just do as with regular Camel routes by extending the#160;codeRouteBuilder/code and define the routes in the#160;codeconfigure/code method./ppA simple REST service can be define as follows, where we use rest() to define the services as shown below:/pdiv class=code panel pdl style=border-width: 1px;div class=codeContent panelContent pdl +div class=wiki-content maincontenth2 id=RestDSL-RestDSLRest DSL/h2pstrongAvailable as of Camel 2.14/strong/ppApache Camel offers a REST styled DSL which can be used with Java or XML. The intention is to allow end users to define REST services using a REST style with verbs such as get, post, delete etc./ph4 id=RestDSL-HowitworksHow it works/h4pThe Rest DSL is a facade that builds a shape=rect href=rest.htmlRest/a#160;endpoints as consumers for Camel routes. The actual REST transport is leveraged by using Camel REST components such as#160;a shape=rect href=restlet.htmlRestlet/a,#160;a shape=rect href=spark-rest.htmlSpark-rest/a, and others that has native REST integration./ph3 id=RestDSL-ComponentssupportingRestDSLComponents supporting Rest DSL/h3pThe following Camel components supports the Rest DSL. See the bottom of this page for how to integrate a component with the Rest DSL./pullia shape=rect href=netty-h ttp.htmlcamel-netty-http/a/lilia shape=rect href=jetty.htmlcamel-jetty/a/lilia shape=rect href=restlet.htmlcamel-restlet/a/lilia shape=rect href=servlet.htmlcamel-servlet/a/lilia shape=rect href=spark-rest.htmlcamel-spark-rest/a/li/ulh3 id=RestDSL-RestDSLwithJavaRest DSL with Java/h3pTo use the Rest DSL in Java then just do as with regular Camel routes by extending the#160;codeRouteBuilder/code and define the routes in the#160;codeconfigure/code method./ppA simple REST service can be define as follows, where we use rest() to define the services as shown below:/pdiv class=code panel pdl style=border-width: 1px;div class=codeContent panelContent pdl script class=theme: Default; brush: java; gutter: false type=syntaxhighlighter![CDATA[protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override @@ -240,7 +240,7 @@ public class UserPojo { script class=theme: Default; brush: java; gutter: false type=syntaxhighlighter![CDATA[restConfiguration().component(quot;spark-restquot;).port(9091).componentProperty(quot;fooquot;, quot;123quot;);]]/script /div/divpspan style=line-height: 1.4285715;br clear=none/span/ppspan style=line-height: 1.4285715;And with XML DSL/span/pdiv class=code panel pdl style=border-width: 1px;div class=codeContent panelContent pdl script class=theme: Default; brush: java; gutter: false type=syntaxhighlighter![CDATA[lt;restConfiguration component=quot;spark-restquot; port=quot;9091quot;gt; lt;componentProperty key=quot;fooquot; value=quot;123quot;/gt; lt;/restConfigurationgt;]]/script -/div/divpspan style=line-height: 1.4285715;br clear=none/span/ppYou can configure properties on three levels.#160;/pullicomponent - Is used to set any options on the Component class. You can also configure these directly on the component./liliendpoint - Is
git commit: CAMEL-7354: Added XML dsl to the rest tomcat example.
Repository: camel Updated Branches: refs/heads/master 09bd4db06 - 27a77fbaa CAMEL-7354: Added XML dsl to the rest tomcat example. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/27a77fba Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/27a77fba Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/27a77fba Branch: refs/heads/master Commit: 27a77fbaa2850212da0ab80e8d54dd1aca32ab85 Parents: 09bd4db Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 10:34:32 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 10:34:32 2014 +0200 -- .../README.txt | 8 ++- .../src/main/resources/camel-config-xml.xml | 59 .../src/main/webapp/WEB-INF/web.xml | 6 ++ .../src/main/webapp/index.html | 10 +++- 4 files changed, 79 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/27a77fba/examples/camel-example-servlet-rest-tomcat/README.txt -- diff --git a/examples/camel-example-servlet-rest-tomcat/README.txt b/examples/camel-example-servlet-rest-tomcat/README.txt index 6f77cd5..fc32e6e 100644 --- a/examples/camel-example-servlet-rest-tomcat/README.txt +++ b/examples/camel-example-servlet-rest-tomcat/README.txt @@ -3,11 +3,15 @@ Camel Servlet REST and Apache Tomcat example This example shows how to use Servlet REST to define REST endpoints in Camel routes using the Rest DSL +This example is implemented in both the Java and XML DSLs. By default the Java DSL is in use. +You can change this in the src/main/webapps/WEB-INF/web.xml file + +For Java DSL the routes are defined in Java code, in the org.apache.camel.example.rest.UserRouteBuilder class. +And for XML DSL the routes are define in XML code, in the src/main/resources/camel-config-xml.xml file. + You will need to package this example first: mvn package -Spark requires Java 8, so you will need to use Java 8. - To run the example deploy it in Apache Tomcat by copying the .war to the deploy folder of Apache Tomcat. http://git-wip-us.apache.org/repos/asf/camel/blob/27a77fba/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml -- diff --git a/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml b/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml new file mode 100755 index 000..ccb9a15 --- /dev/null +++ b/examples/camel-example-servlet-rest-tomcat/src/main/resources/camel-config-xml.xml @@ -0,0 +1,59 @@ +?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. +-- + +beans xmlns=http://www.springframework.org/schema/beans; + xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; + xmlns:camel=http://camel.apache.org/schema/spring; + xsi:schemaLocation= + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd; + + !-- a bean for user services -- + bean id=userService class=org.apache.camel.example.rest.UserService/ + + camelContext xmlns=http://camel.apache.org/schema/spring; + +!-- configure rest to use the camel-servlet component, and use json binding mode -- +!-- and tell to output json in pretty print mode -- +restConfiguration component=servlet bindingMode=json + dataFormatProperty key=prettyPrint value=true/ +/restConfiguration + +!-- defines the rest services using the context-path /user -- +rest uri=/user consumes=application/json produces=application/json + + !-- this is a rest GET to view an user by the given id -- + get uri=/view/{id} outType=org.apache.camel.example.rest.User +to uri=bean:userService?method=getUser(${header.id})/ + /get
svn commit: r917778 - in /websites/production/camel/content: cache/main.pageCache rest-dsl.html
Author: buildbot Date: Tue Jul 29 09:18:10 2014 New Revision: 917778 Log: Production update by buildbot for camel Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/rest-dsl.html Modified: websites/production/camel/content/cache/main.pageCache == Binary files - no diff available. Modified: websites/production/camel/content/rest-dsl.html == --- websites/production/camel/content/rest-dsl.html (original) +++ websites/production/camel/content/rest-dsl.html Tue Jul 29 09:18:10 2014 @@ -240,7 +240,7 @@ public class UserPojo { script class=theme: Default; brush: java; gutter: false type=syntaxhighlighter![CDATA[restConfiguration().component(quot;spark-restquot;).port(9091).componentProperty(quot;fooquot;, quot;123quot;);]]/script /div/divpspan style=line-height: 1.4285715;br clear=none/span/ppspan style=line-height: 1.4285715;And with XML DSL/span/pdiv class=code panel pdl style=border-width: 1px;div class=codeContent panelContent pdl script class=theme: Default; brush: java; gutter: false type=syntaxhighlighter![CDATA[lt;restConfiguration component=quot;spark-restquot; port=quot;9091quot;gt; lt;componentProperty key=quot;fooquot; value=quot;123quot;/gt; lt;/restConfigurationgt;]]/script -/div/divpspan style=line-height: 1.4285715;br clear=none/span/ppYou can configure properties on three levels.#160;/pullicomponent - Is used to set any options on the Component class. You can also configure these directly on the component./liliendpoint - Is used set any option on the endpoint level. Many of the Camel components has many options you can set on endpoint level./liliconsumer - Is used to set any option on the consumer level. Some components has consumer options, which you can also configure from endpoint level by prefixing the option with consumer.#160;/li/ulpYou can set multiple options of the same level, so you can can for example configure 2 component options, and 3 endpoint options etc./ph3 id=RestDSL-IntegrationaCamelcomponentwithRestDSLIntegration a Camel component with Rest DSL/h3pAny Apache Camel component can integrate with the Rest DSL if they can be used as a REST service (eg as a REST consumer in Camel lin go). To integrate with the Rest DSL, then the component should implement the#160;codeorg.apache.camel.spi.RestConsumerFactory/code. The Rest DSL will then invoke the#160;codecreateConsumer/code method when it setup the Camel routes from the defined DSL. The component should then implement logic to create a Camel consumer that exposes the REST services based on the given parameters, such as path, verb, and other options. For example see the source code for camel-restlet, camel-spark-rest./pp#160;/ph3 id=RestDSL-SeeAlsoSee Also/h3pa shape=rect href=dsl.htmlDSL/a/ppa shape=rect href=rest.htmlRest/a/ppa shape=rect href=spark-rest.htmlSpark-rest/a/p/div +/div/divpspan style=line-height: 1.4285715;br clear=none/span/ppYou can configure properties on these levels.#160;/pullicomponent - Is used to set any options on the Component class. You can also configure these directly on the component./liliendpoint - Is used set any option on the endpoint level. Many of the Camel components has many options you can set on endpoint level./liliconsumer - Is used to set any option on the consumer level. Some components has consumer options, which you can also configure from endpoint level by prefixing the option with consumer.#160;/lilidata format - Is used to set any option on the data formats. For example to enable pretty print in the json data format./li/ulpYou can set multiple options of the same level, so you can can for example configure 2 component options, and 3 endpoint options etc./ph3 id=RestDSL-IntegrationaCamelcomponentwithRestDSLIntegration a Camel component with Rest DSL/h3pAny Apache Camel component can integrate with the Rest DSL if they can be used as a REST service (eg as a REST consumer in Camel lingo). To integrate with the Rest DSL, then the component should implement the#160;codeorg.apache.camel.spi.RestConsumerFactory/code. The Rest DSL will then invoke the#160;codecreateConsumer/code method when it setup the Camel routes from the defined DSL. The component should then implement logic to create a Camel consumer that exposes the REST services based on the given parameters, such as path, verb, and other options. For example see the source code for camel-restlet, camel-spark-rest./pp#160;/ph3 id=RestDSL-SeeAlsoSee Also/h3pa shape=rect href=dsl.htmlDSL/a/ppa shape=rect href=rest.htmlRest/a/ppa shape=rect href=spark-rest.htmlSpark-rest/a/p/div /td td valign=top div class=navigation
[1/4] git commit: CAMEL-7647: Added logic to detect quartz2/spring schedulers on route inputs in camel-blueprint. CAMEL-7648: Fixed osgi to be able to load classes using the camel context classloader,
Repository: camel Updated Branches: refs/heads/camel-2.13.x 3c7bfcc65 - 8fe7d068b refs/heads/master 27a77fbaa - 11ef082b7 CAMEL-7647: Added logic to detect quartz2/spring schedulers on route inputs in camel-blueprint. CAMEL-7648: Fixed osgi to be able to load classes using the camel context classloader, so it can load quartz2 scheduler etc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/eb77b639 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/eb77b639 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/eb77b639 Branch: refs/heads/master Commit: eb77b6399a6dc6ec56ec8734e31cabe72f5db2bf Parents: 27a77fb Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 12:02:58 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 12:02:58 2014 +0200 -- .../handler/CamelNamespaceHandler.java | 43 -- .../camel/core/osgi/OsgiCamelContextHelper.java | 2 +- .../camel/core/osgi/OsgiClassResolver.java | 20 - .../camel/core/osgi/CamelOsgiTestSupport.java | 2 +- tests/camel-itest-osgi/pom.xml | 5 ++ .../OSGiBlueprintQuarz2SchedulerTest.java | 86 .../camel/itest/osgi/blueprint/blueprint-28.xml | 28 +++ 7 files changed, 173 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/eb77b639/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java -- diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java index 5c077f5..10ff2c7 100644 --- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java +++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java @@ -19,22 +19,19 @@ package org.apache.camel.blueprint.handler; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; - import javax.xml.bind.Binder; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import org.apache.aries.blueprint.BeanProcessor; import org.apache.aries.blueprint.ComponentDefinitionRegistry; import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor; @@ -80,13 +77,13 @@ import org.apache.camel.spi.DataFormatResolver; import org.apache.camel.spi.LanguageResolver; import org.apache.camel.spi.NamespaceAware; import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; import org.apache.camel.util.blueprint.KeyStoreParametersFactoryBean; import org.apache.camel.util.blueprint.SSLContextParametersFactoryBean; import org.apache.camel.util.blueprint.SecureRandomParametersFactoryBean; import org.apache.camel.util.jsse.KeyStoreParameters; import org.apache.camel.util.jsse.SSLContextParameters; import org.apache.camel.util.jsse.SecureRandomParameters; - import org.osgi.framework.Bundle; import org.osgi.service.blueprint.container.BlueprintContainer; import org.osgi.service.blueprint.container.ComponentDefinitionException; @@ -96,6 +93,10 @@ import org.osgi.service.blueprint.reflect.Metadata; import org.osgi.service.blueprint.reflect.RefMetadata; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import static org.osgi.service.blueprint.reflect.ComponentMetadata.ACTIVATION_LAZY; import static org.osgi.service.blueprint.reflect.ServiceReferenceMetadata.AVAILABILITY_MANDATORY; @@ -898,6 +899,7 @@ public class CamelNamespaceHandler implements NamespaceHandler { if (defs != null) { for (FromDefinition def : defs) { findUriComponent(def.getUri(), components); +findSchedulerUriComponent(def.getUri(), components); } } } @@ -978,6 +980,33 @@ public class CamelNamespaceHandler implements NamespaceHandler { } } +private void findSchedulerUriComponent(String uri, SetString components) { + +// the input may use a scheduler which can be quartz or spring +if (uri != null) {
[2/4] git commit: CAMEL-7647: Added logic to detect quartz2/spring schedulers on route inputs in camel-blueprint. CAMEL-7648: Fixed osgi to be able to load classes using the camel context classloader,
CAMEL-7647: Added logic to detect quartz2/spring schedulers on route inputs in camel-blueprint. CAMEL-7648: Fixed osgi to be able to load classes using the camel context classloader, so it can load quartz2 scheduler etc. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/edf9014f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/edf9014f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/edf9014f Branch: refs/heads/camel-2.13.x Commit: edf9014fe6b01d3874ac2eee535bc1c50318d90b Parents: 3c7bfcc Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 12:02:58 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 13:12:07 2014 +0200 -- .../handler/CamelNamespaceHandler.java | 43 -- .../camel/core/osgi/OsgiCamelContextHelper.java | 2 +- .../camel/core/osgi/OsgiClassResolver.java | 20 - .../camel/core/osgi/CamelOsgiTestSupport.java | 2 +- tests/camel-itest-osgi/pom.xml | 5 ++ .../OSGiBlueprintQuarz2SchedulerTest.java | 86 .../camel/itest/osgi/blueprint/blueprint-28.xml | 28 +++ 7 files changed, 173 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/edf9014f/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java -- diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java index e25621d..9b982e0 100644 --- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java +++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java @@ -19,22 +19,19 @@ package org.apache.camel.blueprint.handler; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; - import javax.xml.bind.Binder; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import org.apache.aries.blueprint.BeanProcessor; import org.apache.aries.blueprint.ComponentDefinitionRegistry; import org.apache.aries.blueprint.ComponentDefinitionRegistryProcessor; @@ -80,13 +77,13 @@ import org.apache.camel.spi.DataFormatResolver; import org.apache.camel.spi.LanguageResolver; import org.apache.camel.spi.NamespaceAware; import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.URISupport; import org.apache.camel.util.blueprint.KeyStoreParametersFactoryBean; import org.apache.camel.util.blueprint.SSLContextParametersFactoryBean; import org.apache.camel.util.blueprint.SecureRandomParametersFactoryBean; import org.apache.camel.util.jsse.KeyStoreParameters; import org.apache.camel.util.jsse.SSLContextParameters; import org.apache.camel.util.jsse.SecureRandomParameters; - import org.osgi.framework.Bundle; import org.osgi.service.blueprint.container.BlueprintContainer; import org.osgi.service.blueprint.container.ComponentDefinitionException; @@ -96,6 +93,10 @@ import org.osgi.service.blueprint.reflect.Metadata; import org.osgi.service.blueprint.reflect.RefMetadata; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import static org.osgi.service.blueprint.reflect.ComponentMetadata.ACTIVATION_LAZY; import static org.osgi.service.blueprint.reflect.ServiceReferenceMetadata.AVAILABILITY_MANDATORY; @@ -896,6 +897,7 @@ public class CamelNamespaceHandler implements NamespaceHandler { if (defs != null) { for (FromDefinition def : defs) { findUriComponent(def.getUri(), components); +findSchedulerUriComponent(def.getUri(), components); } } } @@ -976,6 +978,33 @@ public class CamelNamespaceHandler implements NamespaceHandler { } } +private void findSchedulerUriComponent(String uri, SetString components) { + +// the input may use a scheduler which can be quartz or spring +if (uri != null) { +try { +URI u = new URI(uri); +MapString, Object parameters =
git commit: Added scala-xml module dependency to fix the camel-scala build error with IDEA
Repository: camel Updated Branches: refs/heads/master 11ef082b7 - b95931022 Added scala-xml module dependency to fix the camel-scala build error with IDEA Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b9593102 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b9593102 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b9593102 Branch: refs/heads/master Commit: b959310225c4005d3cbd4598b03298083b14c4dc Parents: 11ef082 Author: Willem Jiang willem.ji...@gmail.com Authored: Tue Jul 29 20:43:32 2014 +0800 Committer: Willem Jiang willem.ji...@gmail.com Committed: Tue Jul 29 20:44:53 2014 +0800 -- components/camel-scala/pom.xml | 11 +++ parent/pom.xml | 1 + 2 files changed, 12 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b9593102/components/camel-scala/pom.xml -- diff --git a/components/camel-scala/pom.xml b/components/camel-scala/pom.xml index 382507d..22e444e 100644 --- a/components/camel-scala/pom.xml +++ b/components/camel-scala/pom.xml @@ -47,6 +47,13 @@ version${scala-version}/version scopeprovided/scope /dependency +!-- scala-libray doesn't include xml module since 2.11.x -- +dependency +groupIdorg.scala-lang.modules/groupId +artifactIdscala-xml_2.11/artifactId +version${scalaxml-version}/version +scopeprovided/scope +/dependency !-- test dependencies -- dependency @@ -72,6 +79,10 @@ groupIdorg.scala-lang/groupId artifactIdscala-reflect/artifactId /exclusion +exclusion +groupIdorg.scala-lang.modules/groupId +artifactIdscala-xml_2.11/artifactId +/exclusion /exclusions /dependency dependency http://git-wip-us.apache.org/repos/asf/camel/blob/b9593102/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 8dd2e3a..d0e5b62 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -359,6 +359,7 @@ scala-version2.11.2/scala-version scala-maven-plugin-version3.2.0/scala-maven-plugin-version scalatest-version2.2.0/scalatest-version +scalaxml-version1.0.2/scalaxml-version scribe-version1.3.5/scribe-version scriptengines-version1.1/scriptengines-version serp-bundle-version1.14.1_1/serp-bundle-version
git commit: Upgraded groovy
Repository: camel Updated Branches: refs/heads/master b95931022 - 4e19693f1 Upgraded groovy Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4e19693f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4e19693f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4e19693f Branch: refs/heads/master Commit: 4e19693f151d603741a6738be169d6d78e735063 Parents: b959310 Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 16:07:48 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 16:07:48 2014 +0200 -- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4e19693f/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index d0e5b62..4b51348 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -166,7 +166,7 @@ google-gdata-version1.41.5.w1/google-gdata-version google-gdata-bundle-version1.41.1_1/google-gdata-bundle-version google-guava-version17.0/google-guava-version -groovy-version2.3.5/groovy-version +groovy-version2.3.6/groovy-version gson-version2.2.4/gson-version guice-bundle-version3.0_1/guice-bundle-version guice-version3.0/guice-version
git commit: xmltokenizer did not set headerName option
Repository: camel Updated Branches: refs/heads/master 4e19693f1 - 46ccfab4a xmltokenizer did not set headerName option Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/46ccfab4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/46ccfab4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/46ccfab4 Branch: refs/heads/master Commit: 46ccfab4a7a4e87a9fd4f7186f2db021711f1820 Parents: 4e19693 Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 17:41:14 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 17:41:14 2014 +0200 -- .../apache/camel/language/tokenizer/XMLTokenizeLanguage.java | 1 + .../apache/camel/model/language/XMLTokenizerExpression.java| 6 ++ 2 files changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/46ccfab4/camel-core/src/main/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguage.java -- diff --git a/camel-core/src/main/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguage.java b/camel-core/src/main/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguage.java index aa16aa9..2b38128 100644 --- a/camel-core/src/main/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguage.java +++ b/camel-core/src/main/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguage.java @@ -114,6 +114,7 @@ public class XMLTokenizeLanguage extends LanguageSupport { public void setMode(char mode) { this.mode = mode; } + public int getGroup() { return group; } http://git-wip-us.apache.org/repos/asf/camel/blob/46ccfab4/camel-core/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java -- diff --git a/camel-core/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java b/camel-core/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java index 97e356e..8e96044 100644 --- a/camel-core/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java +++ b/camel-core/src/main/java/org/apache/camel/model/language/XMLTokenizerExpression.java @@ -81,6 +81,9 @@ public class XMLTokenizerExpression extends NamespaceAwareExpression { @Override protected void configureExpression(CamelContext camelContext, Expression expression) { super.configureExpression(camelContext, expression); +if (headerName != null) { +setProperty(expression, headerName, headerName); +} if (mode != null) { setProperty(expression, mode, mode); } @@ -89,6 +92,9 @@ public class XMLTokenizerExpression extends NamespaceAwareExpression { @Override protected void configurePredicate(CamelContext camelContext, Predicate predicate) { super.configurePredicate(camelContext, predicate); +if (headerName != null) { +setProperty(predicate, headerName, headerName); +} if (mode != null) { setProperty(predicate, mode, mode); }
git commit: CAMEL-7354: Added to camel-blueprint so it can find camel componetns in embedded rest routes.
Repository: camel Updated Branches: refs/heads/master 46ccfab4a - dec2bbfcc CAMEL-7354: Added to camel-blueprint so it can find camel componetns in embedded rest routes. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dec2bbfc Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dec2bbfc Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dec2bbfc Branch: refs/heads/master Commit: dec2bbfcc2cbecf44f3c85c099afa8ab8a0702a9 Parents: 46ccfab Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 17:59:39 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 17:59:39 2014 +0200 -- .../handler/CamelNamespaceHandler.java | 20 1 file changed, 20 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/dec2bbfc/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java -- diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java index ab0005a..bd1eb67 100644 --- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java +++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java @@ -32,6 +32,9 @@ import javax.xml.bind.Binder; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; +import org.apache.camel.model.ToDefinition; +import org.apache.camel.model.rest.RestDefinition; +import org.apache.camel.model.rest.VerbDefinition; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -870,10 +873,27 @@ public class CamelNamespaceHandler implements NamespaceHandler { SetString components = new HashSetString(); SetString languages = new HashSetString(); SetString dataformats = new HashSetString(); + +// regular camel routes for (RouteDefinition rd : camelContext.getRouteDefinitions()) { findInputComponents(rd.getInputs(), components, languages, dataformats); findOutputComponents(rd.getOutputs(), components, languages, dataformats); } + +// rest services can have embedded routes or a singular to +for (RestDefinition rd : camelContext.getRestDefinitions()) { +for (VerbDefinition vd : rd.getVerbs()) { +Object o = vd.getToOrRoute(); +if (o instanceof RouteDefinition) { +RouteDefinition route = (RouteDefinition) o; +findInputComponents(route.getInputs(), components, languages, dataformats); +findOutputComponents(route.getOutputs(), components, languages, dataformats); +} else if (o instanceof ToDefinition) { +findUriComponent(((ToDefinition) o).getUri(), components); +} +} +} + // We can only add service references to resolvers, but we can't make the factory depends on those // because the factory has already been instantiated try {
git commit: CAMEL-7646: Remove cyclic package dependency in xmlsecurity component. Thanks to Franz Forsthofer for the patch.
Repository: camel Updated Branches: refs/heads/master dec2bbfcc - e8fb927b9 CAMEL-7646: Remove cyclic package dependency in xmlsecurity component. Thanks to Franz Forsthofer for the patch. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e8fb927b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e8fb927b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e8fb927b Branch: refs/heads/master Commit: e8fb927b9cc045289d6c85888a765e82806aa23e Parents: dec2bbf Author: Claus Ibsen davscl...@apache.org Authored: Tue Jul 29 18:02:17 2014 +0200 Committer: Claus Ibsen davscl...@apache.org Committed: Tue Jul 29 18:02:17 2014 +0200 -- .../component/xmlsecurity/SantuarioUtil.java| 83 .../xmlsecurity/processor/SantuarioUtil.java| 83 .../processor/XmlSignatureProcessor.java| 2 - 3 files changed, 83 insertions(+), 85 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e8fb927b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/SantuarioUtil.java -- diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/SantuarioUtil.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/SantuarioUtil.java deleted file mode 100644 index a9108a1..000 --- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/SantuarioUtil.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * 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.camel.component.xmlsecurity; - -import java.lang.reflect.Field; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; -import java.security.Provider; -import java.security.Security; - -import org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI; -import org.apache.xml.security.utils.XMLUtils; - - -public final class SantuarioUtil { -private SantuarioUtil() { -//Helper class -} - -public static void initializeSantuario() { -// Set ignoreLineBreaks to true -boolean wasSet = false; -try { -// Don't override if it was set explicitly -wasSet = AccessController.doPrivileged(new PrivilegedActionBoolean() { -public Boolean run() { -String lineBreakPropName = org.apache.xml.security.ignoreLineBreaks; -if (System.getProperty(lineBreakPropName) == null) { -System.setProperty(lineBreakPropName, true); -return false; -} -return true; -} -}); -} catch (Throwable t) { //NOPMD -//ignore -} -org.apache.xml.security.Init.init(); -if (!wasSet) { -try { -AccessController.doPrivileged(new PrivilegedExceptionActionBoolean() { -public Boolean run() throws Exception { -Field f = XMLUtils.class.getDeclaredField(ignoreLineBreaks); -f.setAccessible(true); -f.set(null, Boolean.TRUE); -return false; -} -}); -} catch (Throwable t) { //NOPMD -//ignore -} -} -} - -public static void addSantuarioJSR105Provider() { -AccessController.doPrivileged(new PrivilegedActionBoolean() { -public Boolean run() { -String providerName = ApacheXMLDSig; -Provider currentProvider = Security.getProvider(providerName); -if (currentProvider == null) { -Security.addProvider(new XMLDSigRI()); -} -return true; -} -}); -} - -} \ No newline at end of file