• 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

javax. servlet. include. path_info not set.

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The serlvet spec said:

Except for servlets obtained by using the getNamedDispatcher
method, a servlet that has been invoked by another servlet
using the include method ofRequestDispatcher has access to
the path by which it was invoked.The following request attri-
butes must be set:

javax.servlet.include.request_uri
javax.servlet.include.context_path
javax.servlet.include.servlet_path
javax.servlet.include.path_info
javax.servlet.include.query_string

However, when I tried, I found "javax.servlet.include.path_info"
and "javax.servlet.include.query_string" never set, even though
the query URI contains path info and query string.

On the other hand, when forwarding, the "javax.servlet.forward.
path_info" and "javax.servlet.forward.query_string" are set when
the URI contains path info and query string.

I don't know what's wrong here. And It's the same behavior under
Tomcat 5.5 and AppServer9.

My test code is as following, and the mapping is:
Forwarder -> /Forwarder/*
Includer -> /Includer/*
Target -> /Target

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

When the request is forwarded :

The attributes are set to the value of calling URI. In your case the calling URI is something like /appname/Forwarder/pathinfo?param=value. So the Path info and the query parametered will be shown from this URI. The Path Info and the request parameter will be showon as Youre URI is matche by the path of the pattern /somepath/* pattern . It is not exact matching pattern pattern.

When the request is included :

The attributes are set to the value of target URI. Your target URI is matching with exact match, so there is no question of the path info. It will always null. The Query String can appears if you set the query string parameter to your target URI, that is /Target.

Hope this help

Thanks
 
Ke Cheng
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Narendra Dhande:
I think I understand what's the difference now. Many thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic