org.apache.catalina.Wrapper.getServletClass()方法的使用及代码示例

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

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

Wrapper.getServletClass介绍

[英]Return the fully qualified servlet class name for this servlet.
[中]返回此servlet的完全限定servlet类名。

代码示例

代码示例来源:origin: psi-probe/psi-probe

/**
 * Gets the application servlet maps.
 *
 * @param context the context
 * @return the application servlet maps
 */
public static List<ServletMapping> getApplicationServletMaps(Context context) {
 String[] sms = context.findServletMappings();
 List<ServletMapping> servletMaps = new ArrayList<>(sms.length);
 for (String servletMapping : sms) {
  if (servletMapping != null) {
   String sn = context.findServletMapping(servletMapping);
   if (sn != null) {
    ServletMapping sm = new ServletMapping();
    sm.setApplicationName(context.getName().length() > 0 ? context.getName() : "/");
    sm.setUrl(servletMapping);
    sm.setServletName(sn);
    Container container = context.findChild(sn);
    if (container instanceof Wrapper) {
     Wrapper wrapper = (Wrapper) container;
     sm.setServletClass(wrapper.getServletClass());
     sm.setAvailable(!wrapper.isUnavailable());
    }
    servletMaps.add(sm);
   }
  }
 }
 return servletMaps;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

@Override
public String getClassName() {
  return wrapper.getServletClass();
}

代码示例来源:origin: psi-probe/psi-probe

si.setApplicationName(contextName.length() > 0 ? contextName : "/");
si.setServletName(wrapper.getName());
si.setServletClass(wrapper.getServletClass());
si.setAvailable(!wrapper.isUnavailable());
si.setLoadOnStartup(wrapper.getLoadOnStartup());

代码示例来源:origin: org.apache.tomee/tomee-jaxrs

if (accept == null) {
  accept = false;
  if (!"org.apache.catalina.servlets.DefaultServlet".equals(wrapper.getServletClass())) {
    for (final String mapping : wrapper.findMappings()) {
      if (!mapping.isEmpty() && !"/*".equals(mapping) && !"/".equals(mapping) && !mapping.startsWith("*")

代码示例来源:origin: org.apache.tomee/tomee-catalina

private void ensureMyFacesDontLooseFacesContext(final StandardContext standardContext) {
  for (final Container w : standardContext.findChildren()) {
    if (!Wrapper.class.isInstance(w)) {
      continue;
    }
    final Wrapper wrapper = Wrapper.class.cast(w);
    if ("FacesServlet".equals(wrapper.getName()) && "javax.faces.webapp.FacesServlet".equals(wrapper.getServletClass())) {
      final ClassLoader loader = standardContext.getLoader().getClassLoader();
      try {
        if (Files.toFile(loader.getResource("javax/faces/webapp/FacesServlet.class")).getName().startsWith("myfaces")) {
          loader.loadClass("org.apache.tomee.myfaces.TomEEWorkaroundFacesServlet");
          wrapper.setServletClass("org.apache.tomee.myfaces.TomEEWorkaroundFacesServlet");
          break;
        }
      } catch (final Throwable t) {
        // not there, not a big deal in most of cases
      }
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-tomcat-jboss4

@Override
public void addChild(Container container) {
  if(container instanceof Wrapper) {
    // Added for Issue http://code.google.com/p/mobicents/issues/detail?id=2382
    Wrapper wrapper = (Wrapper) container;
    SipServletImpl sipServletImpl = (SipServletImpl) childrenMap.get(container.getName());
    if(sipServletImpl != null && !sipServletImpl.getServletClass().equals(wrapper.getServletClass())) {
      throw new SipDeploymentException("Trying to add a servlet with name " + container.getName() + " and servlet class " + wrapper.getServletClass() + 
          " while there is already a SIP Servlet with the same name and a different servlet class " + sipServletImpl.getServletClass());
    }
  }
  if(children.get(container.getName()) == null) {
    super.addChild(container);
  } else {
    if(logger.isDebugEnabled()) {
      logger.debug(container.getName() + " already present as a Sip Servlet not adding it again");
    }
  }
}

代码示例来源:origin: org.mobicents.servlet.sip.containers/sip-servlets-as7

@Override
public void addChild(Container container) {
  if(container instanceof Wrapper) {
    // Added for Issue http://code.google.com/p/mobicents/issues/detail?id=2382
    Wrapper wrapper = (Wrapper) container;
    SipServletImpl sipServletImpl = (SipServletImpl) childrenMap.get(container.getName());
    if(sipServletImpl != null && !sipServletImpl.getServletClass().equals(wrapper.getServletClass())) {
      throw new SipDeploymentException("Trying to add a servlet with name " + container.getName() + " and servlet class " + wrapper.getServletClass() + 
          " while there is already a SIP Servlet with the same name and a different servlet class " + sipServletImpl.getServletClass());
    }
  }
  if(children.get(container.getName()) == null) {
    super.addChild(container);
  } else {
    if(logger.isDebugEnabled()) {
      logger.debug(container.getName() + " already present as a Sip Servlet not adding it again");
    }
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public Dynamic addJspFile(String jspName, String jspFile) {
  // jspName is validated in addServlet()
  if (jspFile == null || !jspFile.startsWith("/")) {
    throw new IllegalArgumentException(
        sm.getString("applicationContext.addJspFile.iae", jspFile));
  }
  String jspServletClassName = null;
  Map<String,String> jspFileInitParams = new HashMap<>();
  Wrapper jspServlet = (Wrapper) context.findChild("jsp");
  if (jspServlet == null) {
    // No JSP servlet currently defined.
    // Use default JSP Servlet class name
    jspServletClassName = Constants.JSP_SERVLET_CLASS;
  } else {
    // JSP Servlet defined.
    // Use same JSP Servlet class name
    jspServletClassName = jspServlet.getServletClass();
    // Use same init parameters
    String[] params = jspServlet.findInitParameters();
    for (String param : params) {
      jspFileInitParams.put(param, jspServlet.findInitParameter(param));
    }
  }
  // Add init parameter to specify JSP file
  jspFileInitParams.put("jspFile", jspFile);
  return addServlet(jspName, jspServletClassName, null, jspFileInitParams);
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public Dynamic addJspFile(String jspName, String jspFile) {
  // jspName is validated in addServlet()
  if (jspFile == null || !jspFile.startsWith("/")) {
    throw new IllegalArgumentException(
        sm.getString("applicationContext.addJspFile.iae", jspFile));
  }
  String jspServletClassName = null;
  Map<String,String> jspFileInitParams = new HashMap<>();
  Wrapper jspServlet = (Wrapper) context.findChild("jsp");
  if (jspServlet == null) {
    // No JSP servlet currently defined.
    // Use default JSP Servlet class name
    jspServletClassName = Constants.JSP_SERVLET_CLASS;
  } else {
    // JSP Servlet defined.
    // Use same JSP Servlet class name
    jspServletClassName = jspServlet.getServletClass();
    // Use same init parameters
    String[] params = jspServlet.findInitParameters();
    for (String param : params) {
      jspFileInitParams.put(param, jspServlet.findInitParameter(param));
    }
  }
  // Add init parameter to specify JSP file
  jspFileInitParams.put("jspFile", jspFile);
  return addServlet(jspName, jspServletClassName, null, jspFileInitParams);
}

代码示例来源:origin: org.apache.tomee/tomee-myfaces

private boolean isFacesServletPresent(final ServletContext ctx) {
  if (ctx instanceof ApplicationContextFacade) {
    try {
      final ApplicationContext appCtx = (ApplicationContext) get(ApplicationContextFacade.class, ctx);
      final Context tomcatCtx = (Context) get(ApplicationContext.class, appCtx);
      if (tomcatCtx instanceof StandardContext) {
        final Container[] servlets = tomcatCtx.findChildren();
        if (servlets != null) {
          for (final Container s : servlets) {
            if (s instanceof Wrapper) {
              if ("javax.faces.webapp.FacesServlet".equals(((Wrapper) s).getServletClass())
                  || "Faces Servlet".equals(s.getName())) {
                return true;
              }
            }
          }
        }
      }
    } catch (final Exception e) {
      // no-op
    }
  }
  return false;
}

代码示例来源:origin: codefollower/Tomcat-Research

if (wrapper.getServletClass() == null) {
  continue;
    wrapper.getServletClass());
if (classClass == null) {
  continue;

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

private Set<String> getNonAsyncClassNames() {
  Set<String> result = new HashSet<>();
  Wrapper wrapper = getWrapper();
  if (!wrapper.isAsyncSupported()) {
    result.add(wrapper.getServletClass());
  }
  FilterChain filterChain = getFilterChain();
  if (filterChain instanceof ApplicationFilterChain) {
    ((ApplicationFilterChain) filterChain).findNonAsyncFilters(result);
  } else {
    result.add(sm.getString("coyoteRequest.filterAsyncSupportUnknown"));
  }
  Container c = wrapper;
  while (c != null) {
    c.getPipeline().findNonAsyncValves(result);
    c = c.getParent();
  }
  return result;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private Set<String> getNonAsyncClassNames() {
  Set<String> result = new HashSet<>();
  Wrapper wrapper = getWrapper();
  if (!wrapper.isAsyncSupported()) {
    result.add(wrapper.getServletClass());
  }
  FilterChain filterChain = getFilterChain();
  if (filterChain instanceof ApplicationFilterChain) {
    ((ApplicationFilterChain) filterChain).findNonAsyncFilters(result);
  } else {
    result.add(sm.getString("coyoteRequest.filterAsyncSupportUnknown"));
  }
  Container c = wrapper;
  while (c != null) {
    c.getPipeline().findNonAsyncValves(result);
    c = c.getParent();
  }
  return result;
}

相关文章