Example usage for org.apache.http.protocol HTTP ISO_8859_1

List of usage examples for org.apache.http.protocol HTTP ISO_8859_1

Introduction

In this page you can find the example usage for org.apache.http.protocol HTTP ISO_8859_1.

Prototype

String ISO_8859_1

To view the source code for org.apache.http.protocol HTTP ISO_8859_1.

Click Source Link

Usage

From source file:edu.ucsb.eucalyptus.transport.http.Axis2HttpWorker.java

private void handleWSDL(final AxisHttpResponse response) throws IOException {
    String s = "A sensible response.";
    response.setStatus(HttpStatus.SC_OK);
    response.setContentType("text/html");
    OutputStream out = response.getOutputStream();
    out.write(EncodingUtils.getBytes(s, HTTP.ISO_8859_1));
}

From source file:edu.ucsb.eucalyptus.transport.http.Axis2HttpWorker.java

private boolean handleMetaData(final AxisHttpResponse response, final MessageContext msgContext,
        final String uri) {
    try {/*from w  w w  .j ava  2s.  co  m*/
        String newUri = null;
        if (uri.startsWith("/latest/"))
            newUri = uri.replaceAll("/latest/", msgContext.getProperty(MessageContext.REMOTE_ADDR) + ":");
        else
            newUri = uri.replaceAll("/\\d\\d\\d\\d-\\d\\d-\\d\\d/",
                    msgContext.getProperty(MessageContext.REMOTE_ADDR) + ":");
        LOG.debug("Metadata request: " + newUri);
        Object reply = Messaging.send("vm://VmMetadata", newUri);
        if (!(reply instanceof NullPayload)) {
            response.setStatus(HttpStatus.SC_OK);
            response.setContentType("text/html");
            OutputStream out = response.getOutputStream();
            out.write(EncodingUtils.getBytes(((String) reply), HTTP.ISO_8859_1));
        } else
            response.setStatus(HttpStatus.SC_NOT_FOUND);
        return true;
    } catch (Exception e) {
        LOG.error(e, e);
    }
    return false;
}

From source file:com.mockey.model.RequestFromClient.java

private HttpEntity constructHttpPostBody() {

    HttpEntity body;//from  w w w .ja  va 2 s  .  c  om
    try {
        if (requestBody != null) {
            body = new StringEntity(requestBody);
        } else {
            List<NameValuePair> parameters = new ArrayList<NameValuePair>();
            for (Map.Entry<String, String[]> entry : this.parameters.entrySet()) {
                for (String value : entry.getValue()) {
                    parameters.add(new BasicNameValuePair(entry.getKey(), value));
                }
            }
            body = new UrlEncodedFormEntity(parameters, HTTP.ISO_8859_1); // .UTF_8);
        }

    } catch (UnsupportedEncodingException e) {
        throw new IllegalStateException("Unable to generate a POST from the incoming request", e);
    }

    return body;

}