Package org.silverpeas.core.web
Class WebResourceUri
- java.lang.Object
-
- org.silverpeas.core.web.WebResourceUri
-
public class WebResourceUri extends Object
URI of the current web resource, that is the web resource being in execution and whose execution was triggered by an incoming HTTP request; the request URI. It is defined to replace the use ofUriInfoas it takes care of the Silverpeas settings in regard to the URL, host and web context definitions and as it is dedicated to compute more easily the URI of the Web entities involved by the incoming HTTP requests.The different properties of such a running web resource URI are explained by an example here. For the following request URI:
http://localhost:8000/silverpeas/services/toto/kmelia32/content/bidule?p=3&u=10- The base URI is
http://localhost:8000/silverpeas/services - The request URI is
http://localhost:8000/silverpeas/services/toto/kmelia32/content/bidule?p=3&u=10 - The absolute web resource path is
http://localhost:8000/silverpeas/services/toto/kmelia32 - The web resource path is
/silverpeas/services/toto/kmelia32 - The absolute path is
http://localhost:8000/silverpeas/services/toto/kmelia32/content/bidule - The path is
/silverpeas/services/toto/kmelia32/content/bidule - The query parameters are taken from the parsing of
?p=3&u=10 - The path parameters are all nodes in the URI that matches with an parameter in the
Pathannotations of the web resource
- Author:
- mmoquillon
- The base URI is
-
-
Constructor Summary
Constructors Constructor Description WebResourceUri(String webResourcePath, javax.servlet.http.HttpServletRequest request)WebResourceUri(String webResourcePath, javax.servlet.http.HttpServletRequest request, javax.ws.rs.core.UriInfo uriInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description URIgetAbsolutePath()Get the absolute path of the request.javax.ws.rs.core.UriBuildergetAbsolutePathBuilder()Get the absolute path of the request in the form of aUriBuilder.URIgetAbsoluteWebResourcePath()Gets the absolute base path of the current web resource.javax.ws.rs.core.UriBuildergetAbsoluteWebResourcePathBuilder()Gets the absolute path of the current web resource in the form of aUriBuilder.URIgetBaseUri()Get the base URI of all Web resources in Silverpeas.javax.ws.rs.core.UriBuildergetBaseUriBuilder()Get the base URI of all Web resources in Silverpeas in the form of aUriBuilder.javax.servlet.http.HttpServletRequestgetHttpRequest()Gets the current HTTP request targeting this URI.URIgetPath()Gets the path of the current request relative to the root path of the Silverpeas URI.javax.ws.rs.core.UriBuildergetPathBuilder()Gets the path of the current request relative to the root path of the Silverpeas URI in the form of aUriBuilder.javax.ws.rs.core.MultivaluedMap<String,String>getPathParameters()Get the values of any embedded URI template parameters.javax.ws.rs.core.MultivaluedMap<String,String>getQueryParameters()Get the URI query parameters of the current request.URIgetRequestUri()Get the absolute request URI including any query parameters.javax.ws.rs.core.UriBuildergetRequestUriBuilder()Get the absolute request URI including any query parameters in the form of aUriBuilder.URIgetWebResourcePath()Gets the base path of the current web resource relative to the root path of the Silverpeas URI.javax.ws.rs.core.UriBuildergetWebResourcePathBuilder()Gets the path of the current web resource relative to the root path of the Silverpeas URI in the form of aUriBuilder.
-
-
-
Method Detail
-
getHttpRequest
public javax.servlet.http.HttpServletRequest getHttpRequest()
Gets the current HTTP request targeting this URI.- Returns:
- the current HTTP request
-
getWebResourcePath
public URI getWebResourcePath()
Gets the base path of the current web resource relative to the root path of the Silverpeas URI. If the web resource targeted by the current request is related to a given component instance, then the identifier of the component instance is also referred in the returned path. All sequences of escaped octets are decoded.- Returns:
- the base path of the requested web resource.
-
getWebResourcePathBuilder
public javax.ws.rs.core.UriBuilder getWebResourcePathBuilder()
Gets the path of the current web resource relative to the root path of the Silverpeas URI in the form of aUriBuilder. If the web resource targeted by the current request is related to a given component instance, then the identifier of the component instance is also referred in the returned path.The returned
UriBuildergives possibility to enrich the path to build a customized URI for a web entity.- Returns:
- the
UriBuilderinitialized with the base path of the requested web resource.
-
getAbsoluteWebResourcePath
public URI getAbsoluteWebResourcePath()
Gets the absolute base path of the current web resource. This includes everything preceding the path (host, port, etc). If the web resource targeted by the current request is related to a given component instance, then the identifier of the component instance is also referred in the returned path. All sequences of escaped octets are decoded.- Returns:
- the absolute base path of the requested web resource.
-
getAbsoluteWebResourcePathBuilder
public javax.ws.rs.core.UriBuilder getAbsoluteWebResourcePathBuilder()
Gets the absolute path of the current web resource in the form of aUriBuilder. This includes everything preceding the path (host, port, etc). If the web resource targeted by the current request is related to a given component instance, then the identifier of the component instance is also referred in the returned path.The returned
UriBuildergives possibility to enrich the path to build a customized URI for a web entity.- Returns:
- the
UriBuilderinitialized with the absolute base path of the requested web resource.
-
getPath
public URI getPath()
Gets the path of the current request relative to the root path of the Silverpeas URI. All sequences of escaped octets are decoded.- Returns:
- the path of the requested URI.
-
getPathBuilder
public javax.ws.rs.core.UriBuilder getPathBuilder()
Gets the path of the current request relative to the root path of the Silverpeas URI in the form of aUriBuilder.The returned
UriBuildergives possibility to enrich the path to build a customized URI for a web entity.- Returns:
- the
UriBuilderinitialized with the path of the requested URI.
-
getRequestUri
public URI getRequestUri()
Get the absolute request URI including any query parameters. It takes into account the Silverpeas settings about the application host and context definition.- Returns:
- the absolute request URI.
-
getRequestUriBuilder
public javax.ws.rs.core.UriBuilder getRequestUriBuilder()
Get the absolute request URI including any query parameters in the form of aUriBuilder. It takes into account the Silverpeas settings about the application host and context definition.The returned
UriBuildergives possibility to enrich the path to build a customized URI for a web entity.- Returns:
- the
UriBuilderinitialized with the absolute request URI.
-
getAbsolutePath
public URI getAbsolutePath()
Get the absolute path of the request. This includes everything preceding the path (host, port etc.) but excludes query parameters.- Returns:
- the absolute path of the request.
-
getAbsolutePathBuilder
public javax.ws.rs.core.UriBuilder getAbsolutePathBuilder()
Get the absolute path of the request in the form of aUriBuilder. This includes everything preceding the path (host, port, etc.) but excludes query parameters.The returned
UriBuildergives possibility to enrich the path to build a customized URI for a web entity.- Returns:
- the
UriBuilderinitialized with the absolute path of the request.
-
getBaseUri
public URI getBaseUri()
Get the base URI of all Web resources in Silverpeas. URIs of REST web services are all relative to this base URI.- Returns:
- the base URI of all the web resources in Silverpeas (REST web services).
-
getBaseUriBuilder
public javax.ws.rs.core.UriBuilder getBaseUriBuilder()
Get the base URI of all Web resources in Silverpeas in the form of aUriBuilder. URIs of root REST web services are all relative to this base URI.- Returns:
- the
UriBuilderinitialized with the base URI of all the web resources in Silverpeas (REST web services) as a URI builder.
-
getPathParameters
public javax.ws.rs.core.MultivaluedMap<String,String> getPathParameters()
Get the values of any embedded URI template parameters. All sequences of escaped octets are decoded.- Returns:
- an unmodifiable map of parameter names and values.
-
getQueryParameters
public javax.ws.rs.core.MultivaluedMap<String,String> getQueryParameters()
Get the URI query parameters of the current request. The map keys are the names of the query parameters with any escaped characters decoded. All sequences of escaped octets in parameter names and values are decoded.- Returns:
- an unmodifiable map of query parameter names and values.
-
-