This commit is contained in:
wentch
2016-01-27 14:56:46 +08:00
parent 6b0247ae7f
commit 7768426627
2 changed files with 6 additions and 3 deletions

View File

@@ -118,8 +118,7 @@ public abstract class BasedHttpServlet extends HttpServlet {
throw new IOException(this.getClass().getName() + " not found method for URI(" + request.getRequestURI() + ")");
}
@Override
public void init(HttpContext context, AnyValue config) {
public final void preInit(HttpContext context, AnyValue config) {
String path = _prefix == null ? "" : _prefix;
WebServlet ws = this.getClass().getAnnotation(WebServlet.class);
if (ws != null && !ws.repair()) path = "";

View File

@@ -36,7 +36,11 @@ public final class HttpPrepareServlet extends PrepareServlet<HttpContext, HttpRe
@Override
public void init(HttpContext context, AnyValue config) {
this.servlets.stream().forEach(s -> {
if (s instanceof WebSocketServlet) ((WebSocketServlet) s).preInit(context, s._conf);
if (s instanceof WebSocketServlet) {
((WebSocketServlet) s).preInit(context, s._conf);
} else if (s instanceof BasedHttpServlet) {
((BasedHttpServlet) s).preInit(context, s._conf);
}
s.init(context, s._conf);
});
final WatchFactory watch = context.getWatchFactory();