Example usage for org.apache.mina.http.api HttpVersion HTTP_1_0

List of usage examples for org.apache.mina.http.api HttpVersion HTTP_1_0

Introduction

In this page you can find the example usage for org.apache.mina.http.api HttpVersion HTTP_1_0.

Prototype

HttpVersion HTTP_1_0

To view the source code for org.apache.mina.http.api HttpVersion HTTP_1_0.

Click Source Link

Document

HTTP 1/0

Usage

From source file:audio.broadcast.shoutcast.v1.ShoutcastV1BroadcastMetadataUpdater.java

License:Open Source License

/**
 * Creates an HTTP GET request to update the metadata on the remote server
 *///from  w w w  .  jav  a 2 s  .  c om
private HttpRequest createUpdateRequest(String song) {
    try {
        StringBuilder sb = new StringBuilder();
        sb.append("pass=").append(mShoutcastV1Configuration.getPassword());
        sb.append("&mode=updinfo");
        sb.append("&song=").append(URLEncoder.encode(song, UTF8));

        Map<String, String> headers = new HashMap<>();

        HttpRequestImpl request = new HttpRequestImpl(HttpVersion.HTTP_1_0, HttpMethod.GET, "/admin.cgi",
                sb.toString(), headers);

        return request;
    } catch (UnsupportedEncodingException e) {
        //This should never happen
        mLog.error("UTF-8 encoding is not supported - can't update song metadata");
    }

    return null;
}