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

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

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

Refine searchRefine arrow

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

protected void handleResponseInternal() throws IOException {
  Exchange exchange = outMessage.getExchange();
  int responseCode = doProcessResponseCode();
  inMessage.setExchange(exchange);
  updateResponseHeaders(inMessage);
  inMessage.put(Message.RESPONSE_CODE, responseCode);
  if (MessageUtils.getContextualBoolean(outMessage, SET_HTTP_RESPONSE_MESSAGE, false)) {
    inMessage.put(HTTP_RESPONSE_MESSAGE, getResponseMessage());
  String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE));
  String normalizedEncoding = HttpHeaderHelper.mapCharset(charset);
  if (normalizedEncoding == null) {
    String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG",
origin: org.apache.cxf/cxf-rt-transports-http

public void readFromConnection(HttpURLConnection connection) {
  Map<String, List<String>> origHeaders = connection.getHeaderFields();
  headers.clear();
  for (Entry<String, List<String>> entry : origHeaders.entrySet()) {
    if (entry.getKey() != null) {
      String key = HttpHeaderHelper.getHeaderKey(entry.getKey());
      List<String> old = headers.get(key);
      if (old != null) {
        List<String> nl = new ArrayList<>(old.size() + entry.getValue().size()); 
        nl.addAll(old);
        nl.addAll(entry.getValue());
        headers.put(key, nl);
      } else {
        headers.put(key, entry.getValue());
      }
    }
  }
}
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: apache/cxf

if (supportedPayloadContentTypes != null && message.containsKey(Message.CONTENT_TYPE)
  && !supportedPayloadContentTypes.contains(message.get(Message.CONTENT_TYPE))) {
  return permitted;
  Object o = message.getContextualProperty(USE_GZIP_KEY);
  if (o instanceof UseGzip) {
    permitted = (UseGzip)o;
  if (requestHeaders != null) {
    List<String> acceptEncodingHeader = CastUtils.cast(HttpHeaderHelper
      .getHeader(requestHeaders, HttpHeaderHelper.ACCEPT_ENCODING));
    List<String> jmsEncodingHeader = CastUtils.cast(requestHeaders.get(SOAP_JMS_CONTENTENCODING));
    if (jmsEncodingHeader != null && jmsEncodingHeader.contains("gzip")) {
origin: org.apache.cxf/cxf-rt-transports-common

  .get(Message.PROTOCOL_HEADERS));
if (protocolHeaders != null) {
  List<String> contentEncoding = HttpHeaderHelper.getHeader(protocolHeaders, 
                               HttpHeaderHelper.CONTENT_ENCODING);
  if (contentEncoding == null) {
    try {
      LOG.fine("Uncompressing response");
      InputStream is = message.getContent(InputStream.class);
      if (is == null) {
        return;
      message.setContent(InputStream.class, zipInput);
origin: org.apache.cxf/cxf-api

protected void initializeRootMessage() throws IOException {
  contentType = (String) message.get(Message.CONTENT_TYPE);
  if (message.getContent(InputStream.class) == null) {
    throw new IllegalStateException("An InputStream must be provided!");
    stream = new PushbackInputStream(message.getContent(InputStream.class),
                     pbAmount);
    if (!readTillFirstBoundary(stream, boundary)) {
      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-core

public void handleMessage(Message message) {
  if (isGET(message) || message.getContent(XMLStreamReader.class) != null) {
    LOG.fine("StaxInInterceptor skipped.");
    return;
  InputStream is = message.getContent(InputStream.class);
  Reader reader = null;
  if (is == null) {
    reader = message.getContent(Reader.class);
    if (reader == null) {
      return;
    if (m != null) {
      List<String> contentLen = HttpHeaderHelper
        .getHeader(m, HttpHeaderHelper.CONTENT_LENGTH);
      List<String> contentTE = HttpHeaderHelper
        .getHeader(m, HttpHeaderHelper.CONTENT_TRANSFER_ENCODING);
      List<String> transferEncoding = HttpHeaderHelper
        .getHeader(m, HttpHeaderHelper.TRANSFER_ENCODING);
      if ((StringUtils.isEmpty(contentLen) || "0".equals(contentLen.get(0)))
        && StringUtils.isEmpty(contentTE)
origin: org.apache.cxf/cxf-rt-bindings-http

public void handleMessage(Message message) throws Fault {
  Map<String, List<String>> headers = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
  if (headers == null) {
    headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
    message.put(Message.PROTOCOL_HEADERS, headers);
  }
  String ct = (String)message.getExchange().get(Endpoint.class).get(HttpHeaderHelper.CONTENT_TYPE);
  if (ct != null) {
    List<String> contentType = new ArrayList<String>();
    contentType.add(ct);
    headers.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), contentType);
    message.put(HttpHeaderHelper.CONTENT_TYPE, ct);
  }
  
}
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.cxf/cxf-api

public static String mapCharset(String enc) {
  return mapCharset(enc, ISO88591);
}    

origin: org.apache.cxf/cxf-core

if (supportedPayloadContentTypes != null && message.containsKey(Message.CONTENT_TYPE)
  && !supportedPayloadContentTypes.contains(message.get(Message.CONTENT_TYPE))) {
  return permitted;
  Object o = message.getContextualProperty(USE_GZIP_KEY);
  if (o instanceof UseGzip) {
    permitted = (UseGzip)o;
  if (requestHeaders != null) {
    List<String> acceptEncodingHeader = CastUtils.cast(HttpHeaderHelper
      .getHeader(requestHeaders, HttpHeaderHelper.ACCEPT_ENCODING));
    List<String> jmsEncodingHeader = CastUtils.cast(requestHeaders.get(SOAP_JMS_CONTENTENCODING));
    if (jmsEncodingHeader != null && jmsEncodingHeader.contains("gzip")) {
origin: org.apache.cxf/cxf-bundle-jaxrs

  .get(Message.PROTOCOL_HEADERS));
if (protocolHeaders != null) {
  List<String> contentEncoding = HttpHeaderHelper.getHeader(protocolHeaders, 
                               HttpHeaderHelper.CONTENT_ENCODING);
  if (contentEncoding == null) {
    try {
      LOG.fine("Uncompressing response");
      InputStream is = message.getContent(InputStream.class);
      if (is == null) {
        return;
      message.setContent(InputStream.class, zipInput);
origin: apache/cxf

protected void initializeRootMessage() throws IOException {
  contentType = (String) message.get(Message.CONTENT_TYPE);
  if (message.getContent(InputStream.class) == null) {
    throw new IllegalStateException("An InputStream must be provided!");
    stream = new PushbackInputStream(message.getContent(InputStream.class), PUSHBACK_AMOUNT);
    if (!readTillFirstBoundary(stream, boundary)) {
      throw new IOException("Couldn't find MIME boundary: " + boundaryString);
    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: apache/cxf

public void handleMessage(Message message) {
  if (isGET(message) || message.getContent(XMLStreamReader.class) != null) {
    LOG.fine("StaxInInterceptor skipped.");
    return;
  InputStream is = message.getContent(InputStream.class);
  Reader reader = null;
  if (is == null) {
    reader = message.getContent(Reader.class);
    if (reader == null) {
      return;
    if (m != null) {
      List<String> contentLen = HttpHeaderHelper
        .getHeader(m, HttpHeaderHelper.CONTENT_LENGTH);
      List<String> contentTE = HttpHeaderHelper
        .getHeader(m, HttpHeaderHelper.CONTENT_TRANSFER_ENCODING);
      List<String> transferEncoding = HttpHeaderHelper
        .getHeader(m, HttpHeaderHelper.TRANSFER_ENCODING);
      if ((StringUtils.isEmpty(contentLen) || "0".equals(contentLen.get(0)))
        && StringUtils.isEmpty(contentTE)
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-core

public static String mapCharset(String enc) {
  return mapCharset(enc, ISO88591);
}
origin: org.apache.cxf/cxf-bundle-jaxrs

if (isRequestor(message)) {
  LOG.fine("Requestor role, so gzip enabled");
  Object o = message.getContextualProperty(USE_GZIP_KEY);
  if (o instanceof UseGzip) {
    permitted = (UseGzip)o;
    permitted = force ? UseGzip.YES : UseGzip.NO;
  message.put(GZIP_ENCODING_KEY, "gzip");
  addHeader(message, "Accept-Encoding", "gzip;q=1.0, identity; q=0.5, *;q=0"); 
} else {
  LOG.fine("Response role, checking accept-encoding");
  Exchange exchange = message.getExchange();
  Message request = exchange.getInMessage();
  Map<String, List<String>> requestHeaders = CastUtils.cast((Map<?, ?>)request
  if (requestHeaders != null) {
    List<String> acceptEncodingHeader = CastUtils.cast(HttpHeaderHelper
      .getHeader(requestHeaders, HttpHeaderHelper.ACCEPT_ENCODING));
    List<String> jmsEncodingHeader = CastUtils.cast(requestHeaders.get(SOAP_JMS_CONTENTENCODING));
    if (jmsEncodingHeader != null && jmsEncodingHeader.contains("gzip")) {
origin: org.apache.cxf/cxf-core

  .get(Message.PROTOCOL_HEADERS));
if (protocolHeaders != null) {
  List<String> contentEncoding = HttpHeaderHelper.getHeader(protocolHeaders,
                               HttpHeaderHelper.CONTENT_ENCODING);
  if (contentEncoding == null) {
    try {
      LOG.fine("Uncompressing response");
      InputStream is = message.getContent(InputStream.class);
      if (is == null) {
        return;
      message.setContent(InputStream.class, zipInput);
origin: org.apache.cxf/cxf-bundle-jaxrs

protected void handleResponseInternal() throws IOException {
  Exchange exchange = outMessage.getExchange();
  int responseCode = doProcessResponseCode();
  inMessage.setExchange(exchange);
  updateResponseHeaders(inMessage);
  inMessage.put(Message.RESPONSE_CODE, responseCode);
  propagateConduit(exchange, inMessage);
  String charset = HttpHeaderHelper.findCharset((String)inMessage.get(Message.CONTENT_TYPE));
  String normalizedEncoding = HttpHeaderHelper.mapCharset(charset);
  if (normalizedEncoding == null) {
    String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG",
org.apache.cxf.helpersHttpHeaderHelper

Most used methods

  • mapCharset
  • findCharset
  • getHeaderKey
  • getHeader

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • requestLocationUpdates (LocationManager)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JList (javax.swing)
  • Top plugins for WebStorm
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