http://java.sun.com/products/servlet/2.1/html/api-reference.fm.htmlThis appendix provides clarifications for using the following methods with iPlanet Web Server 4.1:
public static StringBuffer getRequestURL(HttpServletRequest request);This method reconstructs the URL used by the client to make the given request on the server. This method accounts for difference in scheme (such as http, https) and ports, but does not attempt to include query parameters. This method returns a StringBuffer instead of a String so that the URL can be modified efficiently by the servlet.
ServerName in magnus.conf. By default, the server name is the machine name, but this value is editable during iPlanet Web Server 4.1 installation. If the server name has been changed, HttpUtils.getRequestURL might not return the host name that is needed to reconstruct the request.
For example, suppose the request is http://abc/index.html. However, the server name has been changed to xyz. In this case, HttpUtils.getRequestURL might return http://xyz/index.html, which is not the original URL that was requested.
public void setMaxInactiveInterval(int interval);Sets the amount of time that a session can be inactive before the servlet engine is allowed to expire it.
public String getInitParameter(String name);This method returns a String containing the value of the servlet's named initialization parameter, or null if this parameter does not exist.
public Enumeration getInitParameterNames();This method returns an enumeration of String objects containing the names of the initialization parameters for the calling servlet. If the calling servlet has no initialization parameters,
getInitParameterNames returns an empty enumeration.
getInitParameter and getInitParameterNames for the class ServletConfig only work for servlets that are invoked through virtual path translations. The same restriction applies to the convenience methods of the same names in the class GenericServlet, which invoke the corresponding methods on ServletConfig.
For information about setting virtual path translations, see the section "Specifying Servlet Virtual Paths."
These methods do not work if the servlet is invoked by a client request that specifies a servlet in a registered servlet directory rather than using a virtual path translation to access the servlet.
public java.util.Enumeration getAttributeNames()This method returns an enumeration containing the attribute names available within the servlet's context.
MMapSessions, iPlanet Web Server truncates names retrieved by ServletContext.getAttributeNames to 128 characters.
public ServletContext getContext(String uripath);Returns the servlet context object that contains servlets and resources for a particular URI path, or null if a context cannot be provided for the path.
uripath) has been configured either through the Servlets>Configure Servlet attributes property of the Server Manager interface or by editing servlets.properties.getContext is called from another servlet to get the context of an unloaded servlet.public java.lang.Object getAttribute(java.lang.String name)Returns the value of the named attribute as an object, or returns null if no attribute of the given name exists.
ServletRequest.getAttribute returns a CGI variable if it exists. However, the getAttributeNames method does not show these variables within its enumeration.
public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException;Used for forwarding a request from this servlet to another resource on the web server. This method is useful when one servlet does preliminary processing of a request and wants to let another object generate the response. The request object passed to the target object will have its request URL path and other path parameters adjusted to reflect the target URL path of the target object. You cannot use this method if a
ServletOutputStream object or PrintWriter object has been obtained from the response. In that case, the method throws an IllegalStateException.
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException;Used for including the content generated by another server resource in the body of a response. In essence, this method enables programmatic server-side includes. The request object passed to the target object reflects the request URL path and path info of the calling request. The response object only has access to the calling servlet's
ServletOutputStream object or PrintWriter object.
An included servlet cannot set headers. If the included servlet calls a method that needs to set headers (such as cookies), the method is not guaranteed to work. As a servlet developer, you must ensure that any methods that might need direct access to headers are properly resolved. To ensure that a session works correctly, start the session outside the included servlet, even if you use session tracking.
dispatcher.forward method may or may not throw an IllegalStateException when either Writer or OutputStream have been obtained. This behavior follows the 2.2 draft and is needed for JSP error page handling. It throws the exception only if the actual data has been flushed out and sent to the client. Otherwise, the data pending in the buffer is simply discarded.
The forward and include methods may throw a ServletException if the target URI is identified as an unsafe URI (that is, it includes insecure path characters such as //, /./, /../ and/., /.. (and also ./ for NT) at the end of the URI.
InputStream through the request.InputStream method, an older method.BufferedRead through the request.getReader method, a method in use since 2.0.InputStream to read more data than is physically available. (To find how much data is available, use request.getContentLength.) However, if the servlet reads data using a BufferedReader returned from a call to getReader, the allowed content length is automatically taken into account.
You can also set the inputStreamLengthCheck parameter to true in the contexts.properties file to prevent this problem.
Last Updated: 02/25/00 16:19:15
© Copyright © 2000 Sun Microsystems, Inc. Some preexisting portions Copyright © 2000 Netscape Communications Corp. All rights reserved.
[an error occurred while processing this directive]