• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Request dispatch from one web app to another

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Here s my constraint. I have to use request dispatch from one web app to another. I cant use sendRedirect because i do not want to lose the request header. i am using Tomcat 6 as my server. Is there a way to do it?
 
Sheriff
Posts: 7140
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

karthik aswin wrote:because i do not want to lose the request header....... Is there a way to do it?


No way to transfer the request object to another web application. But you can wrap those headers into a SOAP message and send to the other web application through a web service.

Devaka
 
karthik aswin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Devaka Cooray wrote:

karthik aswin wrote:because i do not want to lose the request header....... Is there a way to do it?


No way to transfer the request object to another web application. But you can wrap those headers into a SOAP message and send to the other web application through a web service.

Devaka



But i heard that If i get the request dispatcher from context, i can pass my request across the application.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since we're talking about Tomcat here, it is, in fact, possible. It is achieved by setting the crossContext attribute of the Context to true. See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html for details.
 
karthik aswin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Since we're talking about Tomcat here, it is, in fact, possible. It is achieved by setting the crossContext attribute of the Context to true. See http://tomcat.apache.org/tomcat-6.0-doc/config/context.html for details.



I tried it but could not get it to work. When i try to access the jsp file of another web app i get the following error HTTP Status 404 - /hello.jsp requested resource not available.

I call the jsp from another application using the following lines

ServletContext ctx=application.getContext("/Spring_MVC");
RequestDispatcher rd =ctx.getRequestDispatcher("/hello.jsp");
rd.forward(request,response);

Am i doing anything wrong here ??
 
Devaka Cooray
Sheriff
Posts: 7140
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you properly set the path attribute of the Context for Spring_MVC ?
 
Devaka Cooray
Sheriff
Posts: 7140
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the discussion is now turned into Tomcat related stuffs, I'm moving this to the Tomcat forum.
 
karthik aswin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Devaka Cooray wrote:Have you properly set the path attribute of the Context for Spring_MVC ?



Here is the context attribute i mentioned in server.xml

<Context path="/Spring_MVC" docBase="/Spring_MVC" debug="0" crossContext="true"
reloadable="true">
</context>


Is this right?


 
Devaka Cooray
Sheriff
Posts: 7140
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove the forward slash (/) from docBase
 
karthik aswin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the prompt reply !!!



Devaka Cooray wrote:Remove the forward slash (/) from docBase




Tried it. But still getting the same error

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried setting the crossContext attribute of the web app from which you want to forward? That's how I read the docs.
 
karthik aswin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Have you tried setting the crossContext attribute of the web app from which you want to forward? That's how I read the docs.



Done. here s what my server.xml looks like

<Context path="/Spring_MVC" docBase="Spring_MVC" debug="0" crossContext="true"
reloadable="true">
</context>


<Context path="/Orbeon-Test" docBase="Orbeon-Test" debug="0" crossContext="true"
reloadable="true">
</context>

But still getting the same error. Help !
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where exactly is hello.jsp placed?
 
karthik aswin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:Where exactly is hello.jsp placed?



Inside WebContent folder of the app named Spring_MVC
 
karthik aswin
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No reply ! I am struck help me outta thiss
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic