You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Joseph Featherston <je...@ccri.com> on 2013/09/20 22:49:25 UTC

Possible Bug. Scala recipient list http turning %2B into plus

Hi all,
So I'm trying to hit solr through camel and in the url there needs to be 
some pluses. Specifically to specify time facet gap "/HOUR+1HOUR".
 From googling I haven't seen any talk of this problem yet. I've tried 
java.util.URLEncoder and Decoder in numerous places inside and outside 
of the route to no avail.
For example in the REPL:

import org.apache.camel.impl.DefaultCamelContext
import org.apache.camel.scala.dsl.builder.RouteBuilder
val ctx = new DefaultCamelContext()
val rs =
     new RouteBuilder {
       from("direct:thing") ==> {
         recipients(e => e.in[String])
         to("log:debug?showAll=true")
       }
}
ctx.addRoutes(rs)
ctx.start()
ctx.createProducerTemplate().requestBody("direct:thing", 
"http://localhost:8080/solr/select?q=*:*&facet.range=datetime&f.datetime.facet.range.start=2010-01-01T00%3A00%3A00.000Z&f.datetime.facet.range.end=2010-01-10T00%3A00%3A00.000Z&f.datetime.facet.range.gap=%2FDAY%2B1DAY&facet=true&facet.limit=10&facet.mincount=1")

or really any address where you get a 400 error and can see in the 
message getting passed in is still %2B but then in the from the 
HTTPException that it has changed to a +.

Caused by: org.apache.camel.component.http.HttpOperationFailedException: 
HTTP operation failed invoking 
http://localhost:8080/solr/select?f.datetime.facet.range.end=2010-01-10T00%3A00%3A00.000Z&f.datetime.facet.range.gap=%2FDAY+1DAY&f.datetime.facet.range.start=2010-01-01T00%3A00%3A00.000Z&facet=true&facet.limit=10&facet.mincount=1&facet.range=datetime&q=*%3A* 
with statusCode: 400
     at 
org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:228)
     at 
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:156)
     at 
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)

Thanks for any help,
Joseph


Using scala 2.10.0
Camel 2.11.0
Java 7

Re: Possible Bug. Scala recipient list http turning %2B into plus

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See this page, about using raw
http://camel.apache.org/how-do-i-configure-endpoints.html

On Fri, Sep 20, 2013 at 10:49 PM, Joseph Featherston <je...@ccri.com> wrote:
> Hi all,
> So I'm trying to hit solr through camel and in the url there needs to be
> some pluses. Specifically to specify time facet gap "/HOUR+1HOUR".
> From googling I haven't seen any talk of this problem yet. I've tried
> java.util.URLEncoder and Decoder in numerous places inside and outside of
> the route to no avail.
> For example in the REPL:
>
> import org.apache.camel.impl.DefaultCamelContext
> import org.apache.camel.scala.dsl.builder.RouteBuilder
> val ctx = new DefaultCamelContext()
> val rs =
>     new RouteBuilder {
>       from("direct:thing") ==> {
>         recipients(e => e.in[String])
>         to("log:debug?showAll=true")
>       }
> }
> ctx.addRoutes(rs)
> ctx.start()
> ctx.createProducerTemplate().requestBody("direct:thing",
> "http://localhost:8080/solr/select?q=*:*&facet.range=datetime&f.datetime.facet.range.start=2010-01-01T00%3A00%3A00.000Z&f.datetime.facet.range.end=2010-01-10T00%3A00%3A00.000Z&f.datetime.facet.range.gap=%2FDAY%2B1DAY&facet=true&facet.limit=10&facet.mincount=1")
>
> or really any address where you get a 400 error and can see in the message
> getting passed in is still %2B but then in the from the HTTPException that
> it has changed to a +.
>
> Caused by: org.apache.camel.component.http.HttpOperationFailedException:
> HTTP operation failed invoking
> http://localhost:8080/solr/select?f.datetime.facet.range.end=2010-01-10T00%3A00%3A00.000Z&f.datetime.facet.range.gap=%2FDAY+1DAY&f.datetime.facet.range.start=2010-01-01T00%3A00%3A00.000Z&facet=true&facet.limit=10&facet.mincount=1&facet.range=datetime&q=*%3A*
> with statusCode: 400
>     at
> org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:228)
>     at
> org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:156)
>     at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>     at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>
> Thanks for any help,
> Joseph
>
>
> Using scala 2.10.0
> Camel 2.11.0
> Java 7



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen