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

x33g5p2x  于2022-01-18 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(99)

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

Context.getRequestCharacterEncoding介绍

[英]Get the default request body encoding for this web application.
[中]获取此web应用程序的默认请求正文编码。

代码示例

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

/**
 * @return the character encoding for this Request.
 */
@Override
public String getCharacterEncoding() {
  String characterEncoding = coyoteRequest.getCharacterEncoding();
  if (characterEncoding != null) {
    return characterEncoding;
  }
  Context context = getContext();
  if (context != null) {
    return context.getRequestCharacterEncoding();
  }
  return null;
}

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

/**
 * @return the character encoding for this Request.
 */
@Override
public String getCharacterEncoding() {
  String characterEncoding = coyoteRequest.getCharacterEncoding();
  if (characterEncoding != null) {
    return characterEncoding;
  }
  Context context = getContext();
  if (context != null) {
    return context.getRequestCharacterEncoding();
  }
  return null;
}

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

private Charset getCharset() {
  Charset charset = null;
  try {
    charset = coyoteRequest.getCharset();
  } catch (UnsupportedEncodingException e) {
    // Ignore
  }
  if (charset != null) {
    return charset;
  }
  Context context = getContext();
  if (context != null) {
    String encoding = context.getRequestCharacterEncoding();
    if (encoding != null) {
      try {
        return B2CConverter.getCharset(encoding);
      } catch (UnsupportedEncodingException e) {
        // Ignore
      }
    }
  }
  return org.apache.coyote.Constants.DEFAULT_BODY_CHARSET;
}

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

private Charset getCharset() {
  Charset charset = null;
  try {
    charset = coyoteRequest.getCharset();
  } catch (UnsupportedEncodingException e) {
    // Ignore
  }
  if (charset != null) {
    return charset;
  }
  Context context = getContext();
  if (context != null) {
    String encoding = context.getRequestCharacterEncoding();
    if (encoding != null) {
      try {
        return B2CConverter.getCharset(encoding);
      } catch (UnsupportedEncodingException e) {
        // Ignore
      }
    }
  }
  return org.apache.coyote.Constants.DEFAULT_BODY_CHARSET;
}

相关文章

微信公众号

最新文章

更多

Context类方法