mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
replace ssl and forward parameters with base url to fix #32
This commit is contained in:
@@ -147,16 +147,20 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
this.servername = other.servername;
|
||||
this.dateFormat = other.dateFormat;
|
||||
this.pluginUrl = other.pluginUrl;
|
||||
this.sslPort = other.sslPort;
|
||||
this.enableSSL = other.enableSSL;
|
||||
this.enablePortForward = other.enablePortForward;
|
||||
this.forwardPort = other.forwardPort;
|
||||
this.anonymousAccessEnabled = other.anonymousAccessEnabled;
|
||||
this.adminUsers = other.adminUsers;
|
||||
this.adminGroups = other.adminGroups;
|
||||
this.enableProxy = other.enableProxy;
|
||||
this.proxyPort = other.proxyPort;
|
||||
this.proxyServer = other.proxyServer;
|
||||
this.forceBaseUrl = other.forceBaseUrl;
|
||||
this.baseUrl = other.baseUrl;
|
||||
|
||||
// deprecated fields
|
||||
this.sslPort = other.sslPort;
|
||||
this.enableSSL = other.enableSSL;
|
||||
this.enablePortForward = other.enablePortForward;
|
||||
this.forwardPort = other.forwardPort;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,6 +199,18 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
return adminUsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @since 1.5
|
||||
*/
|
||||
public String getBaseUrl()
|
||||
{
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -211,7 +227,9 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @deprecated use {@link #getBaseUrl()}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getForwardPort()
|
||||
{
|
||||
return forwardPort;
|
||||
@@ -266,7 +284,9 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @deprecated use {@link #getBaseUrl()} and {@link #isForceBaseUrl()}
|
||||
*/
|
||||
@Deprecated
|
||||
public int getSslPort()
|
||||
{
|
||||
return sslPort;
|
||||
@@ -288,7 +308,9 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @deprecated use {@link #getBaseUrl()}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isEnablePortForward()
|
||||
{
|
||||
return enablePortForward;
|
||||
@@ -310,12 +332,26 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @deprecated use {@link #getBaseUrl()} and {@link #isForceBaseUrl()}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isEnableSSL()
|
||||
{
|
||||
return enableSSL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @since 1.5
|
||||
*/
|
||||
public boolean isForceBaseUrl()
|
||||
{
|
||||
return forceBaseUrl;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -351,6 +387,18 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
this.anonymousAccessEnabled = anonymousAccessEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param baseUrl
|
||||
* @since 1.5
|
||||
*/
|
||||
public void setBaseUrl(String baseUrl)
|
||||
{
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -367,7 +415,9 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
*
|
||||
*
|
||||
* @param enablePortForward
|
||||
* @deprecated use {@link #setBaseUrl(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEnablePortForward(boolean enablePortForward)
|
||||
{
|
||||
this.enablePortForward = enablePortForward;
|
||||
@@ -389,7 +439,9 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
*
|
||||
*
|
||||
* @param enableSSL
|
||||
* @deprecated use {@link #setBaseUrl(String)} and {$link #setForceBaseUrl(boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setEnableSSL(boolean enableSSL)
|
||||
{
|
||||
this.enableSSL = enableSSL;
|
||||
@@ -399,8 +451,22 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param forwardPort
|
||||
* @param forceBaseUrl
|
||||
* @since 1.5
|
||||
*/
|
||||
public void setForceBaseUrl(boolean forceBaseUrl)
|
||||
{
|
||||
this.forceBaseUrl = forceBaseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param forwardPort
|
||||
* @deprecated use {@link #setBaseUrl(String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setForwardPort(int forwardPort)
|
||||
{
|
||||
this.forwardPort = forwardPort;
|
||||
@@ -455,7 +521,9 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
*
|
||||
*
|
||||
* @param sslPort
|
||||
* @deprecated use {@link #setBaseUrl(String)} and {$link #setForceBaseUrl(boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setSslPort(int sslPort)
|
||||
{
|
||||
this.sslPort = sslPort;
|
||||
@@ -473,10 +541,19 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
@XmlJavaTypeAdapter(XmlSetStringAdapter.class)
|
||||
private Set<String> adminUsers;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "base-url")
|
||||
private String baseUrl;
|
||||
|
||||
/** Field description */
|
||||
private boolean enableProxy = false;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "force-base-url")
|
||||
private boolean forceBaseUrl;
|
||||
|
||||
/** @deprecated use {@link $baseUrl} */
|
||||
@Deprecated
|
||||
private int forwardPort = 80;
|
||||
|
||||
/** Field description */
|
||||
@@ -492,13 +569,16 @@ public class ScmConfiguration implements ListenerSupport<ConfigChangedListener>
|
||||
/** Field description */
|
||||
private String servername = "localhost";
|
||||
|
||||
/** Field description */
|
||||
/** @deprecated use {@link $baseUrl} and {$link $foreceBaseUrl} */
|
||||
@Deprecated
|
||||
private boolean enableSSL = false;
|
||||
|
||||
/** Field description */
|
||||
/** @deprecated use {@link $baseUrl} */
|
||||
@Deprecated
|
||||
private boolean enablePortForward = false;
|
||||
|
||||
/** Field description */
|
||||
/** @deprecated use {@link $baseUrl} and {$link $foreceBaseUrl} */
|
||||
@Deprecated
|
||||
private int sslPort = 8181;
|
||||
|
||||
/** Field description */
|
||||
|
||||
@@ -83,6 +83,29 @@ public class HttpUtil
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param configuration
|
||||
* @param path
|
||||
*
|
||||
* @return
|
||||
* @since 1.5
|
||||
*/
|
||||
public static String getCompleteUrl(ScmConfiguration configuration,
|
||||
String path)
|
||||
{
|
||||
String url = configuration.getBaseUrl();
|
||||
|
||||
if (url.endsWith("/") && path.startsWith("/"))
|
||||
{
|
||||
url = url.substring(0, url.length());
|
||||
}
|
||||
|
||||
return url.concat(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -91,7 +114,9 @@ public class HttpUtil
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
* @deprecated use {@link #getCompleteUrl(sonia.scm.config.ScmConfiguration, java.lang.String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getServerPort(ScmConfiguration configuration,
|
||||
HttpServletRequest request)
|
||||
{
|
||||
@@ -137,6 +162,6 @@ public class HttpUtil
|
||||
*/
|
||||
public static String getStrippedURI(HttpServletRequest request, String uri)
|
||||
{
|
||||
return request.getRequestURI().substring(request.getContextPath().length());
|
||||
return uri.substring(request.getContextPath().length());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user