• 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

Problem Invoking Servlet thru Proxy Server

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! I have a problem invoking a servlet with a URL in a proxy server environment.
I have a MyApp.war file that has the following structure:
dir1/*.jsp
dir2/*.jsp
index.jsp
My web.xml file contains the following:
<servlet>
<servlet-name>ToolA</servlet-name>
<servlet-class>some class also in the .war file</servlet-class>
</servlet>
<servlet-name>ToolA</servlet-name>
<url-pattern>/dir1</url-pattern>
</servlet-mapping>
Note that there is no servlet mapping to /dir2.
Finally, index.jsp contains:
<%
response.sendRedirect("/MyApp/dir1");
%>
Under normal circumstances, the following occurs if I enter the specific URLs in a web browser:
1. http://<server>/MyApp/dir1 --> redirects the request to servlet ToolA
2. http://<server>/MyApp/dir2/some.jsp --> directs the request to dir2/some.jsp
3. http://<server>/MyApp --> (a shortcut URL for /MyApp/dir1) the web container by default directs the request to index.jsp which redirects the request to /MyApp/dir1 which redirects the request to servlet ToolA
This works as intended. My problem arises when I try and invoke my application and a proxy server is in the middle. The first two URL requests work fine. The third presents me with a blank screen. If I click the refresh button on my web browser, my screen appears. The only other bit of information that I know of is when the third URL is entered, the proxy log shows two URLs...(a) http://<server>/MyApp and (b) http://<server>/MyApp/index.jsp.
I have tried adding the following servlet mapping to my web.xml file:
<servlet-mapping>
<servlet-name>ToolA</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Unfortunately, this causes the second URL to break (.../dir2/some.jsp). Any request for a jsp in dir2 fails because I guess, it matches the request against the servlet mapping for "/" and redirects the request to the ToolA servlet.
I do not know if there is a way around this or not. Any help is greatly appreciated.
Have a great day!
- Kelly
 
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic