Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Url/Path

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hellow everybody,
i was looking and found just two places where url/path is relative to webapps directory(not to root of application and to the uri), they are:
1) HttpServletResponse.sendRedirect where if you start with a / it will refer to the root of webapps
2) ServletContext.getResource(ou getResourceasStream) where / is mandatory and refer to the root of webapps.
Does anyone knows another place where / refer to webapps root, it may be in web.xml, directives, anywhere...thanks!!!
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletContext.getRequestDispatcher(String path)

from SCWCD Exam Study Kit, pg 57
There is an important difference between the getRequestDispatcher() method of ServletContext and that of ServletRequest: you can pass a relative path to the getRequestDispatcher() method of ServletRequest but not to the getRequestDispatcher() method of ServletContext. For example, request.getRequestDispatcher("../html/copyright.html") is valid, and the getRequestDispatcher() method of ServletRequest will evalute the path relative to the path of the request. For the getRequestDispatcher() method of ServletContext, the path parameter cannnot be relative and must start with /. This makes sense because ServletRequest has a current request path to evaluate the relative path while ServletContext does not.


[ July 17, 2002: Message edited by: Jessica Sant ]
 
What's that smell? I think this tiny ad may have stepped in something.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic