Red Hat NETSCAPE ENTERPRISE SERVER 6.0 - NSAPI PROGRAMMER GUIDE Manuale Utente Pagina 76

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 124
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 75
Clarifications for Using Methods
76 iPlanet Web Server, Enterprise Edition Programmer’s Guide to Servlets • May 2001
RequestDispatcher.forward and include
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), it will not 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.
Clarification
In iPlanet Web Server 6.0, the 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.
You can control the nesting depth of the
RequestDispatcher.forward and
include methods using the requestDispatcherNestDepth parameter in
magnus.conf. For more information, see Appendix A, “Servlet Settings in
magnus.conf and obj.conf.”
Vedere la pagina 75
1 2 ... 71 72 73 74 75 76 77 78 79 80 81 ... 123 124

Commenti su questo manuale

Nessun commento