spring-hateoas-ext/src/main/java/de/escalon/hypermedia/spring/AffordanceBuilder.java
static UriComponentsBuilder getBuilder() {
        if (RequestContextHolder.getRequestAttributes() == null) {
            return UriComponentsBuilder.fromPath("/");
        }

        HttpServletRequest request = getCurrentRequest();
        UriComponentsBuilder builder = ServletUriComponentsBuilder.fromServletMapping(request);

        // special case handling for X-Forwarded-Ssl:
        // apply it, but only if X-Forwarded-Proto is unset.

        String forwardedSsl = request.getHeader("X-Forwarded-Ssl");
        ForwardedHeader forwarded = ForwardedHeader.of(request.getHeader(ForwardedHeader.NAME));
        String proto = hasText(forwarded.getProto()) ? forwarded.getProto() : request.getHeader("X-Forwarded-Proto");

        if (!hasText(proto) && hasText(forwardedSsl) && forwardedSsl.equalsIgnoreCase("on")) {
            builder.scheme("https");
        }

        return builder;
    }
static UriComponentsBuilder getBuilder() {
        if (RequestContextHolder.getRequestAttributes() == null) {
            return UriComponentsBuilder.fromPath("/");
        }

        HttpServletRequest request = getCurrentRequest();
        UriComponentsBuilder builder = ServletUriComponentsBuilder.fromServletMapping(request);

        // special case handling for X-Forwarded-Ssl:
        // apply it, but only if X-Forwarded-Proto is unset.

        String forwardedSsl = request.getHeader("X-Forwarded-Ssl");
        ForwardedHeader forwarded = ForwardedHeader.of(request.getHeader(ForwardedHeader.NAME));
        String proto = hasText(forwarded.getProto()) ? forwarded.getProto() : request.getHeader("X-Forwarded-Proto");

        if (!hasText(proto) && hasText(forwardedSsl) && forwardedSsl.equalsIgnoreCase("on")) {
            builder.scheme("https");
        }

        return builder;
    }
static UriComponentsBuilder getBuilder ( ) { if ( RequestContextHolder . getRequestAttributes ( ) == null ) { return UriComponentsBuilder . fromPath ( "/" ) ; } HttpServletRequest request = getCurrentRequest ( ) ; UriComponentsBuilder builder = ServletUriComponentsBuilder . fromServletMapping ( request ) ; // special case handling for X-Forwarded-Ssl: // apply it, but only if X-Forwarded-Proto is unset. String forwardedSsl = request . getHeader ( "X-Forwarded-Ssl" ) ; ForwardedHeader forwarded = ForwardedHeader . of ( request . getHeader ( ForwardedHeader . NAME ) ) ; String proto = hasText ( forwarded . getProto ( ) ) ? forwarded . getProto ( ) : request . getHeader ( "X-Forwarded-Proto" ) ; if ( ! hasText ( proto ) && hasText ( forwardedSsl ) && forwardedSsl . equalsIgnoreCase ( "on" ) ) { builder . scheme ( "https" ) ; } return builder ; }
Returns a {@link UriComponentsBuilder} obtained from the current servlet mapping with scheme tweaked in case the
request contains an {@code X-Forwarded-Ssl} header, which is not (yet) supported by the underlying
{@link UriComponentsBuilder}. If no {@link RequestContextHolder} exists (you're outside a Spring Web call), fall
back to relative URIs.

@return
Returns a { @link UriComponentsBuilder } obtained from the current servlet mapping with scheme tweaked in case the request contains an { @code X - Forwarded - Ssl } header which is not ( yet ) supported by the underlying { @link UriComponentsBuilder } . If no { @link RequestContextHolder } exists ( you re outside a Spring Web call ) fall back to relative URIs .