org.eclipse.jetty.webapp.WebAppContext.getMetaData()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.eclipse.jetty.webapp.WebAppContext.getMetaData()方法的一些代码示例,展示了WebAppContext.getMetaData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebAppContext.getMetaData()方法的具体详情如下:
包路径:org.eclipse.jetty.webapp.WebAppContext
类名称:WebAppContext
方法名:getMetaData

WebAppContext.getMetaData介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

@Override
public void preConfigure(WebAppContext context) throws Exception
{
  //add all discovered web-fragment.xmls
  addWebFragments(context, context.getMetaData());
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

/** 
   * @see org.eclipse.jetty.util.PatternMatcher#matched(java.net.URI)
   */
  @Override
  public void matched(URI uri) throws Exception
  {
    _context.getMetaData().addContainerResource(Resource.newResource(uri));
  }
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

/** 
 * @see org.eclipse.jetty.util.PatternMatcher#matched(java.net.URI)
 */
@Override
public void matched(URI uri) throws Exception
{
  _context.getMetaData().addWebInfJar(Resource.newResource(uri));
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

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);
  }
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

p = ServletPathSpec.normalize(p);
paths.add(p);
context.getMetaData().setOrigin(filterName+".filter.mapping."+p, descriptor);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

/**
 * 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());
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

switch (context.getMetaData().getOrigin("locale-encoding."+locale))
    context.getMetaData().setOrigin("locale-encoding."+locale, descriptor);
    break;
      context.getMetaData().setOrigin("locale-encoding."+locale, descriptor);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

switch (context.getMetaData().getOrigin("context-param."+name))
    context.getMetaData().setOrigin("context-param."+name, descriptor);
    break;
      context.getMetaData().setOrigin("context-param."+name, descriptor);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

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);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

switch (context.getMetaData().getOrigin(filter_name+".filter.mappings"))
    context.getMetaData().setOrigin(filter_name+".filter.mappings", descriptor);
    addFilterMapping(filter_name, node, context, descriptor);
    break;

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

switch (context.getMetaData().getOrigin(servlet_name+".servlet.mappings"))
    context.getMetaData().setOrigin(servlet_name+".servlet.mappings", descriptor);
    addServletMapping(servlet_name, node, context, descriptor);               
    break;

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

if (extension != null)
  switch (context.getMetaData().getOrigin("extension."+extension))
      context.getMetaData().setOrigin("extension."+extension, descriptor);
      break;
        context.getMetaData().setOrigin("extension."+extension, descriptor);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

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);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

@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);
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

@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));
}

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

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;

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

context.getMetaData().setOrigin(servletName+".servlet.mapping."+p, descriptor);

代码示例来源:origin: apache/shiro

ctx.getMetaData().addContainerResource(containerResources);

代码示例来源:origin: org.eclipse.jetty/jetty-webapp

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: org.eclipse.jetty/jetty-webapp

Origin origin = getMetaData().getOrigin("constraint.url."+pathSpec);
      ((ConstraintAware)getSecurityHandler()).addConstraintMapping(m);
    ((ConstraintAware)getSecurityHandler()).checkPathsWithUncoveredHttpMethods();
    getMetaData().setOriginAPI("constraint.url."+pathSpec);
    break;

相关文章

WebAppContext类方法