Ajout de la propriété cre.server.url-use-https
This commit is contained in:
parent
43ae9f1222
commit
e6b210881e
|
@ -11,6 +11,8 @@ public class Preferences {
|
|||
|
||||
public static boolean urlUsePort;
|
||||
|
||||
public static boolean urlUseHttps;
|
||||
|
||||
public static String uploadDirectory;
|
||||
|
||||
public static String passwordsFileName;
|
||||
|
|
|
@ -50,6 +50,7 @@ public class SpringConfiguration {
|
|||
@Bean
|
||||
public void setPreferences() {
|
||||
Preferences.urlUsePort = creProperties.isUrlUsePort();
|
||||
Preferences.urlUseHttps = creProperties.isUrlUseHttps();
|
||||
Preferences.uploadDirectory = creProperties.getUploadDirectory();
|
||||
Preferences.passwordsFileName = creProperties.getPasswordFile();
|
||||
Preferences.logger = LoggerFactory.getLogger(ColorRecipesExplorerApplication.class);
|
||||
|
|
|
@ -13,6 +13,7 @@ public class CREProperties {
|
|||
|
||||
private String passwordFile;
|
||||
private String uploadDirectory;
|
||||
private boolean urlUseHttps;
|
||||
private boolean urlUsePort;
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import java.net.URISyntaxException;
|
|||
|
||||
public class ControllerUtils {
|
||||
|
||||
private static final String HTTP_SCHEME = "http";
|
||||
private static final String HTTPS_SCHEME = "https";
|
||||
|
||||
public static String redirect(String viewName) {
|
||||
return String.format("redirect:/%s", viewName);
|
||||
}
|
||||
|
@ -20,9 +23,9 @@ public class ControllerUtils {
|
|||
}
|
||||
|
||||
public static String getUrlFromURI(URI uri) {
|
||||
String scheme = uri.getScheme();
|
||||
String host = uri.getHost();
|
||||
int port = uri.getPort();
|
||||
String scheme = getScheme();
|
||||
|
||||
return String.format("%s://%s:%s", scheme, host, port);
|
||||
}
|
||||
|
@ -34,7 +37,7 @@ public class ControllerUtils {
|
|||
HttpServletRequest request = attributes.getRequest();
|
||||
|
||||
String port = ":" + (Preferences.urlUsePort ? request.getServerPort() : "");
|
||||
return String.format("%s://%s%s%s", request.getScheme(), request.getServerName(), port, request.getContextPath());
|
||||
return String.format("%s://%s%s%s", getScheme(), request.getServerName(), port, request.getContextPath());
|
||||
}
|
||||
|
||||
public static String getLatestUrl() {
|
||||
|
@ -55,4 +58,8 @@ public class ControllerUtils {
|
|||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static String getScheme() {
|
||||
return Preferences.urlUseHttps ? HTTPS_SCHEME : HTTP_SCHEME;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ server.error.whitelabel.enabled=false
|
|||
cre.server.upload-directory=./workdir
|
||||
cre.server.password-file=passwords.txt
|
||||
cre.server.url-use-port=true
|
||||
cre.server.url-use-https=false
|
||||
|
||||
# DEFAULT MATERIAL TYPES
|
||||
entities.material-types.defaults[0].name=Aucun
|
||||
|
|
Loading…
Reference in New Issue