Class UriContext
A typical request against a URL takes the following form:
http://host:port/context-root/servlet-path/path-info | authority | context | resource | path | +--------------------------------------------------+
 This class allows you to convert URL strings to absolute (e.g. 
See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor.UriContext(String s) String constructor.UriContext(String authority, String contextRoot, String servletPath, String pathInfo) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionReturns the absolute URI of just the authority portion of this URI context.Returns the absolute URI of the context-root portion of this URI context.Returns the absolute URI of the path portion of this URI context.Returns the parent of the URL returned bygetAbsolutePathInfo().Returns the absolute URI of the resource portion of this URI context.Returns the parent of the URL returned bygetAbsoluteServletPath().Returns the root-relative URI of the context portion of this URI context.Returns the root-relative URI of the path portion of this URI context.Returns the parent of the URL returned bygetRootRelativePathInfo().Returns the root-relative URI of the resource portion of this URI context.Returns the parent of the URL returned bygetRootRelativeServletPath().static UriContextStatic creator.static UriContextStatic creator.toString()
- 
Field Details- 
DEFAULTDefault URI context.No information about authority, servlet-root, context-root, or path-info is known. 
- 
authority
- 
contextRoot
- 
servletPath
- 
pathInfo
- 
parentPath
 
- 
- 
Constructor Details- 
UriContext@Beanc public UriContext(@Name("authority") String authority, @Name("contextRoot") String contextRoot, @Name("servletPath") String servletPath, @Name("pathInfo") String pathInfo) Constructor.Leading and trailing slashes are trimmed of all parameters. Any parameter can be null . Blanks and nulls are equivalent.- Parameters:
- authority- The authority portion of URL (e.g.- "http://hostname:port" )
- contextRoot- The context root of the application (e.g.- "/context-root" , or- "context-root" )
- servletPath- The servlet path (e.g.- "/servlet-path" , or- "servlet-path" )
- pathInfo- The path info (e.g.- "/path-info" , or- "path-info" )
 
- 
UriContextpublic UriContext()Default constructor.All null values.
- 
UriContextString constructor.Input string is a JSON object with the following format: {authority:'xxx',contextRoot:'xxx',servletPath:'xxx',pathInfo:'xxx'} - Parameters:
- s- The input string.
 Example:- {authority:'http://localhost:10000',contextRoot:'/myContext',servletPath:'/myServlet',pathInfo:'/foo'} 
- Throws:
- ParseException- If input string is not a valid JSON object.
 
 
- 
- 
Method Details- 
ofpublic static UriContext of(String authority, String contextRoot, String servletPath, String pathInfo) Static creator.- Parameters:
- authority- The authority portion of URL (e.g.- "http://hostname:port" )
- contextRoot- The context root of the application (e.g.- "/context-root" , or- "context-root" )
- servletPath- The servlet path (e.g.- "/servlet-path" , or- "servlet-path" )
- pathInfo- The path info (e.g.- "/path-info" , or- "path-info" )
- Returns:
- A new UriContextobject.
 
- 
ofStatic creator.- Parameters:
- s- The input string.
 Example:- {authority:'http://localhost:10000',contextRoot:'/myContext',servletPath:'/myServlet',pathInfo:'/foo'} 
- Returns:
- A new UriContextobject.
 
- 
getAbsoluteAuthorityReturns the absolute URI of just the authority portion of this URI context.Example: "http://hostname:port" If the authority is null/empty, returns "/" .- Returns:
- The absolute URI of just the authority portion of this URI context.
   Never null .
 
- 
getAbsoluteContextRootReturns the absolute URI of the context-root portion of this URI context.Example: "http://hostname:port/context-root" - Returns:
- The absolute URI of the context-root portion of this URI context.
   Never null .
 
- 
getRootRelativeContextRootReturns the root-relative URI of the context portion of this URI context.Example: "/context-root" - Returns:
- The root-relative URI of the context portion of this URI context.
   Never null .
 
- 
getAbsoluteServletPathReturns the absolute URI of the resource portion of this URI context.Example: "http://hostname:port/context-root/servlet-path" - Returns:
- The absolute URI of the resource portion of this URI context.
   Never null .
 
- 
getRootRelativeServletPathReturns the root-relative URI of the resource portion of this URI context.Example: "/context-root/servlet-path" - Returns:
- The root-relative URI of the resource portion of this URI context.
   Never null .
 
- 
getAbsoluteServletPathParentReturns the parent of the URL returned bygetAbsoluteServletPath().- Returns:
- The parent of the URL returned by getAbsoluteServletPath().
 
- 
getRootRelativeServletPathParentReturns the parent of the URL returned bygetRootRelativeServletPath().- Returns:
- The parent of the URL returned by getRootRelativeServletPath().
 
- 
getAbsolutePathInfoReturns the absolute URI of the path portion of this URI context.Example: "http://hostname:port/context-root/servlet-path/path-info" - Returns:
- The absolute URI of the path portion of this URI context.
   Never null .
 
- 
getRootRelativePathInfoReturns the root-relative URI of the path portion of this URI context.Example: "/context-root/servlet-path/path-info" - Returns:
- The root-relative URI of the path portion of this URI context.
   Never null .
 
- 
getAbsolutePathInfoParentReturns the parent of the URL returned bygetAbsolutePathInfo().- Returns:
- The parent of the URL returned by getAbsolutePathInfo().
 
- 
getRootRelativePathInfoParentReturns the parent of the URL returned bygetRootRelativePathInfo().- Returns:
- The parent of the URL returned by getRootRelativePathInfo().
 
- 
toString
 
-