Java Doc for ServletURL.java in  » Testing » jakarta-cactus » org » apache » cactus » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » jakarta cactus » org.apache.cactus 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.cactus.ServletURL

ServletURL
public class ServletURL (Code)
Simulate an HTTP URL by breaking it into its different parts.

 URL = "http://" + serverName (including port) + requestURI ? queryString
requestURI = contextPath + servletPath + pathInfo
From the Servlet 2.2 specification :
  • Context Path: The path prefix associated with the ServletContext that this servlet is a part of. If this context is the default context rooted at the base of the web server's URL namespace, this path will be an empty string. Otherwise, this path starts with a "/" character but does not end with a "/" character.
  • Servlet Path: The path section that directly corresponds to the mapping which activated this request. This path starts with a "/" character.
  • PathInfo: The part of the request path that is not part of the Context Path or the Servlet Path.
From the Servlet 2.3 specification :
  • Context Path: The path prefix associated with the ServletContext that this servlet is a part of. If this context is the default context rooted at the base of the web server's URL namespace, this path will be an empty string. Otherwise, this path starts with a "/" character but does not end with a "/" character.
  • Servlet Path: The path section that directly corresponds to the mapping which activated this request. This path starts with a "/" character except in the case where the request is matched with the "/*" pattern, in which case it is the empty string.
  • PathInfo: The part of the request path that is not part of the Context Path or the Servlet Path. It is either null if there is no extra path, or is a string with a leading "/".

version:
   $Id: ServletURL.java 238991 2004-05-22 11:34:50Z vmassol $


Field Summary
final public static  StringPROTOCOL_HTTP
     Http protocol.
final public static  StringPROTOCOL_HTTPS
     Https protocol.
final public static  StringURL_CONTEXT_PATH_PARAM
     Name of the parameter in the HTTP request that represents the context path in the URL to simulate.
final public static  StringURL_PATH_INFO_PARAM
     Name of the parameter in the HTTP request that represents the Path Info in the URL to simulate.
final public static  StringURL_PROTOCOL_PARAM
     Name of the parameter in the HTTP request that represents the protocol (HTTP, HTTPS, etc) in the URL to simulate.
final public static  StringURL_QUERY_STRING_PARAM
     Name of the parameter in the HTTP request that represents the Query String in the URL to simulate.
final public static  StringURL_SERVER_NAME_PARAM
     Name of the parameter in the HTTP request that represents the Server name (+ port) in the URL to simulate.
final public static  StringURL_SERVLET_PATH_PARAM
     Name of the parameter in the HTTP request that represents the Servlet Path in the URL to simulate.

Constructor Summary
public  ServletURL()
     Default constructor.
public  ServletURL(String theProtocol, String theServerName, String theContextPath, String theServletPath, String thePathInfo, String theQueryString)
     Creates the URL to simulate.
Parameters:
  theProtocol - the protocol to simulate (eitherServletURL.PROTOCOL_HTTP orServletURL.PROTOCOL_HTTPS.
Parameters:
  theServerName - the server name (and port) in the URL to simulate,i.e.
public  ServletURL(String theServerName, String theContextPath, String theServletPath, String thePathInfo, String theQueryString)
     Creates the URL to simulate, using the default HTTP protocol.
Parameters:
  theServerName - the server name (and port) in the URL to simulate,i.e.

Method Summary
public  StringgetContextPath()
    
public  StringgetHost()
     Returns the host name.

The host name is extracted from the specified server name (as in jakarta.apache.org:80).

public  StringgetPath()
    
public  StringgetPathInfo()
    
public  intgetPort()
     Returns the port.

The port is extracted from the specified server name (as in jakarta.apache.org:80).

public  StringgetProtocol()
    
public  StringgetQueryString()
    
public  StringgetServerName()
    
public  StringgetServletPath()
    
public static  ServletURLloadFromRequest(HttpServletRequest theRequest)
     Creates a ServletURL object by loading it's values from the HTTP request.
Parameters:
  theRequest - the incoming HTTP request.
public  voidsaveToRequest(WebRequest theRequest)
     Saves the current URL to a WebRequest object.
public  voidsetContextPath(String theContextPath)
     Sets the webapp context path in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getContextPath().
public  voidsetPathInfo(String thePathInfo)
     Sets the path info in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getPathInfo().
public  voidsetProtocol(String theProtocol)
     Sets the protocol to simulate (either ServletURL.PROTOCOL_HTTP or ServletURL.PROTOCOL_HTTPS.
public  voidsetQueryString(String theQueryString)
     Sets the Query string in the URL to simulate, ie this is the string that will be returned by the HttpServletResquest.getQueryString().
public  voidsetServerName(String theServerName)
     Sets the server name (and port) in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getServerName() and HttpServletRequest.getServerPort().
public  voidsetServletPath(String theServletPath)
     Sets the servlet path in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getServletPath(). If null then the servlet path from the Servlet Redirector will be returned.
public  StringtoString()
    

Field Detail
PROTOCOL_HTTP
final public static String PROTOCOL_HTTP(Code)
Http protocol.



PROTOCOL_HTTPS
final public static String PROTOCOL_HTTPS(Code)
Https protocol.



URL_CONTEXT_PATH_PARAM
final public static String URL_CONTEXT_PATH_PARAM(Code)
Name of the parameter in the HTTP request that represents the context path in the URL to simulate. The name is voluntarily long so that it will not clash with a user-defined parameter.



URL_PATH_INFO_PARAM
final public static String URL_PATH_INFO_PARAM(Code)
Name of the parameter in the HTTP request that represents the Path Info in the URL to simulate. The name is voluntarily long so that it will not clash with a user-defined parameter.



URL_PROTOCOL_PARAM
final public static String URL_PROTOCOL_PARAM(Code)
Name of the parameter in the HTTP request that represents the protocol (HTTP, HTTPS, etc) in the URL to simulate. The name is voluntarily long so that it will not clash with a user-defined parameter.



URL_QUERY_STRING_PARAM
final public static String URL_QUERY_STRING_PARAM(Code)
Name of the parameter in the HTTP request that represents the Query String in the URL to simulate. The name is voluntarily long so that it will not clash with a user-defined parameter.



URL_SERVER_NAME_PARAM
final public static String URL_SERVER_NAME_PARAM(Code)
Name of the parameter in the HTTP request that represents the Server name (+ port) in the URL to simulate. The name is voluntarily long so that it will not clash with a user-defined parameter.



URL_SERVLET_PATH_PARAM
final public static String URL_SERVLET_PATH_PARAM(Code)
Name of the parameter in the HTTP request that represents the Servlet Path in the URL to simulate. The name is voluntarily long so that it will not clash with a user-defined parameter.




Constructor Detail
ServletURL
public ServletURL()(Code)
Default constructor. Need to call the different setters to make this a valid object.



ServletURL
public ServletURL(String theProtocol, String theServerName, String theContextPath, String theServletPath, String thePathInfo, String theQueryString)(Code)
Creates the URL to simulate.
Parameters:
  theProtocol - the protocol to simulate (eitherServletURL.PROTOCOL_HTTP orServletURL.PROTOCOL_HTTPS.
Parameters:
  theServerName - the server name (and port) in the URL to simulate,i.e. this is the name that will be returned by theHttpServletRequest.getServerName() andHttpServletRequest.getServerPort(). Canbe null. If null, then the server name and port fromthe Servlet Redirector will be returned.
Parameters:
  theContextPath - the webapp context path in the URL to simulate,i.e. this is the name that will be returned by theHttpServletRequest.getContextPath().Can be null. If null, then the context from theServlet Redirector will be used.Format: "/" + name or an empty string for the default context. Must not end with a "/" character.
Parameters:
  theServletPath - the servlet path in the URL to simulate,i.e. this is the name that will be returned by theHttpServletRequest.getServletPath().Can be null. If null, then the servlet path from the Servlet Redirector will be used.Format : "/" + name or an empty string.
Parameters:
  thePathInfo - the path info in the URL to simulate, i.e. this isthe name that will be returned by theHttpServletRequest.getPathInfo(). Canbe null. Format : "/" + name.
Parameters:
  theQueryString - the Query string in the URL to simulate, i.e. thisis the string that will be returned by theHttpServletResquest.getQueryString().Can be null.



ServletURL
public ServletURL(String theServerName, String theContextPath, String theServletPath, String thePathInfo, String theQueryString)(Code)
Creates the URL to simulate, using the default HTTP protocol.
Parameters:
  theServerName - the server name (and port) in the URL to simulate,i.e. this is the name that will be returned by theHttpServletRequest.getServerName() andHttpServletRequest.getServerPort(). Canbe null. If null, then the server name and port fromthe Servlet Redirector will be returned.
Parameters:
  theContextPath - the webapp context path in the URL to simulate,i.e. this is the name that will be returned by theHttpServletRequest.getContextPath().Can be null. If null, then the context from theServlet Redirector will be used.Format: "/" + name or an empty string for the default context. Must not end with a "/" character.
Parameters:
  theServletPath - the servlet path in the URL to simulate,i.e. this is the name that will be returned by theHttpServletRequest.getServletPath().Can be null. If null, then the servlet path from the Servlet Redirector will be used.Format : "/" + name or an empty string.
Parameters:
  thePathInfo - the path info in the URL to simulate, i.e. this isthe name that will be returned by theHttpServletRequest.getPathInfo(). Canbe null. Format : "/" + name.
Parameters:
  theQueryString - the Query string in the URL to simulate, i.e. thisis the string that will be returned by theHttpServletResquest.getQueryString().Can be null.




Method Detail
getContextPath
public String getContextPath()(Code)
the simulated URL context path



getHost
public String getHost()(Code)
Returns the host name.

The host name is extracted from the specified server name (as in jakarta.apache.org:80). If the server name has not been set, this method will return null.

the simulated URL server name (excluding the port number)



getPath
public String getPath()(Code)
the path (contextPath + servletPath + pathInfo) or null ifnot set



getPathInfo
public String getPathInfo()(Code)
the simulated URL path info



getPort
public int getPort()(Code)
Returns the port.

The port is extracted from the specified server name (as in jakarta.apache.org:80). If the server name doesn't contain a port number, the default port number is returned (80 for HTTP, 443 for HTTP over SSL). If a port number is specified but illegal, or the server name has not been set, this method will return -1.

the simulated port number or -1 if an illegal port has beenspecified



getProtocol
public String getProtocol()(Code)
the protocol used to connect to the URL (HTTP, HTTPS, etc).



getQueryString
public String getQueryString()(Code)
the simulated Query String



getServerName
public String getServerName()(Code)
the simulated URL server name (including the port number)



getServletPath
public String getServletPath()(Code)
the simulated URL servlet path



loadFromRequest
public static ServletURL loadFromRequest(HttpServletRequest theRequest)(Code)
Creates a ServletURL object by loading it's values from the HTTP request.
Parameters:
  theRequest - the incoming HTTP request. the ServletURL object unserialized from the HTTPrequest



saveToRequest
public void saveToRequest(WebRequest theRequest)(Code)
Saves the current URL to a WebRequest object.
Parameters:
  theRequest - the object to which the current URL should be saved to



setContextPath
public void setContextPath(String theContextPath)(Code)
Sets the webapp context path in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getContextPath(). If not set, the context from the Servlet Redirector will be returned. Format: "/" + name or an empty string for the default context. If not an empty string the last character must not be "/".
Parameters:
  theContextPath - the context path to simulate



setPathInfo
public void setPathInfo(String thePathInfo)(Code)
Sets the path info in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getPathInfo(). If null then no path info will be set (and the Path Info from the Servlet Redirector will not be used). Format : "/" + name.
Parameters:
  thePathInfo - the path info to simulate



setProtocol
public void setProtocol(String theProtocol)(Code)
Sets the protocol to simulate (either ServletURL.PROTOCOL_HTTP or ServletURL.PROTOCOL_HTTPS. If parameter is null then PROTOCOL_HTTP is assumed.
Parameters:
  theProtocol - the protocol to simulate



setQueryString
public void setQueryString(String theQueryString)(Code)
Sets the Query string in the URL to simulate, ie this is the string that will be returned by the HttpServletResquest.getQueryString(). If not set, the query string from the Servlet Redirector will be returned.
Parameters:
  theQueryString - the query string to simulate



setServerName
public void setServerName(String theServerName)(Code)
Sets the server name (and port) in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getServerName() and HttpServletRequest.getServerPort(). Does not need to be set. If not set or null, then the server name and port from the Servlet Redirector will be returned.
Parameters:
  theServerName - the server name and port (ex:"jakarta.apache.org:80")



setServletPath
public void setServletPath(String theServletPath)(Code)
Sets the servlet path in the URL to simulate, ie this is the name that will be returned by the HttpServletRequest.getServletPath(). If null then the servlet path from the Servlet Redirector will be returned. Format : "/" + name or an empty string.
Parameters:
  theServletPath - the servlet path to simulate



toString
public String toString()(Code)
a string representation



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.