org.apache.coyote.Request.getCharset()方法的使用及代码示例

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

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

Request.getCharset介绍

[英]Get the character encoding used for this request.
[中]获取用于此请求的字符编码。

代码示例

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

public void checkConverter() throws IOException {
  if (conv != null) {
    return;
  }
  Charset charset = null;
  if (coyoteRequest != null) {
    charset = coyoteRequest.getCharset();
  }
  if (charset == null) {
    charset = org.apache.coyote.Constants.DEFAULT_BODY_CHARSET;
  }
  SynchronizedStack<B2CConverter> stack = encoders.get(charset);
  if (stack == null) {
    stack = new SynchronizedStack<>();
    encoders.putIfAbsent(charset, stack);
    stack = encoders.get(charset);
  }
  conv = stack.pop();
  if (conv == null) {
    conv = createConverter(charset);
  }
}

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

public void checkConverter() throws IOException {
  if (conv != null) {
    return;
  }
  Charset charset = null;
  if (coyoteRequest != null) {
    charset = coyoteRequest.getCharset();
  }
  if (charset == null) {
    charset = org.apache.coyote.Constants.DEFAULT_BODY_CHARSET;
  }
  SynchronizedStack<B2CConverter> stack = encoders.get(charset);
  if (stack == null) {
    stack = new SynchronizedStack<>();
    encoders.putIfAbsent(charset, stack);
    stack = encoders.get(charset);
  }
  conv = stack.pop();
  if (conv == null) {
    conv = createConverter(charset);
  }
}

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

requestCharset = ((Request)req).getCoyoteRequest().getCharset();
} catch (UnsupportedEncodingException e) {

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

requestCharset = ((Request)req).getCoyoteRequest().getCharset();
} catch (UnsupportedEncodingException e) {

代码示例来源: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;
}

相关文章

Request类方法