Java Code Examples for com.sun.net.httpserver.HttpExchange#getAttribute()

The following examples show how to use com.sun.net.httpserver.HttpExchange#getAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RemoteControlServer.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
private void parsePostParameters(HttpExchange exchange)
        throws IOException {

    if ("post".equalsIgnoreCase(exchange.getRequestMethod())) {
        @SuppressWarnings("unchecked")
        Map<String, Object> parameters
                = (Map<String, Object>) exchange.getAttribute("parameters");
        InputStreamReader isr
                = new InputStreamReader(exchange.getRequestBody(), "utf-8");
        BufferedReader br = new BufferedReader(isr);
        String query = br.readLine();
        parseQuery(query, parameters);
    }
}
 
Example 2
Source File: MultiPointServer.java    From mil-sym-java with Apache License 2.0 5 votes vote down vote up
private void parsePostParameters(HttpExchange exchange)
    throws IOException {

    if ("post".equalsIgnoreCase(exchange.getRequestMethod())) {
        @SuppressWarnings("unchecked")
        Map parameters =
            (Map)exchange.getAttribute("parameters");
        InputStreamReader isr =
            new InputStreamReader(exchange.getRequestBody(),"utf-8");
        BufferedReader br = new BufferedReader(isr);
        String query = br.readLine();
        parseQuery(query, parameters);
    }
}
 
Example 3
Source File: RemoteControlServer.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private String passParams(HttpExchange he) {
    Map<String, Object> params = (Map<String, Object>) he.getAttribute("parameters");
    return (String) params.get("password");
}