Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

comparing Request Dispatchers

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We know that a Request Dispatcher obtained from a ServletRequest can be used to fwd requests to a component relative to the current resource.

Can this RequestDispatcher(obtained from ServletRequest) be used to fwd requests to components in other /contexts. (My understanding is "NO")

Also, would be great if we compare the capabilities of Request Dispatchers obtained from ServletContext and ServletRequest.

Thanks,
Yogesh
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Can this RequestDispatcher(obtained from ServletRequest) be used to fwd requests to components in other /contexts. (My understanding is "NO")


It actually can, if your container is configured to. For example, in Tomcat, you can set some Context as being crossContexts, making them accessible to other apps.

Also, would be great if we compare the capabilities of Request Dispatchers obtained from ServletContext and ServletRequest.


The difference between ServletRequest and ServletContext's getRequestDispatcher(java.lang.String) is that ServletRequest's method can take a relative path.
 
Yogesh Hingmire
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Satou,

So when i use a Request Dispatcher obtained from a Servlet Request to fwd requests to other contexts in the container, i would start with a "/" and this would be an absolute path.Is that correct ?

Yogesh.
 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic