Example usage for org.openqa.selenium.json Json newInput

List of usage examples for org.openqa.selenium.json Json newInput

Introduction

In this page you can find the example usage for org.openqa.selenium.json Json newInput.

Prototype

public JsonInput newInput(Reader from) throws UncheckedIOException 

Source Link

Usage

From source file:org.openqa.grid.web.servlet.HubStatusServlet.java

License:Apache License

private Map<String, Object> getRequestJSON(HttpServletRequest request) throws IOException {
    Json json = new Json();
    try (BufferedReader rd = new BufferedReader(new InputStreamReader(request.getInputStream()));
            JsonInput jin = json.newInput(rd)) {
        return jin.read(MAP_TYPE);
    } catch (JsonException e) {
        throw new IOException(e);
    }//from   w ww. ja va2 s. co m
}

From source file:org.openqa.grid.web.servlet.HubStatusServletTest.java

License:Apache License

private Map<String, Object> invokeCommand(String method, Map<String, Object> params)
        throws IOException, ServletException {
    FakeHttpServletResponse fakeResponse = sendCommand(method, "/", params);
    Json json = new Json();
    JsonInput jin = json.newInput(new StringReader(fakeResponse.getBody()));
    return jin.read(Json.MAP_TYPE);
}