@Override public void preConfigure(WebAppContext context) throws Exception { //add all discovered web-fragment.xmls addWebFragments(context, context.getMetaData()); }
/** * @see org.eclipse.jetty.util.PatternMatcher#matched(java.net.URI) */ @Override public void matched(URI uri) throws Exception { _context.getMetaData().addContainerResource(Resource.newResource(uri)); } }
/** * @see org.eclipse.jetty.util.PatternMatcher#matched(java.net.URI) */ @Override public void matched(URI uri) throws Exception { _context.getMetaData().addWebInfJar(Resource.newResource(uri)); }
public void visitDisplayName(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0 p. 74 Ignore from web-fragments if (!(descriptor instanceof FragmentDescriptor)) { context.setDisplayName(node.toString(false, true)); context.getMetaData().setOrigin("display-name", descriptor); } }
p = ServletPathSpec.normalize(p); paths.add(p); context.getMetaData().setOrigin(filterName+".filter.mapping."+p, descriptor);
/** * Process web-default.xml, web.xml, override-web.xml * */ @Override public void configure (WebAppContext context) throws Exception { // cannot configure if the context is already started if (context.isStarted()) { LOG.debug("Cannot configure webapp after it is started"); return; } context.getMetaData().addDescriptorProcessor(new StandardDescriptorProcessor()); }
switch (context.getMetaData().getOrigin("locale-encoding."+locale)) context.getMetaData().setOrigin("locale-encoding."+locale, descriptor); break; context.getMetaData().setOrigin("locale-encoding."+locale, descriptor);
switch (context.getMetaData().getOrigin("context-param."+name)) context.getMetaData().setOrigin("context-param."+name, descriptor); break; context.getMetaData().setOrigin("context-param."+name, descriptor);
ErrorPageErrorHandler handler = (ErrorPageErrorHandler)context.getErrorHandler(); String originName = "error."+error; switch (context.getMetaData().getOrigin(originName)) else handler.addErrorPage(error,location); context.getMetaData().setOrigin("error."+error, descriptor); break; Descriptor originDescriptor = context.getMetaData().getOriginDescriptor(originName); if (descriptor == originDescriptor) throw new IllegalStateException("Duplicate error-page "+error+" at "+location); else handler.addErrorPage(error,location); context.getMetaData().setOrigin("error."+error, descriptor);
switch (context.getMetaData().getOrigin(filter_name+".filter.mappings")) context.getMetaData().setOrigin(filter_name+".filter.mappings", descriptor); addFilterMapping(filter_name, node, context, descriptor); break;
switch (context.getMetaData().getOrigin(servlet_name+".servlet.mappings")) context.getMetaData().setOrigin(servlet_name+".servlet.mappings", descriptor); addServletMapping(servlet_name, node, context, descriptor); break;
if (extension != null) switch (context.getMetaData().getOrigin("extension."+extension)) context.getMetaData().setOrigin("extension."+extension, descriptor); break; context.getMetaData().setOrigin("extension."+extension, descriptor);
if (dftResource == null) dftResource = context.newResource(defaultsDescriptor); context.getMetaData().setDefaults (dftResource); if (webxml != null) context.getMetaData().setWebXml(webxml); context.getServletContext().setEffectiveMajorVersion(context.getMetaData().getWebXml().getMajorVersion()); context.getServletContext().setEffectiveMinorVersion(context.getMetaData().getWebXml().getMinorVersion()); if (orideResource == null) orideResource = context.newResource(overrideDescriptor); context.getMetaData().addOverride(orideResource);
@Override public void preConfigure(final WebAppContext context) throws Exception { boolean useContainerCache = DEFAULT_USE_CONTAINER_METAINF_CACHE; if (context.getServer() != null) { Boolean attr = (Boolean)context.getServer().getAttribute(USE_CONTAINER_METAINF_CACHE); if (attr != null) useContainerCache = attr.booleanValue(); } if (LOG.isDebugEnabled()) LOG.debug("{} = {}", USE_CONTAINER_METAINF_CACHE, useContainerCache); //pre-emptively create empty lists for tlds, fragments and resources as context attributes //this signals that this class has been called. This differentiates the case where this class //has been called but finds no META-INF data from the case where this class was never called if (context.getAttribute(METAINF_TLDS) == null) context.setAttribute(METAINF_TLDS, new HashSet<URL>()); if (context.getAttribute(METAINF_RESOURCES) == null) context.setAttribute(METAINF_RESOURCES, new HashSet<Resource>()); if (context.getAttribute(METAINF_FRAGMENTS) == null) context.setAttribute(METAINF_FRAGMENTS, new HashMap<Resource, Resource>()); //always scan everything from the container's classpath scanJars(context, context.getMetaData().getContainerResources(), useContainerCache, __allScanTypes); //only look for fragments if web.xml is not metadata complete, or it version 3.0 or greater List<String> scanTypes = new ArrayList<>(__allScanTypes); if (context.getMetaData().isMetaDataComplete() || (context.getServletContext().getEffectiveMajorVersion() < 3) && !context.isConfigurationDiscovered()) scanTypes.remove(METAINF_FRAGMENTS); scanJars(context, context.getMetaData().getWebInfJars(), false, scanTypes); }
@Override public void preConfigure(final WebAppContext context) throws Exception { //Make a temp directory for the webapp if one is not already set resolveTempDirectory(context); //Extract webapp if necessary unpack (context); findAndFilterContainerPaths(context); findAndFilterWebAppPaths(context); //No pattern to appy to classes, just add to metadata context.getMetaData().setWebInfClassesDirs(findClassDirs(context)); }
public void visitWelcomeFileList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) switch (context.getMetaData().getOrigin("welcome-file-list")) context.getMetaData().setOrigin("welcome-file-list", descriptor); addWelcomeFiles(context,node); break;
context.getMetaData().setOrigin(servletName+".servlet.mapping."+p, descriptor);
ctx.getMetaData().addContainerResource(containerResources);
public void visitListener(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String className = node.getString("listener-class", false, true); EventListener listener = null; try { if (className != null && className.length()> 0) { //Servlet Spec 3.0 p 74 //Duplicate listener declarations don't result in duplicate listener instances for (ListenerHolder holder : context.getServletHandler().getListeners()) { if (holder.getClassName().equals(className)) return; } ((WebDescriptor)descriptor).addClassName(className); ListenerHolder h = context.getServletHandler().newListenerHolder(new Source (Source.Origin.DESCRIPTOR, descriptor.getResource().toString())); h.setClassName(className); context.getServletHandler().addListener(h); context.getMetaData().setOrigin(className+".listener", descriptor); } } catch (Exception e) { LOG.warn("Could not instantiate listener " + className, e); return; } }
Origin origin = getMetaData().getOrigin("constraint.url."+pathSpec); ((ConstraintAware)getSecurityHandler()).addConstraintMapping(m); ((ConstraintAware)getSecurityHandler()).checkPathsWithUncoveredHttpMethods(); getMetaData().setOriginAPI("constraint.url."+pathSpec); break;