JavaSercer Pages public String getRealPath(String path) Returns a

February 1, 2007 on 11:38 am | In Java |

JavaSercer Pages public String getRealPath(String path) Returns a String containing the filesystem path for a specified context-relative path. This method returns null if the web container cannot translate the path to a filesystem path for any reason (such as when the content is being made available from a WAR archive). public RequestDispatcher getRequestDispatcher(String path) Returns a RequestDispatcher object that acts as a wrapper for the resource located at the specified context-relative path. The resource can be dynamic (servlet or JSP) or static (for instance, a regular HTML file). public java.net.URL getResource(String path) throws MalformedURLException Returns a URL to the resource that is mapped to the specified context-relative path. This method allows the web container to make a resource available to servlets and JSP pages from other sources than a local filesystem, such as a database or a WAR file. The URL provides access to the resource content directly, so be aware that requesting a JSP page returns a URL for the JSP source code as opposed to the processed result. Use a RequestDispatcher instead to include results of an execution. This method returns null if no resource is mapped to the pathname. public java.io.InputStream getResourceAsStream(String path) Returns the resource mapped to the specified context-relative path as an InputStream object. See getResource( ) for details. public String getServerInfo( ) Returns the name and version of the servlet container on which the servlet or JSP page is running as a String with the format “servername/versionnumber” (for example, “Tomcat/3.2″). Optionally, a container may include other information, such as the Java version and operating system information, within parentheses. public void log(String message) Writes the specified message to a container log file. The name and type of the log file is container- dependent. public void log(String message, Throwable cause) Writes the specified message and a stack trace for the specified Throwable to the servlet log file. The name and type of the log file is container-dependent. public void removeAttribute(String name) Removes the attribute with the specified name from the servlet context. public void setAttribute(String name, Object attribute) Binds an object to the specified attribute name in this servlet context. If the specified name is already used for an attribute, this method removes the old attribute and binds the name to the new attribute. The following methods are deprecated: public Servlet getServlet(String name) throws ServletException This method was originally defined to retrieve a servlet from a ServletContext. As of the Servlet 2.1 API, this method always returns null, and remains only to preserve binary compatibility. This method will be permanently removed in a future version of the Java servlet API. page 272

Hint: This post is supported by Gama web hosting php services

No Comments yet

TrackBack URI

Sorry, the comment form is closed at this time.