• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getContext()

 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I tried using getContext() but it's returning null.....syntax I'm using is this :
(using it in a servlet in application App1)
ServletContext anotherAppContext=getServletContext().getContext("/App2/test.do")
(where App2 is another application in the same container and test.do is a logical mapping to a servlet in App2).... but it's returning null....Is it because the Tomcat 5.0.28 container is restricting this or am I going wrong with the syntax somewhere?
Please suggest....thanks in advance
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
API documentation of ServletContext says
In a security conscious environment, the servlet container may return null for a given URL.


but i don't know what is security concious container or not.
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah...even I found that out....but I'm not sure if Tomcat is one such container....I mean I'm not sure what the deal is.
I'm tryin' to use it to get the context for a different web application location in the same container, get a RequestDispatcher using that context and then use the RequestDispatcher to dispatch the request to a servlet or JSP there.....But I'm gettin' stuck with the getcontext() method....it's returning null....could anyone help?
[ December 16, 2006: Message edited by: Sayak Banerjee ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic