|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.util.UriComponentsBuilder org.springframework.web.servlet.support.ServletUriComponentsBuilder
public class ServletUriComponentsBuilder
A builder for UriComponents
that offers static factory methods to
extract information from an HttpServletRequest
.
Constructor Summary | |
---|---|
protected |
ServletUriComponentsBuilder()
Default constructor. |
Method Summary | |
---|---|
static ServletUriComponentsBuilder |
fromContextPath(HttpServletRequest request)
Return a builder initialized with the host, port, scheme, and the context path of the given request. |
static ServletUriComponentsBuilder |
fromCurrentContextPath()
Equivalent to fromContextPath(HttpServletRequest) except the
request is obtained via RequestContextHolder . |
static ServletUriComponentsBuilder |
fromCurrentRequest()
Equivalent to fromRequest(HttpServletRequest) except the
request is obtained via RequestContextHolder . |
static ServletUriComponentsBuilder |
fromCurrentServletMapping()
Equivalent to fromServletMapping(HttpServletRequest) except the
request is obtained via RequestContextHolder . |
static ServletUriComponentsBuilder |
fromRequest(HttpServletRequest request)
Return a builder initialized with all available information in the given request including scheme, host, port, path, and query string. |
static ServletUriComponentsBuilder |
fromServletMapping(HttpServletRequest request)
Return a builder initialized with the host, port, scheme, context path, and the servlet mapping of the given request. |
Methods inherited from class org.springframework.web.util.UriComponentsBuilder |
---|
build, build, buildAndExpand, buildAndExpand, fragment, fromHttpUrl, fromPath, fromUri, fromUriString, host, newInstance, path, pathSegment, port, query, queryParam, replacePath, replaceQuery, replaceQueryParam, scheme, uri, userInfo |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ServletUriComponentsBuilder()
fromContextPath(HttpServletRequest)
,
fromServletMapping(HttpServletRequest)
,
fromRequest(HttpServletRequest)
,
fromCurrentContextPath()
,
fromCurrentServletMapping()
,
fromCurrentRequest()
Method Detail |
---|
public static ServletUriComponentsBuilder fromContextPath(HttpServletRequest request)
public static ServletUriComponentsBuilder fromServletMapping(HttpServletRequest request)
For example if the servlet is mapped by name, i.e. "/main/*"
,
then the resulting path will be /appContext/main
. If the servlet
path is not mapped by name, i.e. "/"
or "*.html"
, then
the resulting path will contain the context path only.
public static ServletUriComponentsBuilder fromRequest(HttpServletRequest request)
public static ServletUriComponentsBuilder fromCurrentContextPath()
fromContextPath(HttpServletRequest)
except the
request is obtained via RequestContextHolder
.
public static ServletUriComponentsBuilder fromCurrentServletMapping()
fromServletMapping(HttpServletRequest)
except the
request is obtained via RequestContextHolder
.
public static ServletUriComponentsBuilder fromCurrentRequest()
fromRequest(HttpServletRequest)
except the
request is obtained via RequestContextHolder
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |