Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
526
Appendix A
Servlet and JSP Quick Reference
  Cookie: cookies sent to client by server sometime earlier. Use 
getCookies
, not 
getHeader
. See Chapter 8.
  Host: host given in original URL. This is a required header in HTTP 
1.1.
  If Modified Since: indicates client wants page only if it has been 
changed after specified date. Don't handle this situation directly; 
implement 
getLastModified
 instead. See example in Section 2.8.
  Referer: URL of referring Web page.
  User Agent: string identifying the browser making the request.
A.5 Accessing the Standard CGI Variables
You should usually think in terms of request info, response info, and server
info, not CGI variables.
Capabilities Not Discussed Elsewhere
  getServletContext().getRealPath("uri"): maps URI to real path 
  request.getRemoteHost(): name of host making request
  request.getRemoteAddress(): IP address of host making request
Servlet Equivalent of CGI Variables
  AUTH_TYPE: 
request.getAuthType()
  CONTENT_LENGTH: 
request.getContentLength()
  CONTENT_TYPE: 
request.getContentType()
  DOCUMENT_ROOT: 
getServletContext().getRealPath("/")
  HTTP_XXX_YYY: 
request.getHeader("Xxx Yyy")
  PATH_INFO: 
request.getPathInfo()
  PATH_TRANSLATED: 
request.getPathTranslated()
  QUERY_STRING: 
request.getQueryString()
  REMOTE_ADDR: 
request.getRemoteAddr()
  REMOTE_HOST: 
request.getRemoteHost()
  REMOTE_USER: 
request.getRemoteUser()
  REQUEST_METHOD: 
request.getMethod()
  SCRIPT_NAME: 
request.getServletPath()
  SERVER_NAME: 
request.getServerName()
  SERVER_PORT: 
request.getServerPort()
  SERVER_PROTOCOL: 
request.getProtocol()
  SERVER_SOFTWARE: 
getServletContext().getServerInfo()
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved