Java Doc for UrlPathHelper.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » util » 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 » J2EE » spring framework 2.0.6 » org.springframework.web.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.web.util.UrlPathHelper

UrlPathHelper
public class UrlPathHelper (Code)
Helper class for URL path matching. Provides support for URL paths in RequestDispatcher includes and support for consistent URL decoding.

Used by AbstractUrlHandlerMapping, AbstractUrlMethodNameResolver and RequestContext for path matching and/or URI determination.
author:
   Juergen Hoeller
author:
   Rob Harrop
since:
   14.01.2004
See Also:   org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
See Also:   org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver
See Also:   org.springframework.web.servlet.support.RequestContext



Field Summary
final public static  StringINCLUDE_CONTEXT_PATH_REQUEST_ATTRIBUTE
    
final public static  StringINCLUDE_SERVLET_PATH_REQUEST_ATTRIBUTE
    
final public static  StringINCLUDE_URI_REQUEST_ATTRIBUTE
    


Method Summary
public  StringdecodeRequestString(HttpServletRequest request, String source)
     Decode the given source string with a URLDecoder.
protected  StringdetermineEncoding(HttpServletRequest request)
     Determine the encoding for the given request.
public  StringgetContextPath(HttpServletRequest request)
     Return the context path for the given request, detecting an include request URL if called within a RequestDispatcher include.
protected  StringgetDefaultEncoding()
     Return the default character encoding to use for URL decoding.
public  StringgetLookupPathForRequest(HttpServletRequest request)
     Return the mapping lookup path for the given request, within the current servlet mapping if applicable, else within the web application.
public  StringgetOriginatingContextPath(HttpServletRequest request)
     Return the context path for the given request, detecting an include request URL if called within a RequestDispatcher include.
public  StringgetOriginatingQueryString(HttpServletRequest request)
     Return the request URI for root of the given request.
public  StringgetOriginatingRequestUri(HttpServletRequest request)
     Return the request URI for root of the given request.
public  StringgetPathWithinApplication(HttpServletRequest request)
     Return the path within the web application for the given request.
public  StringgetPathWithinServletMapping(HttpServletRequest request)
     Return the path within the servlet mapping for the given request, i.e.
public  StringgetRequestUri(HttpServletRequest request)
     Return the request URI for the given request, detecting an include request URL if called within a RequestDispatcher include.

As the value returned by request.getRequestURI() is not decoded by the servlet container, this method will decode it.

The URI that the web container resolves should be correct, but some containers like JBoss/Jetty incorrectly include ";" strings like ";jsessionid" in the URI.

public  StringgetServletPath(HttpServletRequest request)
     Return the servlet path for the given request, regarding an include request URL if called within a RequestDispatcher include.
public  voidsetAlwaysUseFullPath(boolean alwaysUseFullPath)
     Set if URL lookup should always use full path within current servlet context.
public  voidsetDefaultEncoding(String defaultEncoding)
     Set the default character encoding to use for URL decoding. Default is ISO-8859-1, according to the Servlet spec.

If the request specifies a character encoding itself, the request encoding will override this setting.

public  voidsetUrlDecode(boolean urlDecode)
     Set if context path and request URI should be URL-decoded.

Field Detail
INCLUDE_CONTEXT_PATH_REQUEST_ATTRIBUTE
final public static String INCLUDE_CONTEXT_PATH_REQUEST_ATTRIBUTE(Code)

See Also:   org.springframework.web.util.WebUtils.INCLUDE_CONTEXT_PATH_ATTRIBUTE



INCLUDE_SERVLET_PATH_REQUEST_ATTRIBUTE
final public static String INCLUDE_SERVLET_PATH_REQUEST_ATTRIBUTE(Code)

See Also:   org.springframework.web.util.WebUtils.INCLUDE_SERVLET_PATH_ATTRIBUTE



INCLUDE_URI_REQUEST_ATTRIBUTE
final public static String INCLUDE_URI_REQUEST_ATTRIBUTE(Code)

See Also:   org.springframework.web.util.WebUtils.INCLUDE_REQUEST_URI_ATTRIBUTE





Method Detail
decodeRequestString
public String decodeRequestString(HttpServletRequest request, String source)(Code)
Decode the given source string with a URLDecoder. The encoding will be taken from the request, falling back to the default "ISO-8859-1".

Default implementation uses URLDecoder.decode(input, enc) on JDK 1.4+, falling back to URLDecoder.decode(input) (which uses the platform default encoding) on JDK 1.3.
Parameters:
  request - current HTTP request
Parameters:
  source - the String to decode the decoded String
See Also:   WebUtils.DEFAULT_CHARACTER_ENCODING
See Also:   javax.servlet.ServletRequest.getCharacterEncoding
See Also:   java.net.URLDecoder.decode(StringString)
See Also:   java.net.URLDecoder.decode(String)




determineEncoding
protected String determineEncoding(HttpServletRequest request)(Code)
Determine the encoding for the given request. Can be overridden in subclasses.

The default implementation checks the request encoding, falling back to the default encoding specified for this resolver.
Parameters:
  request - current HTTP request the encoding for the request (never null)
See Also:   javax.servlet.ServletRequest.getCharacterEncoding
See Also:   UrlPathHelper.setDefaultEncoding




getContextPath
public String getContextPath(HttpServletRequest request)(Code)
Return the context path for the given request, detecting an include request URL if called within a RequestDispatcher include.

As the value returned by request.getContextPath() is not decoded by the servlet container, this method will decode it.
Parameters:
  request - current HTTP request the context path




getDefaultEncoding
protected String getDefaultEncoding()(Code)
Return the default character encoding to use for URL decoding.



getLookupPathForRequest
public String getLookupPathForRequest(HttpServletRequest request)(Code)
Return the mapping lookup path for the given request, within the current servlet mapping if applicable, else within the web application.

Regards include request URL if called within a RequestDispatcher include.
Parameters:
  request - current HTTP request the lookup path
See Also:   UrlPathHelper.getPathWithinApplication
See Also:   UrlPathHelper.getPathWithinServletMapping




getOriginatingContextPath
public String getOriginatingContextPath(HttpServletRequest request)(Code)
Return the context path for the given request, detecting an include request URL if called within a RequestDispatcher include.

As the value returned by request.getContextPath() is not decoded by the servlet container, this method will decode it.
Parameters:
  request - current HTTP request the context path




getOriginatingQueryString
public String getOriginatingQueryString(HttpServletRequest request)(Code)
Return the request URI for root of the given request. If this is a forwarded request, correctly resolves to the request URI of the original request. Relies on the Servlet 2.4 'forward' attributes. These attributes may be set by other components when running in a Servlet 2.3- environment.



getOriginatingRequestUri
public String getOriginatingRequestUri(HttpServletRequest request)(Code)
Return the request URI for root of the given request. If this is a forwarded request, correctly resolves to the request URI of the original request. Relies on the Servlet 2.4 'forward' attributes. These attributes may be set by other components when running in a Servlet 2.3- environment.



getPathWithinApplication
public String getPathWithinApplication(HttpServletRequest request)(Code)
Return the path within the web application for the given request.

Regards include request URL if called within a RequestDispatcher include.
Parameters:
  request - current HTTP request the path within the web application




getPathWithinServletMapping
public String getPathWithinServletMapping(HttpServletRequest request)(Code)
Return the path within the servlet mapping for the given request, i.e. the part of the request's URL beyond the part that called the servlet, or "" if the whole URL has been used to identify the servlet.

Regards include request URL if called within a RequestDispatcher include.

E.g.: servlet mapping = "/test/*"; request URI = "/test/a" -> "/a".

E.g.: servlet mapping = "/test"; request URI = "/test" -> "".

E.g.: servlet mapping = "/*.test"; request URI = "/a.test" -> "".
Parameters:
  request - current HTTP request the path within the servlet mapping, or ""




getRequestUri
public String getRequestUri(HttpServletRequest request)(Code)
Return the request URI for the given request, detecting an include request URL if called within a RequestDispatcher include.

As the value returned by request.getRequestURI() is not decoded by the servlet container, this method will decode it.

The URI that the web container resolves should be correct, but some containers like JBoss/Jetty incorrectly include ";" strings like ";jsessionid" in the URI. This method cuts off such incorrect appendices.
Parameters:
  request - current HTTP request the request URI




getServletPath
public String getServletPath(HttpServletRequest request)(Code)
Return the servlet path for the given request, regarding an include request URL if called within a RequestDispatcher include.

As the value returned by request.getServletPath() is already decoded by the servlet container, this method will not attempt to decode it.
Parameters:
  request - current HTTP request the servlet path




setAlwaysUseFullPath
public void setAlwaysUseFullPath(boolean alwaysUseFullPath)(Code)
Set if URL lookup should always use full path within current servlet context. Else, the path within the current servlet mapping is used if applicable (i.e. in the case of a ".../*" servlet mapping in web.xml). Default is "false".



setDefaultEncoding
public void setDefaultEncoding(String defaultEncoding)(Code)
Set the default character encoding to use for URL decoding. Default is ISO-8859-1, according to the Servlet spec.

If the request specifies a character encoding itself, the request encoding will override this setting. This also allows for generically overriding the character encoding in a filter that invokes the ServletRequest.setCharacterEncoding method.
Parameters:
  defaultEncoding - the character encoding to use
See Also:   UrlPathHelper.determineEncoding
See Also:   javax.servlet.ServletRequest.getCharacterEncoding
See Also:   javax.servlet.ServletRequest.setCharacterEncoding
See Also:   WebUtils.DEFAULT_CHARACTER_ENCODING




setUrlDecode
public void setUrlDecode(boolean urlDecode)(Code)
Set if context path and request URI should be URL-decoded. Both are returned undecoded by the Servlet API, in contrast to the servlet path.

Uses either the request encoding or the default encoding according to the Servlet spec (ISO-8859-1).

Note: Setting this to "true" requires JDK 1.4 if the encoding differs from the VM's platform default encoding, as JDK 1.3's URLDecoder class does not offer a way to specify the encoding.
See Also:   UrlPathHelper.getServletPath
See Also:   UrlPathHelper.getContextPath
See Also:   UrlPathHelper.getRequestUri
See Also:   WebUtils.DEFAULT_CHARACTER_ENCODING
See Also:   javax.servlet.ServletRequest.getCharacterEncoding
See Also:   java.net.URLDecoder.decode(StringString)
See Also:   java.net.URLDecoder.decode(String)




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.