@Override public ServletContext getContext(String uripath) { ServletContext servletContext = super.getContext(uripath); if ( servletContext != null && _contextWhiteList != null ) { for ( String context : _contextWhiteList ) { if ( context.equals(uripath) ) { return servletContext; } } return null; } else { return servletContext; } } }
@Override public void checkListener(Class<? extends EventListener> listener) throws IllegalStateException { try { super.checkListener(listener); } catch (IllegalArgumentException e) { //not one of the standard servlet listeners, check our extended session listener types boolean ok = false; for (Class<?> l:SessionHandler.SESSION_LISTENER_TYPES) { if (l.isAssignableFrom(listener)) { ok = true; break; } } if (!ok) throw new IllegalArgumentException("Inappropriate listener type "+listener.getName()); } }
?((ServletContextHandler.Context)context).createFilter(getHeldClass()) :getHeldClass().newInstance();
ServletContext context = request.getServletContext(); ServletContextHandler.Context jettyCtx = (ServletContextHandler.Context) context; ConstraintSecurityHandler securityHandler = (ConstraintSecurityHandler) jettyCtx.getContextHandler().getChildHandlerByClass(ConstraintSecurityHandler.class); if (securityHandler == null) return null;
?((ServletContextHandler.Context)context).createFilter(getHeldClass()) :getHeldClass().newInstance();
return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass()); return getHeldClass().getDeclaredConstructor().newInstance();
_filter=((ServletContextHandler.Context)_servletHandler.getServletContext()).createFilter(getHeldClass());
?((ServletContextHandler.Context)context).createFilter(getHeldClass()) :getHeldClass().getDeclaredConstructor().newInstance();
@Override public final Resource getResource(String pathInContext) { ServletContextHandler.Context context = (ServletContextHandler.Context) getServletContext(); ServletContextHandler contextHandler = (ServletContextHandler) context.getContextHandler();
_filter=((ServletContextHandler.Context)_servletHandler.getServletContext()).createFilter(getHeldClass());
_filter=((ServletContextHandler.Context)_servletHandler.getServletContext()).createFilter(getHeldClass());
@Override public void initialize() throws Exception { super.initialize(); if (_filter==null) { try { ServletContext context=_servletHandler.getServletContext(); _filter=(context instanceof ServletContextHandler.Context) ?((ServletContextHandler.Context)context).createFilter(getHeldClass()) :getHeldClass().newInstance(); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } } _config=new Config(); if (LOG.isDebugEnabled()) LOG.debug("Filter.init {}",_filter); _filter.init(_config); }
@Override public void initialize() throws Exception { super.initialize(); if (_filter==null) { try { ServletContext context=_servletHandler.getServletContext(); _filter=(context instanceof ServletContextHandler.Context) ?((ServletContextHandler.Context)context).createFilter(getHeldClass()) :getHeldClass().newInstance(); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } } _config=new Config(); if (LOG.isDebugEnabled()) LOG.debug("Filter.init {}",_filter); _filter.init(_config); }
/** * @return the newly created Servlet instance * @throws ServletException * @throws IllegalAccessException * @throws InstantiationException */ protected Servlet newInstance() throws ServletException, IllegalAccessException, InstantiationException { try { ServletContext ctx = getServletHandler().getServletContext(); if (ctx==null) return getHeldClass().newInstance(); return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass()); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } } }
/** * @return the newly created Servlet instance * @throws ServletException * @throws IllegalAccessException * @throws InstantiationException */ protected Servlet newInstance() throws ServletException, IllegalAccessException, InstantiationException { try { ServletContext ctx = getServletHandler().getServletContext(); if (ctx instanceof ServletContextHandler.Context) return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass()); return getHeldClass().newInstance(); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } }
/** * @return the newly created Servlet instance * @throws ServletException * @throws IllegalAccessException * @throws InstantiationException */ protected Servlet newInstance() throws ServletException, IllegalAccessException, InstantiationException { try { ServletContext ctx = getServletHandler().getServletContext(); if (ctx==null) return getHeldClass().newInstance(); return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass()); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } } }
@Override public void checkListener(Class<? extends EventListener> listener) throws IllegalStateException { try { super.checkListener(listener); } catch (IllegalArgumentException e) { //not one of the standard servlet listeners, check our extended session listener types boolean ok = false; for (Class<?> l:SessionHandler.SESSION_LISTENER_TYPES) { if (l.isAssignableFrom(listener)) { ok = true; break; } } if (!ok) throw new IllegalArgumentException("Inappropriate listener type "+listener.getName()); } }
/** * @return the newly created Servlet instance * @throws ServletException * @throws IllegalAccessException * @throws InstantiationException */ protected Servlet newInstance() throws ServletException, IllegalAccessException, InstantiationException { try { ServletContext ctx = getServletHandler().getServletContext(); if (ctx==null) return getHeldClass().newInstance(); return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass()); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } } }
/** * @return the newly created Servlet instance * @throws ServletException if unable to create a new instance * @throws IllegalAccessException if not allowed to create a new instance * @throws InstantiationException if creating new instance resulted in error */ protected Servlet newInstance() throws ServletException, IllegalAccessException, InstantiationException { try { ServletContext ctx = getServletHandler().getServletContext(); if (ctx instanceof ServletContextHandler.Context) return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass()); return getHeldClass().newInstance(); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } }
/** * @return the newly created Servlet instance * @throws ServletException * @throws IllegalAccessException * @throws InstantiationException */ protected Servlet newInstance() throws ServletException, IllegalAccessException, InstantiationException { try { ServletContext ctx = getServletHandler().getServletContext(); if (ctx instanceof ServletContextHandler.Context) return ((ServletContextHandler.Context)ctx).createServlet(getHeldClass()); return getHeldClass().newInstance(); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof InstantiationException) throw (InstantiationException)cause; if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; throw se; } }