javax.servlet.ServletContext.getMinorVersion()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(92)

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

ServletContext.getMinorVersion介绍

[英]Returns the minor version of the Servlet API that this servlet container supports. All implementations that comply with Version 4.0 must have this method return the integer 0.
[中]返回此Servlet容器支持的Servlet API的次要版本。所有符合版本4.0的实现都必须使用此方法返回整数0。

代码示例

代码示例来源:origin: igniterealtime/Openfire

@Override
public int getMinorVersion()
{
  return proxy.getMinorVersion();
}

代码示例来源:origin: alibaba/druid

public static String getContextPath(ServletContext context) {
  if (context.getMajorVersion() == 2 && context.getMinorVersion() < 5) {
    return null;
  }
  try {
    return getContextPath_2_5(context);
  } catch (NoSuchMethodError error) {
    return null;
  }
}

代码示例来源:origin: javamelody/javamelody

if (context.getMajorVersion() == 2 && context.getMinorVersion() >= 5
    || context.getMajorVersion() > 2) {

代码示例来源:origin: nutzam/nutz

log.debugf(" - Servlet API     : %d.%d",
      config.getServletContext().getMajorVersion(),
      config.getServletContext().getMinorVersion());
if (config.getServletContext().getMajorVersion() > 2
  || config.getServletContext().getMinorVersion() > 4)
  log.debugf(" - ContextPath     : %s", config.getServletContext().getContextPath());
log.debugf(" - context.tempdir : %s", config.getAttribute("javax.servlet.context.tempdir"));

代码示例来源:origin: webx/citrus

/** 取得servlet API版本。 */
  public static String getServletApiVersion(ServletContext servletContext) {
    return servletContext.getMajorVersion() + "." + servletContext.getMinorVersion();
  }
}

代码示例来源:origin: webx/citrus

/** 取得servlet API版本。 */
  public static String getServletApiVersion(ServletContext servletContext) {
    return servletContext.getMajorVersion() + "." + servletContext.getMinorVersion();
  }
}

代码示例来源:origin: com.alibaba/druid

public static String getContextPath(ServletContext context) {
  if (context.getMajorVersion() == 2 && context.getMinorVersion() < 5) {
    return null;
  }
  try {
    return getContextPath_2_5(context);
  } catch (NoSuchMethodError error) {
    return null;
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-web

return String.valueOf(ctx.getMinorVersion());

代码示例来源:origin: jamesagnew/hapi-fhir

/**
 * Determines the servlet's context path.
 * 
 * This is here to try and deal with the wide variation in servers and what they return.
 * 
 * getServletContext().getContextPath() is supposed to return the path to the specific servlet we are deployed as but it's not available everywhere. On some servers getServletContext() can return
 * null (old Jetty seems to suffer from this, see hapi-fhir-base-test-mindeps-server) and on other old servers (Servlet 2.4) getServletContext().getContextPath() doesn't even exist.
 * 
 * theRequest.getContextPath() returns the context for the specific incoming request. It should be available everywhere, but it's likely to be less predicable if there are multiple servlet mappings
 * pointing to the same servlet, so we don't favour it. This is possibly not the best strategy (maybe we should just always use theRequest.getContextPath()?) but so far people seem happy with this
 * behavour across a wide variety of platforms.
 * 
 * If you are having troubles on a given platform/configuration and want to suggest a change or even report incompatibility here, we'd love to hear about it.
 */
public static String determineServletContextPath(HttpServletRequest theRequest, RestfulServer server) {
  String retVal;
  if (server.getServletContext() != null) {
    if (server.getServletContext().getMajorVersion() >= 3 || (server.getServletContext().getMajorVersion() > 2 && server.getServletContext().getMinorVersion() >= 5)) {
      retVal = server.getServletContext().getContextPath();
    } else {
      retVal = theRequest.getContextPath();
    }
  } else {
    retVal = theRequest.getContextPath();
  }
  retVal = StringUtils.defaultString(retVal);
  return retVal;
}

代码示例来源:origin: OpenNMS/opennms

@Override
public int getMinorVersion()
{
  return this.context.getMinorVersion();
}

代码示例来源:origin: org.apache.felix/org.apache.felix.http.base

@Override
public int getMinorVersion()
{
  return this.context.getMinorVersion();
}

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

@Override
public int getMinorVersion()
{
  return this.context.getMinorVersion();
}

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

app.setSessionTimeout(context.getSessionTimeout());
app.setServletVersion(context.getServletContext().getMajorVersion() + "."
  + context.getServletContext().getMinorVersion());

代码示例来源:origin: com.alibaba.citrus/citrus-webx-all

/** 取得servlet API版本。 */
  public static String getServletApiVersion(ServletContext servletContext) {
    return servletContext.getMajorVersion() + "." + servletContext.getMinorVersion();
  }
}

代码示例来源:origin: net.ontopia/ontopia-webed

/**
 * INTERNAL: Returns true if the session has support for time-based
 * lock expiry. For internal and testing purposes only.
 */
public static boolean usesTimedLockExpiry(HttpSession session) {
 // Lock expiration is only carried out in containers
 // that do not support servlets 2.3, i.e. J2EE 1.2
 return session.getServletContext().getMajorVersion() <= 2
   && session.getServletContext().getMinorVersion() < 3;
}

代码示例来源:origin: com.atlassian.jira/jira-core

private Map<String, String> getServerInfo()
{
  return ImmutableMap.of(
      "system.error.application.server", servletContext.getServerInfo(),
      "system.error.servlet.version", servletContext.getMajorVersion() + "." + servletContext.getMinorVersion());
}

代码示例来源:origin: com.sun.faces/jsf-impl

private static String getServletContextIdentifier(ServletContext context) {
  if (context.getMajorVersion() == 2 && context.getMinorVersion() < 5) {
    return context.getServletContextName();
  } else {
    return context.getContextPath();
  }
}

代码示例来源:origin: javax.faces/jsf-impl

/**
 * @return the name of this application
 */
public String getServletContextName() {
  if (servletContext.getMajorVersion() == 2
    && servletContext.getMinorVersion() <= 4) {
    return servletContext.getServletContextName();
  } else {
    return servletContext.getContextPath();
  }
}

代码示例来源:origin: com.sun.faces/jsf-impl

/**
 * @return the name of this application
 */
public String getServletContextName() {
  if (servletContext.getMajorVersion() == 2
    && servletContext.getMinorVersion() <= 4) {
    return servletContext.getServletContextName();
  } else {
    return servletContext.getContextPath();
  }
}

代码示例来源:origin: com.sun.faces/jsf-impl

private static String getServletContextIdentifier(ServletContext context) {
  if (context.getMajorVersion() == 2 && context.getMinorVersion() < 5) {
    return context.getServletContextName();
  } else {
    return context.getContextPath();
  }
}

相关文章

微信公众号

最新文章

更多

ServletContext类方法