mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 10:16:16 +01:00
Generalize servlet decorator structure
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ScmProviderHttpServletDecorator implements ScmProviderHttpServlet {
|
||||
|
||||
private final ScmProviderHttpServlet object;
|
||||
|
||||
public ScmProviderHttpServletDecorator(ScmProviderHttpServlet object) {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void service(HttpServletRequest request, HttpServletResponse response, Repository repository) throws ServletException, IOException {
|
||||
object.service(request, response, repository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
object.init(config);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import sonia.scm.DecoratorFactory;
|
||||
import sonia.scm.plugin.ExtensionPoint;
|
||||
|
||||
@ExtensionPoint
|
||||
public interface ScmProviderHttpServletDecoratorFactory extends DecoratorFactory<ScmProviderHttpServlet> {
|
||||
/**
|
||||
* Has to return <code>true</code> if this factory provides a decorator for the given scm type (eg. "git", "hg" or
|
||||
* "svn").
|
||||
* @param type The current scm type this factory can provide a decorator for.
|
||||
* @return <code>true</code> when the provided decorator should be used for the given scm type.
|
||||
*/
|
||||
boolean handlesScmType(String type);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import sonia.scm.DecoratorFactory;
|
||||
import sonia.scm.plugin.ExtensionPoint;
|
||||
|
||||
@ExtensionPoint
|
||||
public interface ScmProviderHttpServletFactory extends DecoratorFactory<ScmProviderHttpServlet> {}
|
||||
Reference in New Issue
Block a user