Re: Servlet Component with REST DSL: problem in URI query string construction?
Thanks Willem, I did try a search in Jira, when I followed the link you provided it's no surprise I didn't find the issue since I was searching on all the wrong terms! :-) I had things like servlet query string rest dsl, none of which matched. Remedial search school for me I guess ;-) In terms of how I can bring this fix into my application, is there a point release I can declare in maven? That is, 2.14.1 or similar? I am unable to use a SNAPSHOT release or a custom patched version in my application for policy reasons. If it's not possible then no problem I can work around it in the short term. Thanks again. Regards, Rod. On 18 November 2014 17:52, Willem Jiang willem.ji...@gmail.com wrote: It’s a bug of Camel[1] which has been fixed few weeks ago. [1]https://issues.apache.org/jira/browse/CAMEL-7971 -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 18, 2014 at 11:32:30 AM, rvanluinen (rvanlui...@gmail.com) wrote: I have been experimenting with Camel 2.14.0 and the REST DSL using the servlet component. I have followed the code in the example, however for reasons of my own I'd like to use a different servlet name than the default of CamelServlet. This works fine with vanilla servlet:/// URIs - add ?servletName=my-servlet and all is good. To do this with the REST DSL I use the following: restConfiguration().component(servlet).endpointProperty(servletName, my-servlet); rest(/rest).post().otherDSLStatements; Contrary to what I thought, endpointProperty and not componentProperty sees this property added to the URI. The problem is, it doesn't work. I stepped through the code and it appears the problem is that the URI that gets constructed for my post prior to being turned into a rest:// URI looks something like: servlet:///rest?httpMethodRestrict=POST?servletName=my-servlet. Which doesn't get correctly parsed by URISupport.parseQuery() since it doesn't separate the second key/value pair using an ampersand ('') as you might expect. The code from ServletComponent looks like this (lines 194-197): String url = servlet:///%s?httpMethodRestrict=%s; if (!query.isEmpty()) { url = url + ? + query; } I can also confirm that using the debugger and changing the second '?' to '' results in the behaviour that I'd expect to see, which is that my-servlet actually handles the request. I don't think I'm doing anything screwy here, can anyone else confirm they've had similar problems or not? I think it's a bug but following etiquette I'm posting here first and not raising issues in Jira immediately. Regards, Rod -- View this message in context: http://camel.465427.n5.nabble.com/Servlet-Component-with-REST-DSL-problem-in-URI-query-string-construction-tp5759228.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Servlet Component with REST DSL: problem in URI query string construction?
I’m afraid you have to wait for the release of Camel 2.14.1 which will be released in next month. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 18, 2014 at 5:48:56 PM, Rodney van Luinen (rvanlui...@gmail.com) wrote: Thanks Willem, I did try a search in Jira, when I followed the link you provided it's no surprise I didn't find the issue since I was searching on all the wrong terms! :-) I had things like servlet query string rest dsl, none of which matched. Remedial search school for me I guess ;-) In terms of how I can bring this fix into my application, is there a point release I can declare in maven? That is, 2.14.1 or similar? I am unable to use a SNAPSHOT release or a custom patched version in my application for policy reasons. If it's not possible then no problem I can work around it in the short term. Thanks again. Regards, Rod. On 18 November 2014 17:52, Willem Jiang wrote: It’s a bug of Camel[1] which has been fixed few weeks ago. [1]https://issues.apache.org/jira/browse/CAMEL-7971 -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 18, 2014 at 11:32:30 AM, rvanluinen (rvanlui...@gmail.com) wrote: I have been experimenting with Camel 2.14.0 and the REST DSL using the servlet component. I have followed the code in the example, however for reasons of my own I'd like to use a different servlet name than the default of CamelServlet. This works fine with vanilla servlet:/// URIs - add ?servletName=my-servlet and all is good. To do this with the REST DSL I use the following: restConfiguration().component(servlet).endpointProperty(servletName, my-servlet); rest(/rest).post().otherDSLStatements; Contrary to what I thought, endpointProperty and not componentProperty sees this property added to the URI. The problem is, it doesn't work. I stepped through the code and it appears the problem is that the URI that gets constructed for my post prior to being turned into a rest:// URI looks something like: servlet:///rest?httpMethodRestrict=POST?servletName=my-servlet. Which doesn't get correctly parsed by URISupport.parseQuery() since it doesn't separate the second key/value pair using an ampersand ('') as you might expect. The code from ServletComponent looks like this (lines 194-197): String url = servlet:///%s?httpMethodRestrict=%s; if (!query.isEmpty()) { url = url + ? + query; } I can also confirm that using the debugger and changing the second '?' to '' results in the behaviour that I'd expect to see, which is that my-servlet actually handles the request. I don't think I'm doing anything screwy here, can anyone else confirm they've had similar problems or not? I think it's a bug but following etiquette I'm posting here first and not raising issues in Jira immediately. Regards, Rod -- View this message in context: http://camel.465427.n5.nabble.com/Servlet-Component-with-REST-DSL-problem-in-URI-query-string-construction-tp5759228.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Servlet Component with REST DSL: problem in URI query string construction?
It’s a bug of Camel[1] which has been fixed few weeks ago. [1]https://issues.apache.org/jira/browse/CAMEL-7971 -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On November 18, 2014 at 11:32:30 AM, rvanluinen (rvanlui...@gmail.com) wrote: I have been experimenting with Camel 2.14.0 and the REST DSL using the servlet component. I have followed the code in the example, however for reasons of my own I'd like to use a different servlet name than the default of CamelServlet. This works fine with vanilla servlet:/// URIs - add ?servletName=my-servlet and all is good. To do this with the REST DSL I use the following: restConfiguration().component(servlet).endpointProperty(servletName, my-servlet); rest(/rest).post().otherDSLStatements; Contrary to what I thought, endpointProperty and not componentProperty sees this property added to the URI. The problem is, it doesn't work. I stepped through the code and it appears the problem is that the URI that gets constructed for my post prior to being turned into a rest:// URI looks something like: servlet:///rest?httpMethodRestrict=POST?servletName=my-servlet. Which doesn't get correctly parsed by URISupport.parseQuery() since it doesn't separate the second key/value pair using an ampersand ('') as you might expect. The code from ServletComponent looks like this (lines 194-197): String url = servlet:///%s?httpMethodRestrict=%s; if (!query.isEmpty()) { url = url + ? + query; } I can also confirm that using the debugger and changing the second '?' to '' results in the behaviour that I'd expect to see, which is that my-servlet actually handles the request. I don't think I'm doing anything screwy here, can anyone else confirm they've had similar problems or not? I think it's a bug but following etiquette I'm posting here first and not raising issues in Jira immediately. Regards, Rod -- View this message in context: http://camel.465427.n5.nabble.com/Servlet-Component-with-REST-DSL-problem-in-URI-query-string-construction-tp5759228.html Sent from the Camel - Users mailing list archive at Nabble.com.