camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rvanluinen <>
Subject Servlet Component with REST DSL: problem in URI query string construction?
Date Tue, 18 Nov 2014 03:31:32 GMT
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:


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:

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.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message