Tabnine Logo
HttpHeaderHelper.findCharset
Code IndexAdd Tabnine to your IDE (free)

How to use
findCharset
method
in
org.apache.cxf.helpers.HttpHeaderHelper

Best Java code snippets using org.apache.cxf.helpers.HttpHeaderHelper.findCharset (Showing top 13 results out of 315)

origin: org.apache.cxf/cxf-rt-transports-http

private String setEncoding(final Message inMessage,
              final HttpServletRequest req,
              final String contentType) throws IOException {
  String enc = HttpHeaderHelper.findCharset(contentType);
  if (enc == null) {
    enc = req.getCharacterEncoding();
  }
  // work around a bug with Jetty which results in the character
  // encoding not being trimmed correctly.
  if (enc != null && enc.endsWith("\"")) {
    enc = enc.substring(0, enc.length() - 1);
  }
  if (enc != null || "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod())) {
    //allow gets/deletes/options to not specify an encoding
    String normalizedEncoding = HttpHeaderHelper.mapCharset(enc);
    if (normalizedEncoding == null) {
      String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG",
                               LOG, enc).toString();
      LOG.log(Level.WARNING, m);
      throw new IOException(m);
    }
    inMessage.put(Message.ENCODING, normalizedEncoding);
  }
  return contentType;
}
protected Message retrieveFromContinuation(HttpServletRequest req) {
origin: org.apache.cxf/cxf-rt-transports-http

String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE));
String normalizedEncoding = HttpHeaderHelper.mapCharset(charset);
if (normalizedEncoding == null) {
origin: apache/cxf

static String getEncoding(String ct) throws UnsupportedEncodingException {
  String enc = HttpHeaderHelper.findCharset(ct);
  String normalizedEncoding = HttpHeaderHelper.mapCharset(enc, StandardCharsets.UTF_8.name());
  if (normalizedEncoding == null) {
    String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, new Object[] {
      enc
    }).toString();
    LOG.log(Level.WARNING, m);
    throw new UnsupportedEncodingException(m);
  }
  return normalizedEncoding;
}
origin: org.apache.camel/camel-cxf

protected void setCharsetWithContentType(Exchange camelExchange) {
  // setup the charset from content-type header
  String contentTypeHeader = ExchangeHelper.getContentType(camelExchange);
  if (contentTypeHeader != null) {
    String charset = HttpHeaderHelper.findCharset(contentTypeHeader);
    String normalizedEncoding = HttpHeaderHelper.mapCharset(charset, Charset.forName("UTF-8").name());
    if (normalizedEncoding != null) {
      camelExchange.setProperty(Exchange.CHARSET_NAME, normalizedEncoding);
    }
  }
}

origin: apache/cxf

private String setEncoding(final Message inMessage,
              final HttpServletRequest req,
              final String contentType) throws IOException {
  String enc = HttpHeaderHelper.findCharset(contentType);
  if (enc == null) {
    enc = req.getCharacterEncoding();
  }
  // work around a bug with Jetty which results in the character
  // encoding not being trimmed correctly.
  if (enc != null && enc.endsWith("\"")) {
    enc = enc.substring(0, enc.length() - 1);
  }
  if (enc != null || "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod())) {
    //allow gets/deletes/options to not specify an encoding
    String normalizedEncoding = HttpHeaderHelper.mapCharset(enc);
    if (normalizedEncoding == null) {
      String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG",
                               LOG, enc).toString();
      LOG.log(Level.WARNING, m);
      throw new IOException(m);
    }
    inMessage.put(Message.ENCODING, normalizedEncoding);
  }
  return contentType;
}
protected Message retrieveFromContinuation(HttpServletRequest req) {
origin: org.apache.camel/camel-cxf

protected void setCharsetWithContentType(Exchange camelExchange) {
  // setup the charset from content-type header
  String contentTypeHeader = ExchangeHelper.getContentType(camelExchange);
  if (contentTypeHeader != null) {
    String charset = HttpHeaderHelper.findCharset(contentTypeHeader);
    String normalizedEncoding = HttpHeaderHelper.mapCharset(charset, Charset.forName("UTF-8").name());
    if (normalizedEncoding != null) {
      camelExchange.setProperty(Exchange.CHARSET_NAME, normalizedEncoding);
    }
  }
}
origin: org.apache.cxf/cxf-bundle-jaxrs

private String setEncoding(final Message inMessage, 
              final HttpServletRequest req, 
              final String contentType) throws IOException {
  
  String enc = HttpHeaderHelper.findCharset(contentType);
  if (enc == null) {
    enc = req.getCharacterEncoding();
  }
  // work around a bug with Jetty which results in the character
  // encoding not being trimmed correctly.
  if (enc != null && enc.endsWith("\"")) {
    enc = enc.substring(0, enc.length() - 1);
  }
  if (enc != null || "POST".equals(req.getMethod()) || "PUT".equals(req.getMethod())) {
    //allow gets/deletes/options to not specify an encoding
    String normalizedEncoding = HttpHeaderHelper.mapCharset(enc);
    if (normalizedEncoding == null) {
      String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG",
                               LOG, enc).toString();
      LOG.log(Level.WARNING, m);
      throw new IOException(m);   
    }
    inMessage.put(Message.ENCODING, normalizedEncoding);
  }
  return contentType;
}
protected Message retrieveFromContinuation(HttpServletRequest req) {
origin: org.apache.cxf/cxf-api

String val = ih.getHeader("Content-Type", "; ");
if (!StringUtils.isEmpty(val)) {
  String cs = HttpHeaderHelper.findCharset(val);
  if (!StringUtils.isEmpty(cs)) {
    message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
origin: org.apache.cxf/cxf-bundle-jaxrs

String val = ih.getHeader("Content-Type", "; ");
if (!StringUtils.isEmpty(val)) {
  String cs = HttpHeaderHelper.findCharset(val);
  if (!StringUtils.isEmpty(cs)) {
    message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
origin: apache/cxf

String val = AttachmentUtil.getHeader(ih, "Content-Type", "; ");
if (!StringUtils.isEmpty(val)) {
  String cs = HttpHeaderHelper.findCharset(val);
  if (!StringUtils.isEmpty(cs)) {
    message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
origin: org.apache.cxf/cxf-core

String val = AttachmentUtil.getHeader(ih, "Content-Type", "; ");
if (!StringUtils.isEmpty(val)) {
  String cs = HttpHeaderHelper.findCharset(val);
  if (!StringUtils.isEmpty(cs)) {
    message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
origin: org.apache.cxf/cxf-bundle-jaxrs

String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE));
String normalizedEncoding = HttpHeaderHelper.mapCharset(charset);
if (normalizedEncoding == null) {
origin: apache/cxf

String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE));
String normalizedEncoding = HttpHeaderHelper.mapCharset(charset);
if (normalizedEncoding == null) {
org.apache.cxf.helpersHttpHeaderHelperfindCharset

Popular methods of HttpHeaderHelper

  • mapCharset
  • getHeaderKey
  • getHeader

Popular in Java

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now