Revise ServletUriComponentsBuilder javadoc

Issue: SPR-17255
This commit is contained in:
Juergen Hoeller
2018-09-07 18:21:25 +02:00
parent 7f82c192f5
commit 717e6dd2d9

View File

@@ -80,13 +80,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
/** /**
* Prepare a builder from the host, port, scheme, and context path of the * Prepare a builder from the host, port, scheme, and context path of the
* given HttpServletRequest. * given HttpServletRequest.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromContextPath(HttpServletRequest request) { public static ServletUriComponentsBuilder fromContextPath(HttpServletRequest request) {
ServletUriComponentsBuilder builder = initFromRequest(request); ServletUriComponentsBuilder builder = initFromRequest(request);
@@ -102,13 +100,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
* will end with "/main". If the servlet is mapped otherwise, e.g. * will end with "/main". If the servlet is mapped otherwise, e.g.
* {@code "/"} or {@code "*.do"}, the result will be the same as * {@code "/"} or {@code "*.do"}, the result will be the same as
* if calling {@link #fromContextPath(HttpServletRequest)}. * if calling {@link #fromContextPath(HttpServletRequest)}.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromServletMapping(HttpServletRequest request) { public static ServletUriComponentsBuilder fromServletMapping(HttpServletRequest request) {
ServletUriComponentsBuilder builder = fromContextPath(request); ServletUriComponentsBuilder builder = fromContextPath(request);
@@ -121,13 +117,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
/** /**
* Prepare a builder from the host, port, scheme, and path (but not the query) * Prepare a builder from the host, port, scheme, and path (but not the query)
* of the HttpServletRequest. * of the HttpServletRequest.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromRequestUri(HttpServletRequest request) { public static ServletUriComponentsBuilder fromRequestUri(HttpServletRequest request) {
ServletUriComponentsBuilder builder = initFromRequest(request); ServletUriComponentsBuilder builder = initFromRequest(request);
@@ -138,13 +132,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
/** /**
* Prepare a builder by copying the scheme, host, port, path, and * Prepare a builder by copying the scheme, host, port, path, and
* query string of an HttpServletRequest. * query string of an HttpServletRequest.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromRequest(HttpServletRequest request) { public static ServletUriComponentsBuilder fromRequest(HttpServletRequest request) {
ServletUriComponentsBuilder builder = initFromRequest(request); ServletUriComponentsBuilder builder = initFromRequest(request);
@@ -209,13 +201,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
/** /**
* Same as {@link #fromContextPath(HttpServletRequest)} except the * Same as {@link #fromContextPath(HttpServletRequest)} except the
* request is obtained through {@link RequestContextHolder}. * request is obtained through {@link RequestContextHolder}.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromCurrentContextPath() { public static ServletUriComponentsBuilder fromCurrentContextPath() {
return fromContextPath(getCurrentRequest()); return fromContextPath(getCurrentRequest());
@@ -224,13 +214,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
/** /**
* Same as {@link #fromServletMapping(HttpServletRequest)} except the * Same as {@link #fromServletMapping(HttpServletRequest)} except the
* request is obtained through {@link RequestContextHolder}. * request is obtained through {@link RequestContextHolder}.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromCurrentServletMapping() { public static ServletUriComponentsBuilder fromCurrentServletMapping() {
return fromServletMapping(getCurrentRequest()); return fromServletMapping(getCurrentRequest());
@@ -239,13 +227,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
/** /**
* Same as {@link #fromRequestUri(HttpServletRequest)} except the * Same as {@link #fromRequestUri(HttpServletRequest)} except the
* request is obtained through {@link RequestContextHolder}. * request is obtained through {@link RequestContextHolder}.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromCurrentRequestUri() { public static ServletUriComponentsBuilder fromCurrentRequestUri() {
return fromRequestUri(getCurrentRequest()); return fromRequestUri(getCurrentRequest());
@@ -254,13 +240,11 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
/** /**
* Same as {@link #fromRequest(HttpServletRequest)} except the * Same as {@link #fromRequest(HttpServletRequest)} except the
* request is obtained through {@link RequestContextHolder}. * request is obtained through {@link RequestContextHolder}.
*
* <p><strong>Note:</strong> This method extracts values from "Forwarded" * <p><strong>Note:</strong> This method extracts values from "Forwarded"
* and "X-Forwarded-*" headers if found. See class-level docs. * and "X-Forwarded-*" headers if found. See class-level docs.
*
* <p>As of 4.3.15, this method replaces the contextPath with the value * <p>As of 4.3.15, this method replaces the contextPath with the value
* of "X-Forwarded-Prefix" rather than prepending, thus aligning with * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
* {@code ForwardedHeaderFiller}. * {@code ForwardedHeaderFilter}.
*/ */
public static ServletUriComponentsBuilder fromCurrentRequest() { public static ServletUriComponentsBuilder fromCurrentRequest() {
return fromRequest(getCurrentRequest()); return fromRequest(getCurrentRequest());