Refine search
/** * @param contextPath The context path * @param webApp The URL or filename of the webapp directory or war file. */ public WebAppContext(String webApp,String contextPath) { this(null,contextPath,null,null,null,new ErrorPageErrorHandler(),SESSIONS|SECURITY); setWar(webApp); }
if (!location.startsWith("/")) throw new IllegalStateException("Missing leading '/' for location: " + location); ErrorPageErrorHandler handler = (ErrorPageErrorHandler)context.getErrorHandler(); String originName = "error."+error; switch (context.getMetaData().getOrigin(originName)) handler.addErrorPage(code,location); else handler.addErrorPage(error,location); context.getMetaData().setOrigin("error."+error, descriptor); break; handler.addErrorPage(code,location); else handler.addErrorPage(error,location); context.getMetaData().setOrigin("error."+error, descriptor); if (!handler.getErrorPages().get(error).equals(location)) throw new IllegalStateException("Conflicting error-code or exception-type "+error+" in "+descriptor.getResource()); break;
@Override public void deconfigure (WebAppContext context) throws Exception { context.setWelcomeFiles(null); if (context.getErrorHandler() instanceof ErrorPageErrorHandler) ((ErrorPageErrorHandler) context.getErrorHandler()).setErrorPages(null); // TODO remove classpaths from classloader } }
mServletContextHandler.setResourceBase(resourceDir.getAbsolutePath()); mServletContextHandler.addServlet(DefaultServlet.class, "/"); ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler(); errorHandler.addErrorPage(404, "/"); mServletContextHandler.setErrorHandler(errorHandler); } catch (MalformedURLException e) {
wac = new WebAppContext(); wac.setContextPath(getContextPath()); wac.setTempDirectory(new File("temp")); wac.setClassLoader(classLoader); wac.setConfigurationDiscovered(true); ErrorPageErrorHandler handler = new ErrorPageErrorHandler(); handler.setErrorPages(getErrorPages()); ep = handler;
private HandlerCollection createHandlers() { WebAppContext context = new WebAppContext(); context.setContextPath(contextPath); context.setWar(webDir); context.setTempDirectory(new File(tempDir)); ErrorPageErrorHandler errorPage = new ErrorPageErrorHandler(); errorPage.addErrorPage(404,"/404"); context.setErrorHandler(errorPage); RequestLogHandler logHandler = new RequestLogHandler(); logHandler.setRequestLog(createRequestLog()); HandlerCollection handlerCollection = new HandlerCollection(); handlerCollection.setHandlers(new Handler[]{context, logHandler}); return handlerCollection; }
/** * @param parent The parent HandlerContainer. * @param contextPath The context path * @param webApp The URL or filename of the webapp directory or war file. */ public WebAppContext(HandlerContainer parent, String webApp, String contextPath) { super(parent,contextPath,SESSIONS|SECURITY); _scontext=new Context(); setWar(webApp); setErrorHandler(new ErrorPageErrorHandler()); setProtectedTargets(__dftProtectedTargets); }
throw new IllegalStateException("No output for quickstart generation"); _webApp.getMetaData().getOrigins(); if (_webApp.getBaseResource()==null) throw new IllegalArgumentException("No base resource for "+this); MetaData md = _webApp.getMetaData(); Map<String,String> errorPages = ((ErrorPageErrorHandler)_webApp.getErrorHandler()).getErrorPages(); if (errorPages != null)
@Override public void deconfigure (WebAppContext context) throws Exception { ServletHandler _servletHandler = context.getServletHandler(); context.setWelcomeFiles(null); if (context.getErrorHandler() instanceof ErrorPageErrorHandler) ((ErrorPageErrorHandler) context.getErrorHandler()).setErrorPages(null); // TODO remove classpaths from classloader } }
/** * This constructor is used in the geronimo integration. * * @param parent the parent handler * @param contextPath the context path * @param sessionHandler SessionHandler for this web app * @param securityHandler SecurityHandler for this web app * @param servletHandler ServletHandler for this web app * @param errorHandler ErrorHandler for this web app * @param options the options ({@link ServletContextHandler#SESSIONS} and/or {@link ServletContextHandler#SECURITY}) */ public WebAppContext(HandlerContainer parent, String contextPath, SessionHandler sessionHandler, SecurityHandler securityHandler, ServletHandler servletHandler, ErrorHandler errorHandler,int options) { super(parent, contextPath,sessionHandler, securityHandler, servletHandler, errorHandler,options); _scontext = new Context(); setErrorHandler(errorHandler != null ? errorHandler : new ErrorPageErrorHandler()); setProtectedTargets(__dftProtectedTargets); }
public WebAppContext() { this(null,null,null,null,null,new ErrorPageErrorHandler(),SESSIONS|SECURITY); }
/** * @param contextPath The context path * @param webApp The URL or filename of the webapp directory or war file. */ public WebAppContext(Resource webApp, String contextPath) { this(null,contextPath,null,null,null,new ErrorPageErrorHandler(),SESSIONS|SECURITY); setWarResource(webApp); }
private void addJettyErrorPages(ErrorHandler errorHandler, Collection<ErrorPage> errorPages) { if (errorHandler instanceof ErrorPageErrorHandler) { ErrorPageErrorHandler handler = (ErrorPageErrorHandler) errorHandler; for (ErrorPage errorPage : errorPages) { if (errorPage.isGlobal()) { handler.addErrorPage(ErrorPageErrorHandler.GLOBAL_ERROR_PAGE, errorPage.getPath()); } else { if (errorPage.getExceptionName() != null) { handler.addErrorPage(errorPage.getExceptionName(), errorPage.getPath()); } else { handler.addErrorPage(errorPage.getStatusCode(), errorPage.getPath()); } } } } }
@Override public synchronized void removeErrorPage(final ErrorPageModel model) { final ServletContextHandler context = server.getContext(model .getContextModel().getHttpContext()); if (context == null) { return;// Obviously context is already removed } final ErrorPageErrorHandler errorPageHandler = (ErrorPageErrorHandler) context .getErrorHandler(); if (errorPageHandler == null) { throw new IllegalStateException( "Internal error: Cannot find the error handler. Please report."); } final Map<String, String> errorPages = errorPageHandler.getErrorPages(); if (errorPages != null) { errorPages.remove(model.getError()); } removeContext(model.getContextModel().getHttpContext()); }
/** * @param contextPath The context path * @param webApp The URL or filename of the webapp directory or war file. */ public WebAppContext(String webApp,String contextPath) { super(null,contextPath,SESSIONS|SECURITY); _scontext=new Context(); setContextPath(contextPath); setWar(webApp); setErrorHandler(new ErrorPageErrorHandler()); setProtectedTargets(__dftProtectedTargets); }
@Override public void deconfigure (WebAppContext context) throws Exception { ServletHandler _servletHandler = context.getServletHandler(); context.setWelcomeFiles(null); if (context.getErrorHandler() instanceof ErrorPageErrorHandler) ((ErrorPageErrorHandler) context.getErrorHandler()).setErrorPages(null); // TODO remove classpaths from classloader } }
public WebAppContext() { super(SESSIONS|SECURITY); _scontext=new Context(); setErrorHandler(new ErrorPageErrorHandler()); setProtectedTargets(__dftProtectedTargets); }
mServletContextHandler.setResourceBase(resourceDir.getAbsolutePath()); mServletContextHandler.addServlet(DefaultServlet.class, "/"); ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler(); errorHandler.addErrorPage(404, "/"); mServletContextHandler.setErrorHandler(errorHandler); } catch (MalformedURLException e) {
public WebAppContext() { this(null,null,null,null,null,new ErrorPageErrorHandler(),SESSIONS|SECURITY); }
/** * @param parent The parent HandlerContainer. * @param contextPath The context path * @param webApp The webapp directory or war file. */ public WebAppContext(HandlerContainer parent, Resource webApp, String contextPath) { this(parent,contextPath,null,null,null,new ErrorPageErrorHandler(),SESSIONS|SECURITY); setWarResource(webApp); }