RE: Not seeing query params on REST DSL
I apologize for the delay responding to this. I was able to get this working but parsing out the URI info separately, like the below. It's from a test program so it has some assumptions about what it should be getting. -Steve --- String httpRequest = resultEndpoint.getExchanges().get(0).getIn().getHeader("CamelRestletRequest", String.class); // httpRequest should say PUT http:// HTTP/1.1 - split it to get the URL String[] pieces = httpRequest.split("\\s+"); URL url = new URL(pieces[1]); String req[] = url.getQuery().split("="); assertEquals("id query param is present", "id", req[0]); assertEquals("id query value mismatch", "5678", req[1]); > -Original Message- > From: vikson [mailto:vikram.sonawa...@cognizant.com] > Sent: Thursday, February 09, 2017 1:46 AM > To: users@camel.apache.org > Subject: Re: Not seeing query params on REST DSL > > Hi Steve, > > Were you able to find a solution for your query. I'm facing the exact same > issue; not able to read query params from the URL in case of the RESTLET > component. I was earlier using the SERVLET component and I was able to > read the query params as well as the header values from the incoming > request. I would like to achieve the same using the RESTLET component. > > Code fragment for reference: > > //Rest services exposed > rest("/").description("XYZ > service").consumes(MediaType.APPLICATION_JSON_VALUE).produces(Med > iaType.APPLICATION_JSON_VALUE) > .get("/process?arg1={arg1}&arg2={arg2}") > .consumes(MediaType.APPLICATION_JSON_VALUE) > > .to("bean:testServiceImpl?method=callTestService(${header.arg1},${header > .arg2},${header.hdrId})").produces(MediaType.APPLICATION_JSON_VALUE) > ; > // hdrId is the header I'm trying to read & this was working with the SERVLET > component, all request params, header values are read. > > Any help would be appreciated. Thanks. > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Not- > seeing-query-params-on-REST-DSL-tp5781442p5793707.html > Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Not seeing query params on REST DSL
Hi Steve, Were you able to find a solution for your query. I'm facing the exact same issue; not able to read query params from the URL in case of the RESTLET component. I was earlier using the SERVLET component and I was able to read the query params as well as the header values from the incoming request. I would like to achieve the same using the RESTLET component. Code fragment for reference: //Rest services exposed rest("/").description("XYZ service").consumes(MediaType.APPLICATION_JSON_VALUE).produces(MediaType.APPLICATION_JSON_VALUE) .get("/process?arg1={arg1}&arg2={arg2}") .consumes(MediaType.APPLICATION_JSON_VALUE) .to("bean:testServiceImpl?method=callTestService(${header.arg1},${header.arg2},${header.hdrId})").produces(MediaType.APPLICATION_JSON_VALUE); // hdrId is the header I'm trying to read & this was working with the SERVLET component, all request params, header values are read. Any help would be appreciated. Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/Not-seeing-query-params-on-REST-DSL-tp5781442p5793707.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Not seeing query params on REST DSL
Technically speaking, you can do this by retrieving the original request from the exchange's in field and calling the appropriate methods to get the original query params. The field can be found here: https://github.com/apache/camel/blob/master/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletConstants.java#L28 - John On Tue, Apr 26, 2016 at 7:50 AM Steve Huston wrote: > Ok, so what I'm trying to do won't work at this time? > > I've been going through camel-restlet docs trying to get at what Claus was > surely referring to as a solution ;-) > > > -Original Message- > > From: John D. Ament [mailto:johndam...@apache.org] > > Sent: Tuesday, April 26, 2016 7:02 AM > > To: users@camel.apache.org > > Subject: Re: Not seeing query params on REST DSL > > > > IMHO what Steve's describing is a pretty useful feature. I created a > JIRA > > - https://issues.apache.org/jira/browse/CAMEL-9914 > > > > I'll try to get to it pretty soon. > > > > John > > > > On Mon, Apr 25, 2016 at 2:28 PM Claus Ibsen > > wrote: > > > > > That is for the api documentation. > > > > > > Its the camel-restlet component that does the actual mapping from > > > restlet to camel exchange/message. > > > > > > On Mon, Apr 25, 2016 at 7:59 PM, Steve Huston > > > wrote: > > > > Ok, what registers the query param if this doesn't? > > > > > > > > restConfiguration().component("restlet").port(9000); > > > > rest("/asset") > > > > > > > > > .put("/{addr}/pong").param().name("id").type(RestParamType.query).endP > > > aram() > > > > .to("log:steve?showAll=true") > > > >.to("mock:result"); > > > > > > > >> -Original Message- > > > >> From: John D. Ament [mailto:johndam...@apache.org] > > > >> Sent: Monday, April 25, 2016 1:52 PM > > > >> To: users@camel.apache.org > > > >> Subject: Re: Not seeing query params on REST DSL > > > >> > > > >> Apologies as I missed this. > > > >> > > > >> As far as I know, you need to explicitly register your query params. > > > They are > > > >> not automatically propagated. > > > >> > > > >> John > > > >> > > > >> On Mon, Apr 25, 2016 at 1:33 PM Steve Huston > > > > > >> wrote: > > > >> > > > >> > On the risk of aggravating people (sorry) popping this up to > > > >> > today's content... any help is most welcome. > > > >> > > > > >> > Thanks! > > > >> > -Steve > > > >> > > > > >> > > -Original Message- > > > >> > > From: Steve Huston > > > >> > > Sent: Wednesday, April 20, 2016 8:57 PM > > > >> > > To: users@camel.apache.org > > > >> > > Subject: Re: Not seeing query params on REST DSL > > > >> > > > > > >> > > I am using Camel 2.16.3 and restlet. > > > >> > > > > > >> > > -Steve > > > >> > > > > > >> > > > On Apr 20, 2016, at 7:27 PM, John D. Ament > > > >> > > > >> > > wrote: > > > >> > > > > > > >> > > > Steve > > > >> > > > > > > >> > > > Could you share your dependencies as well? Which rest > > > >> > > > runtime are you using? > > > >> > > > On Apr 20, 2016 17:12, "Steve Huston" > > > wrote: > > > >> > > > > > > >> > > >> I am using the REST DSL in a Camel SCR unit test. I have a > > > >> > > >> route (being > > > >> > > >> tested) that will initiate a http request at this URL: > > > >> > > >> > > > >> > > >>@Test > > > >> > > >>public void testRoutes() throws Exception { > > > >> > > >>context.addRoutes(new RouteBuilder() { > > > >> > > >>@Override > > > >> > > >>
RE: Not seeing query params on REST DSL
Ok, so what I'm trying to do won't work at this time? I've been going through camel-restlet docs trying to get at what Claus was surely referring to as a solution ;-) > -Original Message- > From: John D. Ament [mailto:johndam...@apache.org] > Sent: Tuesday, April 26, 2016 7:02 AM > To: users@camel.apache.org > Subject: Re: Not seeing query params on REST DSL > > IMHO what Steve's describing is a pretty useful feature. I created a JIRA > - https://issues.apache.org/jira/browse/CAMEL-9914 > > I'll try to get to it pretty soon. > > John > > On Mon, Apr 25, 2016 at 2:28 PM Claus Ibsen > wrote: > > > That is for the api documentation. > > > > Its the camel-restlet component that does the actual mapping from > > restlet to camel exchange/message. > > > > On Mon, Apr 25, 2016 at 7:59 PM, Steve Huston > > wrote: > > > Ok, what registers the query param if this doesn't? > > > > > > restConfiguration().component("restlet").port(9000); > > > rest("/asset") > > > > > > .put("/{addr}/pong").param().name("id").type(RestParamType.query).endP > > aram() > > >.to("log:steve?showAll=true") > > > .to("mock:result"); > > > > > >> -Original Message- > > >> From: John D. Ament [mailto:johndam...@apache.org] > > >> Sent: Monday, April 25, 2016 1:52 PM > > >> To: users@camel.apache.org > > >> Subject: Re: Not seeing query params on REST DSL > > >> > > >> Apologies as I missed this. > > >> > > >> As far as I know, you need to explicitly register your query params. > > They are > > >> not automatically propagated. > > >> > > >> John > > >> > > >> On Mon, Apr 25, 2016 at 1:33 PM Steve Huston > > > >> wrote: > > >> > > >> > On the risk of aggravating people (sorry) popping this up to > > >> > today's content... any help is most welcome. > > >> > > > >> > Thanks! > > >> > -Steve > > >> > > > >> > > -Original Message- > > >> > > From: Steve Huston > > >> > > Sent: Wednesday, April 20, 2016 8:57 PM > > >> > > To: users@camel.apache.org > > >> > > Subject: Re: Not seeing query params on REST DSL > > >> > > > > >> > > I am using Camel 2.16.3 and restlet. > > >> > > > > >> > > -Steve > > >> > > > > >> > > > On Apr 20, 2016, at 7:27 PM, John D. Ament > > >> > > >> > > wrote: > > >> > > > > > >> > > > Steve > > >> > > > > > >> > > > Could you share your dependencies as well? Which rest > > >> > > > runtime are you using? > > >> > > > On Apr 20, 2016 17:12, "Steve Huston" > > wrote: > > >> > > > > > >> > > >> I am using the REST DSL in a Camel SCR unit test. I have a > > >> > > >> route (being > > >> > > >> tested) that will initiate a http request at this URL: > > >> > > >> > > >> > > >>@Test > > >> > > >>public void testRoutes() throws Exception { > > >> > > >>context.addRoutes(new RouteBuilder() { > > >> > > >>@Override > > >> > > >>public void configure() throws Exception { > > >> > > >> > > >> > > >> restConfiguration().component("restlet").port(9000); > > >> > > >>rest("/asset") > > >> > > >>.put("/{addr}/pong") > > >> > > >> .param().name("id").type(RestParamType.query).endParam() > > >> > > >>.to("log:steve?showAll=true") > > >> > > >>.to("mock:result"); > > >> > > >>} > > >> > > >>}); > > >> > > >> > > >> > > >>MockEndpoint resultEndpoint = > > >> > > >> context.getEndpoint("mock:result", > > >> > > >> MockEndpoint.class); > > >> > > >>resultEndpoint.expectedMessageCount(1); > > >> > > >> > > >> > > >> > > >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value") > > >> ; > > >> > > >> > > >> > > >> resultEndpoint.message(0).header("id").isEqualTo("abcd1234") > > >> > > >> ; > > >> > > >> > > >> > > >> > > >> > > >> At run time, the request does arrive as a PUT to > > >> > > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 > > >> > > >> > > >> > > >> However, I am only getting the "addr" path parameter in the > > header. > > >> > > >> The query param "id" is missing. > > >> > > >> Am I doing something wrong on the definition? I pieced > > >> > > >> together the way to do it from disparate tidbits on the net. > > >> > > >> > > >> > > >> Thanks, > > >> > > >> -Steve > > >> > > >> > > >> > > > >> > > > > > > > > > -- > > Claus Ibsen > > - > > http://davsclaus.com @davsclaus > > Camel in Action 2: https://www.manning.com/ibsen2 > >
Re: Not seeing query params on REST DSL
IMHO what Steve's describing is a pretty useful feature. I created a JIRA - https://issues.apache.org/jira/browse/CAMEL-9914 I'll try to get to it pretty soon. John On Mon, Apr 25, 2016 at 2:28 PM Claus Ibsen wrote: > That is for the api documentation. > > Its the camel-restlet component that does the actual mapping from > restlet to camel exchange/message. > > On Mon, Apr 25, 2016 at 7:59 PM, Steve Huston > wrote: > > Ok, what registers the query param if this doesn't? > > > > restConfiguration().component("restlet").port(9000); > > rest("/asset") > > > .put("/{addr}/pong").param().name("id").type(RestParamType.query).endParam() > >.to("log:steve?showAll=true") > >.to("mock:result"); > > > >> -Original Message----- > >> From: John D. Ament [mailto:johndam...@apache.org] > >> Sent: Monday, April 25, 2016 1:52 PM > >> To: users@camel.apache.org > >> Subject: Re: Not seeing query params on REST DSL > >> > >> Apologies as I missed this. > >> > >> As far as I know, you need to explicitly register your query params. > They are > >> not automatically propagated. > >> > >> John > >> > >> On Mon, Apr 25, 2016 at 1:33 PM Steve Huston > >> wrote: > >> > >> > On the risk of aggravating people (sorry) popping this up to today's > >> > content... any help is most welcome. > >> > > >> > Thanks! > >> > -Steve > >> > > >> > > -Original Message- > >> > > From: Steve Huston > >> > > Sent: Wednesday, April 20, 2016 8:57 PM > >> > > To: users@camel.apache.org > >> > > Subject: Re: Not seeing query params on REST DSL > >> > > > >> > > I am using Camel 2.16.3 and restlet. > >> > > > >> > > -Steve > >> > > > >> > > > On Apr 20, 2016, at 7:27 PM, John D. Ament > >> > >> > > wrote: > >> > > > > >> > > > Steve > >> > > > > >> > > > Could you share your dependencies as well? Which rest runtime are > >> > > > you using? > >> > > > On Apr 20, 2016 17:12, "Steve Huston" > wrote: > >> > > > > >> > > >> I am using the REST DSL in a Camel SCR unit test. I have a route > >> > > >> (being > >> > > >> tested) that will initiate a http request at this URL: > >> > > >> > >> > > >>@Test > >> > > >>public void testRoutes() throws Exception { > >> > > >>context.addRoutes(new RouteBuilder() { > >> > > >>@Override > >> > > >>public void configure() throws Exception { > >> > > >> > >> > > >> restConfiguration().component("restlet").port(9000); > >> > > >>rest("/asset") > >> > > >>.put("/{addr}/pong") > >> > > >> .param().name("id").type(RestParamType.query).endParam() > >> > > >>.to("log:steve?showAll=true") > >> > > >>.to("mock:result"); > >> > > >>} > >> > > >>}); > >> > > >> > >> > > >>MockEndpoint resultEndpoint = > >> > > >> context.getEndpoint("mock:result", > >> > > >> MockEndpoint.class); > >> > > >>resultEndpoint.expectedMessageCount(1); > >> > > >> > >> > > >> > >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value"); > >> > > >> > >> > > >> resultEndpoint.message(0).header("id").isEqualTo("abcd1234"); > >> > > >> > >> > > >> > >> > > >> At run time, the request does arrive as a PUT to > >> > > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 > >> > > >> > >> > > >> However, I am only getting the "addr" path parameter in the > header. > >> > > >> The query param "id" is missing. > >> > > >> Am I doing something wrong on the definition? I pieced together > >> > > >> the way to do it from disparate tidbits on the net. > >> > > >> > >> > > >> Thanks, > >> > > >> -Steve > >> > > >> > >> > > >> > > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 >
Re: Not seeing query params on REST DSL
That is for the api documentation. Its the camel-restlet component that does the actual mapping from restlet to camel exchange/message. On Mon, Apr 25, 2016 at 7:59 PM, Steve Huston wrote: > Ok, what registers the query param if this doesn't? > > restConfiguration().component("restlet").port(9000); > rest("/asset") > > .put("/{addr}/pong").param().name("id").type(RestParamType.query).endParam() >.to("log:steve?showAll=true") >.to("mock:result"); > >> -Original Message- >> From: John D. Ament [mailto:johndam...@apache.org] >> Sent: Monday, April 25, 2016 1:52 PM >> To: users@camel.apache.org >> Subject: Re: Not seeing query params on REST DSL >> >> Apologies as I missed this. >> >> As far as I know, you need to explicitly register your query params. They >> are >> not automatically propagated. >> >> John >> >> On Mon, Apr 25, 2016 at 1:33 PM Steve Huston >> wrote: >> >> > On the risk of aggravating people (sorry) popping this up to today's >> > content... any help is most welcome. >> > >> > Thanks! >> > -Steve >> > >> > > -Original Message- >> > > From: Steve Huston >> > > Sent: Wednesday, April 20, 2016 8:57 PM >> > > To: users@camel.apache.org >> > > Subject: Re: Not seeing query params on REST DSL >> > > >> > > I am using Camel 2.16.3 and restlet. >> > > >> > > -Steve >> > > >> > > > On Apr 20, 2016, at 7:27 PM, John D. Ament >> >> > > wrote: >> > > > >> > > > Steve >> > > > >> > > > Could you share your dependencies as well? Which rest runtime are >> > > > you using? >> > > > On Apr 20, 2016 17:12, "Steve Huston" wrote: >> > > > >> > > >> I am using the REST DSL in a Camel SCR unit test. I have a route >> > > >> (being >> > > >> tested) that will initiate a http request at this URL: >> > > >> >> > > >>@Test >> > > >>public void testRoutes() throws Exception { >> > > >>context.addRoutes(new RouteBuilder() { >> > > >>@Override >> > > >>public void configure() throws Exception { >> > > >> >> > > >> restConfiguration().component("restlet").port(9000); >> > > >>rest("/asset") >> > > >>.put("/{addr}/pong") >> > > >> .param().name("id").type(RestParamType.query).endParam() >> > > >>.to("log:steve?showAll=true") >> > > >>.to("mock:result"); >> > > >>} >> > > >>}); >> > > >> >> > > >>MockEndpoint resultEndpoint = >> > > >> context.getEndpoint("mock:result", >> > > >> MockEndpoint.class); >> > > >>resultEndpoint.expectedMessageCount(1); >> > > >> >> > > >> >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value"); >> > > >> >> > > >> resultEndpoint.message(0).header("id").isEqualTo("abcd1234"); >> > > >> >> > > >> >> > > >> At run time, the request does arrive as a PUT to >> > > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 >> > > >> >> > > >> However, I am only getting the "addr" path parameter in the header. >> > > >> The query param "id" is missing. >> > > >> Am I doing something wrong on the definition? I pieced together >> > > >> the way to do it from disparate tidbits on the net. >> > > >> >> > > >> Thanks, >> > > >> -Steve >> > > >> >> > >> > -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
RE: Not seeing query params on REST DSL
Ok, what registers the query param if this doesn't? restConfiguration().component("restlet").port(9000); rest("/asset") .put("/{addr}/pong").param().name("id").type(RestParamType.query).endParam() .to("log:steve?showAll=true") .to("mock:result"); > -Original Message- > From: John D. Ament [mailto:johndam...@apache.org] > Sent: Monday, April 25, 2016 1:52 PM > To: users@camel.apache.org > Subject: Re: Not seeing query params on REST DSL > > Apologies as I missed this. > > As far as I know, you need to explicitly register your query params. They are > not automatically propagated. > > John > > On Mon, Apr 25, 2016 at 1:33 PM Steve Huston > wrote: > > > On the risk of aggravating people (sorry) popping this up to today's > > content... any help is most welcome. > > > > Thanks! > > -Steve > > > > > -----Original Message- > > > From: Steve Huston > > > Sent: Wednesday, April 20, 2016 8:57 PM > > > To: users@camel.apache.org > > > Subject: Re: Not seeing query params on REST DSL > > > > > > I am using Camel 2.16.3 and restlet. > > > > > > -Steve > > > > > > > On Apr 20, 2016, at 7:27 PM, John D. Ament > > > > wrote: > > > > > > > > Steve > > > > > > > > Could you share your dependencies as well? Which rest runtime are > > > > you using? > > > > On Apr 20, 2016 17:12, "Steve Huston" wrote: > > > > > > > >> I am using the REST DSL in a Camel SCR unit test. I have a route > > > >> (being > > > >> tested) that will initiate a http request at this URL: > > > >> > > > >>@Test > > > >>public void testRoutes() throws Exception { > > > >>context.addRoutes(new RouteBuilder() { > > > >>@Override > > > >>public void configure() throws Exception { > > > >> > > > >> restConfiguration().component("restlet").port(9000); > > > >>rest("/asset") > > > >>.put("/{addr}/pong") > > > >> .param().name("id").type(RestParamType.query).endParam() > > > >>.to("log:steve?showAll=true") > > > >>.to("mock:result"); > > > >>} > > > >>}); > > > >> > > > >>MockEndpoint resultEndpoint = > > > >> context.getEndpoint("mock:result", > > > >> MockEndpoint.class); > > > >>resultEndpoint.expectedMessageCount(1); > > > >> > > > >> > resultEndpoint.message(0).header("addr").isEqualTo("my_test_value"); > > > >> > > > >> resultEndpoint.message(0).header("id").isEqualTo("abcd1234"); > > > >> > > > >> > > > >> At run time, the request does arrive as a PUT to > > > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 > > > >> > > > >> However, I am only getting the "addr" path parameter in the header. > > > >> The query param "id" is missing. > > > >> Am I doing something wrong on the definition? I pieced together > > > >> the way to do it from disparate tidbits on the net. > > > >> > > > >> Thanks, > > > >> -Steve > > > >> > > > >
Re: Not seeing query params on REST DSL
Apologies as I missed this. As far as I know, you need to explicitly register your query params. They are not automatically propagated. John On Mon, Apr 25, 2016 at 1:33 PM Steve Huston wrote: > On the risk of aggravating people (sorry) popping this up to today's > content... any help is most welcome. > > Thanks! > -Steve > > > -Original Message- > > From: Steve Huston > > Sent: Wednesday, April 20, 2016 8:57 PM > > To: users@camel.apache.org > > Subject: Re: Not seeing query params on REST DSL > > > > I am using Camel 2.16.3 and restlet. > > > > -Steve > > > > > On Apr 20, 2016, at 7:27 PM, John D. Ament > > wrote: > > > > > > Steve > > > > > > Could you share your dependencies as well? Which rest runtime are you > > > using? > > > On Apr 20, 2016 17:12, "Steve Huston" wrote: > > > > > >> I am using the REST DSL in a Camel SCR unit test. I have a route > > >> (being > > >> tested) that will initiate a http request at this URL: > > >> > > >>@Test > > >>public void testRoutes() throws Exception { > > >>context.addRoutes(new RouteBuilder() { > > >>@Override > > >>public void configure() throws Exception { > > >> > > >> restConfiguration().component("restlet").port(9000); > > >>rest("/asset") > > >>.put("/{addr}/pong") > > >> .param().name("id").type(RestParamType.query).endParam() > > >>.to("log:steve?showAll=true") > > >>.to("mock:result"); > > >>} > > >>}); > > >> > > >>MockEndpoint resultEndpoint = > > >> context.getEndpoint("mock:result", > > >> MockEndpoint.class); > > >>resultEndpoint.expectedMessageCount(1); > > >> > > >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value"); > > >>resultEndpoint.message(0).header("id").isEqualTo("abcd1234"); > > >> > > >> > > >> At run time, the request does arrive as a PUT to > > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 > > >> > > >> However, I am only getting the "addr" path parameter in the header. > > >> The query param "id" is missing. > > >> Am I doing something wrong on the definition? I pieced together the > > >> way to do it from disparate tidbits on the net. > > >> > > >> Thanks, > > >> -Steve > > >> > >
RE: Not seeing query params on REST DSL
On the risk of aggravating people (sorry) popping this up to today's content... any help is most welcome. Thanks! -Steve > -Original Message- > From: Steve Huston > Sent: Wednesday, April 20, 2016 8:57 PM > To: users@camel.apache.org > Subject: Re: Not seeing query params on REST DSL > > I am using Camel 2.16.3 and restlet. > > -Steve > > > On Apr 20, 2016, at 7:27 PM, John D. Ament > wrote: > > > > Steve > > > > Could you share your dependencies as well? Which rest runtime are you > > using? > > On Apr 20, 2016 17:12, "Steve Huston" wrote: > > > >> I am using the REST DSL in a Camel SCR unit test. I have a route > >> (being > >> tested) that will initiate a http request at this URL: > >> > >>@Test > >>public void testRoutes() throws Exception { > >>context.addRoutes(new RouteBuilder() { > >>@Override > >>public void configure() throws Exception { > >> > >> restConfiguration().component("restlet").port(9000); > >>rest("/asset") > >>.put("/{addr}/pong") > >> .param().name("id").type(RestParamType.query).endParam() > >>.to("log:steve?showAll=true") > >>.to("mock:result"); > >>} > >>}); > >> > >>MockEndpoint resultEndpoint = > >> context.getEndpoint("mock:result", > >> MockEndpoint.class); > >>resultEndpoint.expectedMessageCount(1); > >> > >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value"); > >>resultEndpoint.message(0).header("id").isEqualTo("abcd1234"); > >> > >> > >> At run time, the request does arrive as a PUT to > >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 > >> > >> However, I am only getting the "addr" path parameter in the header. > >> The query param "id" is missing. > >> Am I doing something wrong on the definition? I pieced together the > >> way to do it from disparate tidbits on the net. > >> > >> Thanks, > >> -Steve > >>
Re: Not seeing query params on REST DSL
I am using Camel 2.16.3 and restlet. -Steve > On Apr 20, 2016, at 7:27 PM, John D. Ament wrote: > > Steve > > Could you share your dependencies as well? Which rest runtime are you > using? > On Apr 20, 2016 17:12, "Steve Huston" wrote: > >> I am using the REST DSL in a Camel SCR unit test. I have a route (being >> tested) that will initiate a http request at this URL: >> >>@Test >>public void testRoutes() throws Exception { >>context.addRoutes(new RouteBuilder() { >>@Override >>public void configure() throws Exception { >> >> restConfiguration().component("restlet").port(9000); >>rest("/asset") >>.put("/{addr}/pong") >> .param().name("id").type(RestParamType.query).endParam() >>.to("log:steve?showAll=true") >>.to("mock:result"); >>} >>}); >> >>MockEndpoint resultEndpoint = context.getEndpoint("mock:result", >> MockEndpoint.class); >>resultEndpoint.expectedMessageCount(1); >> >> resultEndpoint.message(0).header("addr").isEqualTo("my_test_value"); >>resultEndpoint.message(0).header("id").isEqualTo("abcd1234"); >> >> >> At run time, the request does arrive as a PUT to >> http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 >> >> However, I am only getting the "addr" path parameter in the header. The >> query param "id" is missing. >> Am I doing something wrong on the definition? I pieced together the way to >> do it from disparate tidbits on the net. >> >> Thanks, >> -Steve >>
Re: Not seeing query params on REST DSL
Steve Could you share your dependencies as well? Which rest runtime are you using? On Apr 20, 2016 17:12, "Steve Huston" wrote: > I am using the REST DSL in a Camel SCR unit test. I have a route (being > tested) that will initiate a http request at this URL: > > @Test > public void testRoutes() throws Exception { > context.addRoutes(new RouteBuilder() { > @Override > public void configure() throws Exception { > > restConfiguration().component("restlet").port(9000); > rest("/asset") > .put("/{addr}/pong") > .param().name("id").type(RestParamType.query).endParam() > .to("log:steve?showAll=true") > .to("mock:result"); > } > }); > > MockEndpoint resultEndpoint = context.getEndpoint("mock:result", > MockEndpoint.class); > resultEndpoint.expectedMessageCount(1); > > resultEndpoint.message(0).header("addr").isEqualTo("my_test_value"); > resultEndpoint.message(0).header("id").isEqualTo("abcd1234"); > > > At run time, the request does arrive as a PUT to > http://127.0.0.1:9000/asset/my_test_value/pong?id=abcd1234 > > However, I am only getting the "addr" path parameter in the header. The > query param "id" is missing. > Am I doing something wrong on the definition? I pieced together the way to > do it from disparate tidbits on the net. > > Thanks, > -Steve >