mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
fixed missing servlets and filters
WebElements with same attributes are not bound, because they are stored in a HashSet and the fields from the parent class were not used for hashCode and equals. The equals and hashCode methods of WebElementDescriptor are now taking the fields of ClassElement in account.
This commit is contained in:
@@ -44,34 +44,18 @@ import javax.servlet.http.HttpServlet;
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class WebElementModule extends ServletModule
|
||||
{
|
||||
public class WebElementModule extends ServletModule {
|
||||
|
||||
/**
|
||||
* the logger for WebElementModule
|
||||
*/
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(WebElementModule.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WebElementModule.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param pluginLoader
|
||||
*/
|
||||
public WebElementModule(PluginLoader pluginLoader)
|
||||
{
|
||||
collector = WebElementCollector.collect(pluginLoader);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void configureServlets()
|
||||
{
|
||||
@@ -86,17 +70,10 @@ public class WebElementModule extends ServletModule
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param filter
|
||||
*/
|
||||
private void bindFilter(TypedWebElementDescriptor<Filter> filter)
|
||||
{
|
||||
private void bindFilter(TypedWebElementDescriptor<Filter> filter) {
|
||||
Class<Filter> clazz = filter.getClazz();
|
||||
|
||||
logger.info("bind filter {} to filter chain", clazz);
|
||||
LOG.info("bind filter {} to filter chain", clazz);
|
||||
|
||||
// filters must be in singleton scope
|
||||
bind(clazz).in(Scopes.SINGLETON);
|
||||
@@ -104,12 +81,13 @@ public class WebElementModule extends ServletModule
|
||||
WebElementDescriptor opts = filter.getDescriptor();
|
||||
FilterKeyBindingBuilder builder;
|
||||
|
||||
if (opts.isRegex())
|
||||
{
|
||||
if (opts.isRegex()) {
|
||||
LOG.debug("bind regex filter {} to {} and {}", clazz, opts.getPattern(), opts.getMorePatterns());
|
||||
builder = filterRegex(opts.getPattern(), opts.getMorePatterns());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG.debug("bind glob filter {} to {} and {}", clazz, opts.getPattern(), opts.getMorePatterns());
|
||||
builder = filter(opts.getPattern(), opts.getMorePatterns());
|
||||
}
|
||||
|
||||
@@ -117,18 +95,10 @@ public class WebElementModule extends ServletModule
|
||||
builder.through(clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param servlet
|
||||
*/
|
||||
private void bindServlet(
|
||||
TypedWebElementDescriptor<HttpServlet> servlet)
|
||||
{
|
||||
private void bindServlet(TypedWebElementDescriptor<HttpServlet> servlet) {
|
||||
Class<HttpServlet> clazz = servlet.getClazz();
|
||||
|
||||
logger.info("bind servlet {} to servlet chain", clazz);
|
||||
LOG.info("bind servlet {} to servlet chain", clazz);
|
||||
|
||||
// filters must be in singleton scope
|
||||
bind(clazz).in(Scopes.SINGLETON);
|
||||
@@ -136,12 +106,11 @@ public class WebElementModule extends ServletModule
|
||||
WebElementDescriptor opts = servlet.getDescriptor();
|
||||
ServletKeyBindingBuilder builder;
|
||||
|
||||
if (opts.isRegex())
|
||||
{
|
||||
if (opts.isRegex()) {
|
||||
LOG.debug("bind regex servlet {} to {} and {}", clazz, opts.getPattern(), opts.getMorePatterns());
|
||||
builder = serveRegex(opts.getPattern(), opts.getMorePatterns());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LOG.debug("bind glob servlet {} to {} and {}", clazz, opts.getPattern(), opts.getMorePatterns());
|
||||
builder = serve(opts.getPattern(), opts.getMorePatterns());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user