#758 - Polishing.

Original pull request: #717.
This commit is contained in:
Oliver Drotbohm
2018-12-06 14:21:10 +01:00
parent bb4a4a615c
commit eff893fcf8
4 changed files with 18 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
*/
package org.springframework.hateoas.mvc;
import static org.springframework.hateoas.mvc.ForwardedHeader.handleXForwardedSslHeader;
import static org.springframework.hateoas.mvc.ForwardedHeader.*;
import lombok.RequiredArgsConstructor;
import lombok.experimental.Delegate;
@@ -330,7 +330,7 @@ public class ControllerLinkBuilder extends LinkBuilderSupport<ControllerLinkBuil
* @return
*/
private static boolean isSpringAtLeast5_1() {
String versionOfSpringFramework = ApplicationContext.class.getPackage().getImplementationVersion();
String[] parts = versionOfSpringFramework.split("\\.");
@@ -377,7 +377,7 @@ public class ControllerLinkBuilder extends LinkBuilderSupport<ControllerLinkBuil
public UriTemplate getMappingAsUriTemplate(Class<?> type, Method method) {
String mapping = delegate.getMapping(type, method);
return templates.computeIfAbsent(mapping, UriTemplate::new);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2017-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,8 +46,8 @@ class ForwardedHeader {
}
/**
* Utility method to pull handling of {@literal X-Forwarded-Ssl} into a class that will be removed when
* rebaselined against Spring 5.1
* Utility method to pull handling of {@literal X-Forwarded-Ssl} into a class that will be removed when rebaselined
* against Spring 5.1
*
* @param request
* @param builder
@@ -55,7 +55,8 @@ class ForwardedHeader {
* @deprecated No longer needed with Spring 5.1
*/
@Deprecated
public static UriComponentsBuilder handleXForwardedSslHeader(HttpServletRequest request, UriComponentsBuilder builder) {
public static UriComponentsBuilder handleXForwardedSslHeader(HttpServletRequest request,
UriComponentsBuilder builder) {
// special case handling for X-Forwarded-Ssl:
// apply it, but only if X-Forwarded-Proto is unset.