mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
use new ProxyServlet
This commit is contained in:
@@ -35,13 +35,13 @@ package sonia.scm.plugin;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.web.proxy.ProxyConfiguration;
|
||||
import sonia.scm.xml.XmlIntervalAdapter;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -89,9 +89,9 @@ public class BackendConfiguration
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public URL getNewsUrl()
|
||||
public ProxyConfiguration getNewsConfiguration()
|
||||
{
|
||||
return newsUrl;
|
||||
return newsConfiguration;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,85 +138,6 @@ public class BackendConfiguration
|
||||
return multithreaded;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param directories
|
||||
*/
|
||||
public void setDirectories(Set<File> directories)
|
||||
{
|
||||
this.directories = directories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param excludes
|
||||
*/
|
||||
public void setExcludes(Set<String> excludes)
|
||||
{
|
||||
this.excludes = excludes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param multithreaded
|
||||
*/
|
||||
public void setMultithreaded(boolean multithreaded)
|
||||
{
|
||||
this.multithreaded = multithreaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param newsUrl
|
||||
*/
|
||||
public void setNewsUrl(URL newsUrl)
|
||||
{
|
||||
this.newsUrl = newsUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repositories
|
||||
*/
|
||||
public void setRepositories(Set<PluginRepository> repositories)
|
||||
{
|
||||
this.repositories = repositories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param scannInterval
|
||||
*/
|
||||
public void setScannInterval(long scannInterval)
|
||||
{
|
||||
this.scannInterval = scannInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param trackingCode
|
||||
*/
|
||||
public void setTrackingCode(String trackingCode)
|
||||
{
|
||||
this.trackingCode = trackingCode;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@@ -233,8 +154,8 @@ public class BackendConfiguration
|
||||
private boolean multithreaded = true;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "news-url")
|
||||
private URL newsUrl;
|
||||
@XmlElement(name = "news-settings")
|
||||
private ProxyConfiguration newsConfiguration;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "repository")
|
||||
|
||||
@@ -37,17 +37,18 @@ package sonia.scm.plugin;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import sonia.scm.web.proxy.ProxyURLProvider;
|
||||
import sonia.scm.web.proxy.ProxyConfiguration;
|
||||
import sonia.scm.web.proxy.ProxyConfigurationProvider;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.net.URL;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class NewsProxyURLProvider implements ProxyURLProvider
|
||||
public class NewsProxyURLProvider implements ProxyConfigurationProvider
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -68,12 +69,14 @@ public class NewsProxyURLProvider implements ProxyURLProvider
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public URL getProxyURL()
|
||||
public ProxyConfiguration getConfiguration(HttpServletRequest request)
|
||||
{
|
||||
return configuration.getNewsUrl();
|
||||
return configuration.getNewsConfiguration();
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
@@ -52,8 +52,6 @@ import sonia.scm.plugin.scanner.PluginScannerFactory;
|
||||
import sonia.scm.plugin.scanner.PluginScannerScheduler;
|
||||
import sonia.scm.plugin.scanner.TimerPluginScannerScheduler;
|
||||
import sonia.scm.util.Util;
|
||||
import sonia.scm.web.proxy.ProxyServet;
|
||||
import sonia.scm.web.proxy.ProxyURLProvider;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -66,6 +64,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
import sonia.scm.web.proxy.ProxyConfigurationProvider;
|
||||
import sonia.scm.web.proxy.ProxyServlet;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -147,8 +147,8 @@ public class ScmBackendModule extends ServletModule
|
||||
bind(UrlBuilderFactory.class);
|
||||
|
||||
// news proxy
|
||||
bind(ProxyURLProvider.class).to(NewsProxyURLProvider.class);
|
||||
serve("/news*").with(ProxyServet.class);
|
||||
bind(ProxyConfigurationProvider.class).to(NewsProxyURLProvider.class);
|
||||
serve("/news*").with(ProxyServlet.class);
|
||||
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
Purpose of the document follows.
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<configuration scan="true" scanPeriod="30 seconds">
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are by default assigned the type
|
||||
|
||||
Reference in New Issue
Block a user