|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.webapps.tools.GeneralServletTools
This class contains utility methods useful in servlet-based applications.
Constructor Summary | |
---|---|
GeneralServletTools()
|
Method Summary | |
---|---|
static String |
getAbsolutePath(String fname,
ServletContext servletContext)
Gets the absolute path to a given file or directory. |
static String |
getAbsolutePath(String fname,
String docRoot)
Gets the absolute path to a given file or directory. |
static String |
getContextUrl(HttpServletRequest req)
Gets the URL that refers to the current servlet context, for example "http://host:8080/my_app_context". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GeneralServletTools()
Method Detail |
public static String getContextUrl(HttpServletRequest req)
req
- The request.
public static final String getAbsolutePath(String fname, ServletContext servletContext) throws ServletException
If the string that is passed in already begings with "/", nothing is done.
Note: the HttpServlet init() (super.init()) method must be called prior to using this method, else a ServletException is thrown.
fname
- An absolute or relative file name or path
(relative the the context root).servletContext
- The HttpServletContext of the appliection.
ServletException
- An exception related to this servletpublic static final String getAbsolutePath(String fname, String docRoot)
If the string that is passed in already begings with "/", nothing is done.
Note: the super.init() method must be called prior to using this method, else a ServletException is thrown.
fname
- An absolute or relative file name or path (relative the the
context root).docRoot
- The context document root as obtained by calling
getServletContext().getRealPath("/");
|
DLESE Tools v1.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |