Example usage for org.apache.http.message BasicHeaderValueParser parseParameters

List of usage examples for org.apache.http.message BasicHeaderValueParser parseParameters

Introduction

In this page you can find the example usage for org.apache.http.message BasicHeaderValueParser parseParameters.

Prototype

public NameValuePair[] parseParameters(CharArrayBuffer charArrayBuffer, ParserCursor parserCursor) 

Source Link

Usage

From source file:io.cloudslang.content.httpclient.consume.HttpResponseConsumer.java

public void consume(Map<String, String> result) throws IOException {
    if (httpResponse.getEntity() != null) {
        if (responseCharacterSet == null || responseCharacterSet.isEmpty()) {
            Header contentType = httpResponse.getEntity().getContentType();
            if (contentType != null) {
                String value = contentType.getValue();
                NameValuePair[] nameValuePairs = BasicHeaderValueParser.parseParameters(value,
                        BasicHeaderValueParser.INSTANCE);
                for (NameValuePair nameValuePair : nameValuePairs) {
                    if (nameValuePair.getName().equalsIgnoreCase("charset")) {
                        responseCharacterSet = nameValuePair.getValue();
                        break;
                    }//from ww  w .j  ava2  s.com
                }
            }
            if (responseCharacterSet == null || responseCharacterSet.isEmpty()) {
                responseCharacterSet = Consts.ISO_8859_1.name();
            }
        }
        consumeResponseContent(result);
    }
}