This is an automated email from the ASF dual-hosted git repository. onders pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit d3a24faddcba1252b0e7a329e2d3976468cda404 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Mon May 18 15:00:41 2020 +0200 Regen after camel-resteasy merged --- .../builder/endpoint/StaticEndpointBuilders.java | 4 +- .../modules/ROOT/pages/resteasy-component.adoc | 103 ++++++++++++++++++++- 2 files changed, 104 insertions(+), 3 deletions(-) diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index ffef845..4c808c7 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -11734,7 +11734,7 @@ public class StaticEndpointBuilders { */ static org.apache.camel.builder.endpoint.dsl.ResteasyEndpointBuilderFactory.ResteasyEndpointBuilder resteasy( String path) { - return org.apache.camel.builder.endpoint.dsl.ResteasyEndpointBuilderFactory.endpointBuilder("resteasy",path); + return org.apache.camel.builder.endpoint.dsl.ResteasyEndpointBuilderFactory.endpointBuilder("resteasy", path); } /** * Resteasy (camel-resteasy) @@ -11756,7 +11756,7 @@ public class StaticEndpointBuilders { static org.apache.camel.builder.endpoint.dsl.ResteasyEndpointBuilderFactory.ResteasyEndpointBuilder resteasy( String componentName, String path) { - return org.apache.camel.builder.endpoint.dsl.ResteasyEndpointBuilderFactory.endpointBuilder(componentName,path); + return org.apache.camel.builder.endpoint.dsl.ResteasyEndpointBuilderFactory.endpointBuilder(componentName, path); } /** * REST (camel-rest) diff --git a/docs/components/modules/ROOT/pages/resteasy-component.adoc b/docs/components/modules/ROOT/pages/resteasy-component.adoc index c8ab041..14aa716 100644 --- a/docs/components/modules/ROOT/pages/resteasy-component.adoc +++ b/docs/components/modules/ROOT/pages/resteasy-component.adoc @@ -13,6 +13,33 @@ *{component-header}* +The *resteasy:* component provides HTTP based +endpoints for consuming HTTP requests that arrive at +a HTTP endpoint that is bound to a published Servlet. + +Maven users will need to add the following dependency to their `pom.xml` +for this component: + +[source,xml] +--------------------------------------------------------------- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-resteasy</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +--------------------------------------------------------------- + +== URI format + +[source,java] +--------------------------------- +resteasy://relative_path[?options] +--------------------------------- + +You can append query options to the URI in the following format: +`?option=value&option=value&...` + === Options // component options: START @@ -150,4 +177,78 @@ with the following path and query parameters: |=== // endpoint options: END -=== Samples +=== Usage + +Consumer endpoints are similar to endpoints generated by the Servlet component. +Therefore, it should be used only as input into your Camel routes. To +issue HTTP requests against other HTTP endpoints, use the +xref:http-component.adoc[HTTP Component]. + +Producer endpoints rely on Resteasy Client API. https://docs.jboss.org/resteasy/docs/4.5.3.Final/userguide/html_single/index.html#RESTEasy_Client_Framework + +== Putting Camel JARs in the app server boot classpath +Refer same section of xref:servlet-component.adoc[Servlet Component]. + +== Sample + +As a basic consumer with Spring example, first, you need to publish the servlet +using the `Web.xml` file to publish + + +Notice that below two listeners are registered when application server is initialized. +The org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap class is a ServletContextListener that configures an instance of an ResteasyProviderFactory and Registry. You can obtain instances of a ResteasyProviderFactory and Registry from the ServletContext attributes org.jboss.resteasy.spi.ResteasyProviderFactory and org.jboss.resteasy.spi.Registry. From these instances you can programmatically interact with RESTEasy registration interfaces. +Please note that the SpringContextLoaderListener must be declared after ResteasyBootstrap as it uses ServletContext attributes initialized by it. +For further details please refer to https://docs.jboss.org/resteasy/docs/4.5.3.Final/userguide/html_single/index.html#RESTEasy_Spring_Integration + + +[source,xml] +------------------------------------------------------------------------- +<web-app> + <context-param> + <param-name>contextConfigLocation</param-name> + <param-value>WEB-INF/applicationContext.xml</param-value> + </context-param> + <listener> + <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class> + </listener> + + <listener> + <listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class> + </listener> + + <servlet> + <servlet-name>resteasy-camel-servlet</servlet-name> + <servlet-class>org.apache.camel.component.resteasy.servlet.ResteasyCamelServlet</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>resteasy-camel-servlet</servlet-name> + <url-pattern>/*</url-pattern> + </servlet-mapping> + +</web-app> +------------------------------------------------------------------------- + +Then you can define your route as follows: + +[source,xml] +------------------------------------------------------------------------- +<context:component-scan base-package="org.apache.camel.component.resteasy.test"> + <context:include-filter type="annotation" expression="javax.ws.rs.Path"/> +</context:component-scan> + + ........ + +<camel:camelContext> + + <camel:route> + <camel:from uri="resteasy:/customer/getAll?servletName=resteasy-camel-servlet"/> + <camel:to uri="file://target/test/consumerTest?fileName=all.txt"/> + </camel:route> + + </camel:camelContext> +------------------------------------------------------------------------- + +Notice that component-scan is important to load resteasy servlet properly into container's runtime. + +include::camel-spring-boot::page$restasy-starter.adoc[] \ No newline at end of file