throw new Fault(new Message("START_UP_SERVER_FAILED_MSG", LOG, e.getMessage(), port), e);
}
}
String contextName = HttpUriMapper.getContextName(url.getPath());
ContextHandler context = new ContextHandler();
context.setContextPath(contextName);
// bind the jetty http handler with the context handler
if (isSessionSupport) {
// If we have sessions, we need two handlers.
if (sessionManager == null) {
sessionManager = new HashSessionManager();
HashSessionIdManager idManager = new HashSessionIdManager();
sessionManager.setIdManager(idManager);
}
SessionHandler sessionHandler = new SessionHandler(sessionManager);
if (securityHandler != null) {
//use the securityHander which already wrap the jetty http handler
sessionHandler.setHandler(securityHandler);
} else {
sessionHandler.setHandler(handler);
}
context.setHandler(sessionHandler);
} else {
// otherwise, just the one.
if (securityHandler != null) {
//use the securityHander which already wrap the jetty http handler
context.setHandler(securityHandler);
} else {
context.setHandler(handler);
}
}
contexts.addHandler(context);
ServletContext sc = context.getServletContext();
handler.setServletContext(sc);
final String smap = HttpUriMapper.getResourceBase(url.getPath());
handler.setName(smap);
if (contexts.isStarted()) {
try {
context.start();
} catch (Exception ex) {
LOG.log(Level.WARNING, "ADD_HANDLER_FAILED_MSG", new Object[] {ex.getMessage()});
}
}