You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by 朱 巍 <zh...@icloud.com> on 2013/10/25 07:33:05 UTC
a question on servlet component
hi,camel riders
Very sorry to interrupt you. My name is Zhu Wei, i'm from China. I am new to camel, now when i using camel servlet component i meet a problem, it trapped me for several days, i see you are very eager to help people, so i write this email hope to get some help from you.
the case is: i use a jsp page to post some data to my camel servlet, then camel bridge this request to a external HTTP url, the external HTTP url is a simple servlet, it just reply a string to the original requester (response.getWriter().print("Hello World~~")). my thinking is it will be displayed on the requester's browser.
camel configuration like below:
<from uri="servlet:///hello" />
<to uri="http://192.168.81.1:8080/ext/externalApp?bridgeEndpoint=true"/>
the problem is: the request browser can receive the response, but it will pop up a dialog box to ask you if want to save a file...i open this file, the content is the string from the external app, it seems the browser couldn't recognize the response.
Do you know the root cause? Hope hear some voice from you.
regards!
zhu wei
Re: a question on servlet component
Posted by Willem jiang <wi...@gmail.com>.
The camel route define just pass the response without changing any thing.
You can use setHeader DSL to set the content-type to workaround it if you don’t want to change the jsp page.
<from uri="servlet:///hello" />
<to uri="http://192.168.81.1:8080/ext/externalApp?bridgeEndpoint=true"/>
<setOutHeader headerName="Content-Type”>
<constant>text/html</constant>
<setOutHeader>
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Friday, October 25, 2013 at 3:27 PM, gquintana wrote:
> If you want your browser to display the response as a web page, then you
> should set Content Type header with text/html value.
>
> Gérald
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/a-question-on-servlet-component-tp5742164p5742168.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Re: a question on servlet component
Posted by gquintana <ge...@gmail.com>.
If you want your browser to display the response as a web page, then you
should set Content Type header with text/html value.
Gérald
--
View this message in context: http://camel.465427.n5.nabble.com/a-question-on-servlet-component-tp5742164p5742168.html
Sent from the Camel - Users mailing list archive at Nabble.com.