Re: Simple IN with empty value in list

2016-12-02 Thread Karts
Thanks Claus, the double comma works well.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790960.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Simple IN with empty value in list

2016-12-02 Thread Karts
In the end I just used .process() before the choice, got body.stringValue in
the Java code, tested and set an exchange header "isValid" to "true" if so,
and then subsequently tested for this in simple.

I didn't use something like .choice.when.simple("${body.stringValue.isEmpty}
|| ${body.stringValue} in 'gold,silver’")  as the simple block has multiple
&& and parentheses aren't supported yet for an || condition inside of there,
i.e. operator precedence. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790937.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Simple IN with empty value in list

2016-12-02 Thread Karts
Sorry, to be clear, body.stringValue could be "", "gold", "silver", "bronze",
"platinum", etc.

I am trying to test so that only "", "gold" or "silver" are allowed before
moving forward, which is why I have the comma at the start, to allow for a
blank (not null) value:

.choice.when.simple("${body.stringValue} in ',gold,silver'")

But I'm finding if body.stringValue="", it does not satisfy the condition.
Is there another way I can do this?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907p5790926.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Simple IN with empty value in list

2016-12-01 Thread Karts
Hi,

I'm trying to use simple to test for an empty value in a list, so something
like:

simple("${body.stringValue} in ',gold,silver'")

It doesn't seem to work though, if body.stringValue is '' this fails.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Simple-IN-with-empty-value-in-list-tp5790907.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Tracer and Logstash

2016-10-12 Thread Karts
In case anyone needs it, we used grok to achieve this:

if [path] =~ "Tracer" {
grok {
patterns_dir => ["./extra_patterns"]
match => {
"message" => "^\n%{USERNAME:id} >>>
\(%{USERNAME:routeId}\) %{GREEDYDATA:source} --> %{GREEDYDATA:destination}
<<<\n, Pattern:%{WORD:pattern}\n,
Headers:{%{MULTILINEGREEDYDATA:headers}}\n, BodyType:%{JAVAFILE:bodyType}\n,
Body:%{GREEDYDATA:body}"
}
}
kv {
source => "headers"
field_split => ","
}
  }




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Tracer-and-Logstash-tp5788502p5788689.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Bindy KeyValuePairField where key is a String

2016-10-11 Thread Karts
Hi

I have the following message I'd like to unmarshal into a POJO with Bindy :
KeyABC=value1:KeyDEF=value2:

It looks like the key (i.e. tag) needs to be an int. Is there any way with
Bindy to handle this kind of format?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Bindy-KeyValuePairField-where-key-is-a-String-tp5788633.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Tracer and Logstash

2016-10-07 Thread Karts
Has anyone managed to integrate Camel logs with Logstash/Elasticsearch?

I've got tracer and MDC logging enabled in my CamelContext and am sending
logs to Logstash via log4j TCP appender. This is working great (especially
MDC fields), but I'm trying to further parse and filter the message to
individual fields in Elasticsearch.

For example, my message is:
ID-dx123abc001-abc-com-42264-1475782902034-0-193168 >>> (system-sql)
setHeader[Content-Type, application/json] -->
marshal[org.apache.camel.component.jackson.JacksonDataFormat@7e38f55] <<<
Pattern:InOut, Headers:{Accept-Encoding=gzip, deflate, Authorization=Basic
XRpeDpreG1pZGFz,
breadcrumbId=ID-dx123abc001-abc-com-42264-1475782902034-0-193169,
CamelHttpMethod=GET, CamelHttpPath=, CamelHttpQuery=name=new-strategies,
CamelHttpServletRequest=Request(GET
/esb/system/sql?name=new-strategies)@6aaa8b00,
CamelHttpServletResponse=HTTP/1.1 200 , CamelHttpUri=/esb/system/sql,
CamelHttpUrl=http://system.abc.com:51950/esb/system/sql,
CamelJdbcColumnNames=[STRATEGY_NAME], CamelJdbcRowCount=2,
CamelServletContextPath=/esb/system/sql, Connection=keep-alive,
Content-Type=application/json, Host=system.abc.com:51950,
name=new-strategies, User-Agent=Apache-HttpClient/4.2.1 (java 1.5)},
BodyType:java.util.ArrayList, Body:[{STRATEGY_NAME=S1 }, {STRATEGY_NAME=S2
}]

And I would like logstash to parse and filter this so that it is stored in
Elasticsearch as individual fields:
...
from=setHeader[Content-Type, application/json]
to=marshal[org.apache.camel.component.jackson.JacksonDataFormat@7e38f55] 
breadcrumbId=ID-dx123abc001-abc-com-42264-1475782902034-0-193169
CamelJdbcColumnNames=[STRATEGY_NAME]
CamelJdbcRowCount=2
BodyType:java.util.ArrayList
Body:[{STRATEGY_NAME=S1 }, {STRATEGY_NAME=S2 }]
etc.

Has anyone been able to do this? I'm struggling with getting this to work
with grok or ruby in the logstash config. Any tips are appreciated!

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Tracer-and-Logstash-tp5788502.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Error handler message history route stacktrace - truncated

2016-08-24 Thread Karts
Hi,

When an exception is thrown and the Message History is dumped, each of the
columns appears to be truncated beyond a certain length:

Message History
---
RouteId  ProcessorId  Processor 
  
Elapsed (ms)
[systemBridge-syste] [systemBridge-syste] [sql:select t1.usr from table t1,
table t2 where t1.reference=t2.reference and ] [  3020]

Is this configurable? I would like to log the full RouteId, ProcessorId and
Processor.

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Error-handler-message-history-route-stacktrace-truncated-tp5786689.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Disabling concurrency in camel route

2016-08-17 Thread Karts
I believe you can just set .threads(1)



--
View this message in context: 
http://camel.465427.n5.nabble.com/Disabling-concurrency-in-camel-route-tp5786531p5786535.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Tracer multiline

2016-07-28 Thread Karts
Hi,

I have tracing enabled with http://camel.465427.n5.nabble.com/Tracer-multiline-tp5785600.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: camel sql joined query with parameters won't run on sql server

2016-07-20 Thread Karts
I have the same issue with sql server, but it seems to be related to alias +
named param rather than a joined query.

The following works fine:

.setHeader("ExternalRef", simple("1234"))
.to("sql:select event from events where id= :#ExternalRef")

But if I alias the table :

.setHeader("ExternalRef", simple("1234"))
.to("sql:select t.event from events t where t.id= :#ExternalRef")

I get an exception 
com.microsoft.sqlserver.jdbc.SQLServerException: The multi-part identifier
"t.id" could not be bound.

If I hard-code it works fine:
.to("sql:select t.event from events t where t.id= '1234' ")

This seems specific to sql server driver, it works when using the jTDS
driver.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-sql-joined-query-with-parameters-won-t-run-on-sql-server-tp5784402p5785280.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel SSH no password

2015-12-29 Thread Karts
It is possible to set up command line ssh to not require a password or file.

I can currently do this with:
uname1@server1:~$ ssh -q uname2@server2

But I can't get this to work with Camel (being run as uname1 on server1). If
I do:

.to("ssh://uname2@server2") 

I get a java.lang.NullPointerException exception.

If I try to give a blank password by just adding a colon:

.to("ssh://uname2:@server2") 

I now get org.apache.camel.RuntimeCamelException - Failed to authenticate
username uname2

Is this possible? 

FYI I'm using Camel 2.16.1

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-SSH-no-password-tp5775592.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Rest DSL Jetty multiple handlers causes java.lang.StackOverflowError

2015-11-03 Thread Karts
FYI as a workaround to this issue, I put the securityHandler in the
restConfiguration and simply added an empty route with the other handler to
my camel context:






http://localhost:8080?handlers=jettyRequestLog"/>



--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-Jetty-multiple-handlers-causes-java-lang-StackOverflowError-tp5772952p5773363.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Jetty server startup warnings when using handlers in Rest DSL

2015-10-22 Thread Karts
Hi,

When I have my restConfiguration as follows:














When the app is starting, I'm finding the logs are as follows:

2015-10-22 10:06:07,381 [main   ] INFO  Server
- jetty-9.2.11.v20150529
2015-10-22 10:06:07,381 [main   ] WARN  AbstractHandler   
- No Server set for
org.apache.camel.component.jetty.JettyHttpComponent$1@9cb5843
2015-10-22 10:06:07,382 [main   ] INFO  ContextHandler
- Started o.e.j.s.ServletContextHandler@6c9edf18{/,null,AVAILABLE}
2015-10-22 10:06:07,382 [main   ] INFO  ServerConnector   
- Started ServerConnector@365fb621{HTTP/1.1}{0.0.0.0:8080}
2015-10-22 10:06:07,382 [main   ] INFO  Server
- Started @9985ms
2015-10-22 10:06:07,382 [main   ] INFO  SpringCamelContext
- Route: route-route1 started and consuming from:
Endpoint[jetty:http://0.0.0.0:8080/routes/route/route1?httpMethodRestrict=GET]
2015-10-22 10:06:07,413 [main   ] INFO  ServerConnector   
- Stopped ServerConnector@365fb621{HTTP/1.1}{0.0.0.0:8080}
2015-10-22 10:06:07,413 [main   ] INFO  ContextHandler
- Stopped o.e.j.s.ServletContextHandler@6c9edf18{/,null,UNAVAILABLE}
2015-10-22 10:06:07,413 [main   ] INFO  Server
- jetty-9.2.11.v20150529
2015-10-22 10:06:07,413 [main   ] WARN  AbstractHandler   
- No Server set for
org.apache.camel.component.jetty.JettyHttpComponent$1@9cb5843
2015-10-22 10:06:07,413 [main   ] INFO  ContextHandler
- Started o.e.j.s.ServletContextHandler@6c9edf18{/,null,AVAILABLE}
2015-10-22 10:06:07,429 [main   ] INFO  ServerConnector   
- Started ServerConnector@365fb621{HTTP/1.1}{0.0.0.0:8080}
2015-10-22 10:06:07,429 [main   ] INFO  Server
- Started @10032ms
2015-10-22 10:06:07,429 [main   ] INFO  SpringCamelContext
- Route: route-route2 started and consuming from:
Endpoint[jetty:http://0.0.0.0:8080/routes/route/route2?httpMethodRestrict=GET]
2015-10-22 10:06:07,429 [main   ] INFO  SpringCamelContext
- Total 2 routes, of which 2 is started.
2015-10-22 10:06:07,429 [main   ] INFO  SpringCamelContext
- Apache Camel 2.16.0 (CamelContext: routes) started in 0.921 seconds

It seems to work fine, but I'm not sure why we have the warnings and
stop/starts above.

If I do not include the handlers endPointProperty, it starts well:

2015-10-22 10:13:21,521 [main   ] INFO  Server
- jetty-9.2.11.v20150529
2015-10-22 10:13:21,521 [main   ] WARN  AbstractHandler   
- No Server set for
org.apache.camel.component.jetty.JettyHttpComponent$1@4d7f405e
2015-10-22 10:13:21,522 [main   ] INFO  ContextHandler
- Started o.e.j.s.ServletContextHandler@35926cb6{/,null,AVAILABLE}
2015-10-22 10:13:21,522 [main   ] INFO  ServerConnector   
- Started ServerConnector@51ebde29{HTTP/1.1}{0.0.0.0:8080}
2015-10-22 10:13:21,522 [main   ] INFO  Server
- Started @9554ms
2015-10-22 10:13:21,522 [main   ] INFO  SpringCamelContext
- Route: route-route1 started and consuming from:
Endpoint[jetty:http://0.0.0.0:8080/routes/route/route1?httpMethodRestrict=GET]
2015-10-22 10:13:21,553 [main   ] INFO  SpringCamelContext
- Route: route-route2 started and consuming from:
Endpoint[jetty:http://0.0.0.0:8080/routes/route/route2?httpMethodRestrict=GET]
2015-10-22 10:13:21,553 [main   ] INFO  SpringCamelContext
- Total 2 routes, of which 2 is started.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Jetty-server-startup-warnings-when-using-handlers-in-Rest-DSL-tp5772973.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Rest DSL Jetty multiple handlers causes java.lang.StackOverflowError

2015-10-22 Thread Karts
This seems similar to https://issues.jboss.org/browse/ENTESB-2619 

Also for brevity, below are the two handler beans:


   
   
   



   
   



   
  
   
   
  
   
   
  
 
  
   














--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-Jetty-multiple-handlers-causes-java-lang-StackOverflowError-tp5772952p5772972.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Rest DSL Jetty multiple handlers causes java.lang.StackOverflowError

2015-10-21 Thread Karts
Hi,

On 2.16.0, I am getting a StackOverflowError when I have multiple handlers
defined for my restConfiguration jetty component. It works with single
handlers.





This causes the following exception on startup: 

2015-10-21 21:29:59,543 [main   ] WARN  AbstractLifeCycle 
- FAILED org.eclipse.jetty.server.Server@58035754:
java.lang.StackOverflowError
java.lang.StackOverflowError
at
org.eclipse.jetty.server.handler.AbstractHandlerContainer.expandHandler(AbstractHandlerContainer.java:80)
at
org.eclipse.jetty.server.handler.HandlerWrapper.expandChildren(HandlerWrapper.java:123)
...(loops)

If I just use either securityHandler or jettyRequestLog alone, it works
fine. 

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-Jetty-multiple-handlers-causes-java-lang-StackOverflowError-tp5772952.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel tracer logs in hawtio

2015-10-20 Thread Karts
Thank you! I can confirm it works very well



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-tracer-logs-in-hawtio-tp5772869p5772917.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel tracer logs in hawtio

2015-10-20 Thread Karts
Would it work if we run Camel as a standalone app with hawtio embedded? It
should be possible for us to switch to this.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-tracer-logs-in-hawtio-tp5772869p5772910.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel tracer logs in hawtio

2015-10-19 Thread Karts
Hi,

I have Camel deployed as a war in a Jetty container, along with hawtio as a
war as well.

Everything works well and as expected, but I am wondering if I can see the
Camel tracer interceptor logs in the Logs tab of hawtio. 

I have tracing enabled with the usual:

http://camel.apache.org/schema/spring; trace="true"
...>

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-tracer-logs-in-hawtio-tp5772869.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Stream Cache / spool file deletion when marshaling to JSON with Jackson

2015-10-15 Thread Karts
Confirmed this is working fine now on Camel 2.16. Thanks!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Stream-Cache-spool-file-deletion-when-marshaling-to-JSON-with-Jackson-tp5769699p5772690.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Stream Cache / spool file deletion when marshaling to JSON with Jackson

2015-09-05 Thread Karts
Our restConfiguration is as follows:



And we have Restlet simply as:







 



The war file sits in a Jetty 9 container.

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Stream-Cache-spool-file-deletion-when-marshaling-to-JSON-with-Jackson-tp5769699p5771274.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Stream Cache / spool file deletion when marshaling to JSON with Jackson

2015-08-31 Thread Karts
Hi,

We just upgraded to Camel 2.15.3 but this issue still remains unfortunately.

Stack trace from 2.15.3 is below:

java.io.FileNotFoundException:
/tmp/camel/camel-tmp-3b981524-ca86-4989-b74e-1f5655381add/cos8487311535309884732.tmp
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:146)
at
org.apache.camel.converter.stream.FileInputStreamCache.createInputStream(FileInputStreamCache.java:133)
at
org.apache.camel.converter.stream.FileInputStreamCache.getInputStream(FileInputStreamCache.java:127)
at
org.apache.camel.converter.stream.FileInputStreamCache.read(FileInputStreamCache.java:122)
at java.io.InputStream.read(InputStream.java:170)
at java.io.InputStream.read(InputStream.java:101)
at org.restlet.engine.io.IoUtils.copy(IoUtils.java:106)
at
org.restlet.representation.InputRepresentation.write(InputRepresentation.java:148)
at
org.restlet.engine.adapter.ServerCall.writeResponseBody(ServerCall.java:519)
at
org.restlet.engine.adapter.ServerCall.sendResponse(ServerCall.java:463)
at
org.restlet.ext.servlet.internal.ServletCall.sendResponse(ServletCall.java:430)
at
org.restlet.engine.adapter.ServerAdapter.commit(ServerAdapter.java:196)
at
org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:153)
at
org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at

Marshalling a ListMap to CSV with headers

2015-07-30 Thread Karts
Hi,

Using Camel version 2.15.2, I'm trying to get the Map key as the header in
the CSV file.

Consider the following body:
ListMaplt;String,String body = new ArrayListMaplt;String,String();
MapString,String map1 = new LinkedHashMapString,String();
map1.put(food, pizza);
map1.put(drink, coke);
body.add(map1);
MapString,String map2 = new LinkedHashMapString,String();
map2.put(food, burger);
map2.put(drink, pepsi);
body.add(map2);

And this Java route definition:
from(direct:start)
.marshal().csv()
.to(mock:result);

I would like to produce
food, drink  (headers)
pizza, coke
burger, pepsi

I'm currently not able to get the header, I can only produce:
pizza, coke
burger, pepsi

Is this possible?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Marshalling-a-List-Map-to-CSV-with-headers-tp5770117.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Stream Cache / spool file deletion when marshaling to JSON with Jackson

2015-07-21 Thread Karts
Hi,

We're using Camel 2.15.2/Rest DSL/Restlet deployed as a war in a Jetty 9
container. Stream caching is enabled.

For one of our routes, we retrieve and transform XML to an
ArrayListMaplt;String, String and then marshal to JSON. A cleaned up
sample route is as follows:

public void configure() throws Exception {
rest(data)
.get(json-arraylist)
.route()
.policy(user)
.to(bean:dapRequest) //body is retrieved xml
.to(file:logs/xml?fileName=${header.breadcrumbId}-reply.xml)
.bean(Translator.class, getListMap) //converts to
ArrayListMaplt;String, String 
.marshal().json(JsonLibrary.Jackson);
}

For larger XMLs (~400kb on disk) , we're getting the stack below:

java.io.FileNotFoundException:
/tmp/camel/camel-tmp-c47151eb-854b-4f5c-bcff-752d2a81a30b/cos4570286139547325900.tmp
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.init(FileInputStream.java:146)
at
org.apache.camel.converter.stream.FileInputStreamCache.createInputStream(FileInputStreamCache.java:133)
at
org.apache.camel.converter.stream.FileInputStreamCache.getInputStream(FileInputStreamCache.java:127)
at
org.apache.camel.converter.stream.FileInputStreamCache.read(FileInputStreamCache.java:122)
at java.io.InputStream.read(InputStream.java:170)
at java.io.InputStream.read(InputStream.java:101)
at org.restlet.engine.io.IoUtils.copy(IoUtils.java:106)
at
org.restlet.representation.InputRepresentation.write(InputRepresentation.java:148)
at
org.restlet.engine.adapter.ServerCall.writeResponseBody(ServerCall.java:519)
at
org.restlet.engine.adapter.ServerCall.sendResponse(ServerCall.java:463)
at
org.restlet.ext.servlet.internal.ServletCall.sendResponse(ServletCall.java:430)
at
org.restlet.engine.adapter.ServerAdapter.commit(ServerAdapter.java:196)
at
org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:153)
at
org.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:1118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at

Validate DSL and message returned to client

2015-06-15 Thread Karts
Hi,

In my Rest DSL route, I use the Validate DSL and mvel to validate data as it
goes through the pipeline. If there's a validation exception, I would like
to return back to the client both an HTTP_RESPONSE_CODE 400 as well as the
reason for the error in the body. I'm able to set the HTTP response code but
not sure how I can customize the reason for each validation exception.

For example, in my route below:

@Override
public void configure() throws Exception {
onException(org.apache.camel.processor.validation.PredicateValidationException.class).handled(true).transform().simple(Validation
failed).setHeader(Exchange.HTTP_RESPONSE_CODE, constant(400));
rest(system)
.put(cancel-trade)
.route()
.validate().mvel(request.body.?extid  0)
.to(sql:select id from trades where outid = :#extid
?outputHeader=idoutputType=SelectOne)
.validate().mvel(request.headers.?id != null)
.to(mock:bean);

I currently only say Validation failed in the body in the case of a
PredicateValdiationException thrown. I would like to return a customized
human readable message though depending on each failure. So if the first
validate fails, I would like the reply to say External ID must be greater
than 0 and if the second validate fails Trade not found in trades table.

Is this possible with the Validate DSL?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Validate-DSL-and-message-returned-to-client-tp5768293.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: using basic auth to protect camel rest dsl routes

2015-06-15 Thread Karts
This is useful, but can we do rest dsl route level authentication with
embedded jetty? 

I was only able to do this with restlet in a jetty container, following the
spring security example.



--
View this message in context: 
http://camel.465427.n5.nabble.com/using-basic-auth-to-protect-camel-rest-dsl-routes-tp5768125p5768287.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel XQuery 3.0

2015-06-03 Thread Karts
Thanks, I have created JIRA CAMEL-8830



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-XQuery-3-0-tp5767434p5767843.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel XQuery 3.0

2015-05-27 Thread Karts
In fact it looks like XQuery 3.0 isn't supported in Saxon HE 9.5. It is the
default on 9.6 but that doesn't seem compatible with the current
implementation of XQueryBuilder:

Caused by: java.lang.NoSuchMethodError:
net.sf.saxon.Configuration.setHostLanguage(I)V
at
org.apache.camel.component.xquery.XQueryBuilder.initialize(XQueryBuilder.java:641)
at
org.apache.camel.component.xquery.XQueryBuilder.evaluateAsString(XQueryBuilder.java:198)
at
org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:120)
at
org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:110)
at
org.apache.camel.processor.SetBodyProcessor.process(SetBodyProcessor.java:47)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
... 88 more



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-XQuery-3-0-tp5767434p5767575.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel XQuery 3.0

2015-05-22 Thread Karts
Hi,

I would like to use the group by functionality provided with XQuery 3.0,
along with some other features.

Even though Camel 2.15.2 seems to be using Saxon 9.5.1-5 HE which supports
XQuery 3.0, I'm getting this exception:

Caused by: net.sf.saxon.trans.XPathException: 'group by' is not supported in
XQuery 1.0
at net.sf.saxon.query.QueryParser.grumble(QueryParser.java:453)
at
net.sf.saxon.expr.parser.ExpressionParser.grumble(ExpressionParser.java:226)
at
net.sf.saxon.expr.parser.ExpressionParser.grumble(ExpressionParser.java:213)
at 
net.sf.saxon.query.QueryParser.parseGroupByClause(QueryParser.java:2389)
at
net.sf.saxon.query.QueryParser.parseFLWORExpression(QueryParser.java:2091)
at
net.sf.saxon.expr.parser.ExpressionParser.parseExprSingle(ExpressionParser.java:499)
at
net.sf.saxon.expr.parser.ExpressionParser.parseExpression(ExpressionParser.java:464)
at net.sf.saxon.query.QueryParser.parseQuery(QueryParser.java:365)
at
net.sf.saxon.query.QueryParser.makeXQueryExpression(QueryParser.java:168)
at
net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:526)
at
org.apache.camel.component.xquery.XQueryBuilder$1.createQueryExpression(XQueryBuilder.java:242)
at
org.apache.camel.component.xquery.XQueryBuilder.initialize(XQueryBuilder.java:660)
at
org.apache.camel.component.xquery.XQueryBuilder.evaluateAsString(XQueryBuilder.java:198)
at
org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:120)
... 92 more

Digging further, it seems XQuery 3.0 needs to be explicitly enabled with
Saxon. 

Is there any way I can do this, or a possible workaround?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-XQuery-3-0-tp5767434.html
Sent from the Camel - Users mailing list archive at Nabble.com.