Package javax.ws.rs.core

Examples of javax.ws.rs.core.Response.readEntity()


    }

    protected String[] getStringArray(String name, String key) {
        String[] empty = new String[0];
        Response result = getResponse(name);
        JsonObject response = result.readEntity(JsonObject.class);
        response = response.getJsonObject("extraProperties");
        if (response == null) {
            return empty;
        }
        response = response.getJsonObject("childResources");
View Full Code Here


                .append(getLastRunTime() + 1)
                .append("&toTime=")
                .append(System.currentTimeMillis() + 1000)
                .append("&maximumNumberOfResults=1000");
        Response response = getResponse(uriBuilder.toString());
        JsonObject result = response.readEntity(JsonObject.class);
        JsonArray recordsArray = result.getJsonArray("records");
        List<LogRecord> records = new ArrayList<>(recordsArray.size());
        for (int i = 0; i < recordsArray.size(); i++) {
            JsonObject currentRecord = recordsArray.getJsonObject(i);
            String message = currentRecord.getString("Message");
View Full Code Here

                resolveTemplate("bean", ejbName).
                request(MediaType.APPLICATION_JSON).get(Response.class);
        if (response.getStatus() == 404) {
            return null;
        }
        JsonObject rawStatistics = response.readEntity(JsonObject.class);
        return preprocessChildResource(rawStatistics);
    }

    public JsonObject fetchApplicationStatistics(String applicationName) {
        WebTarget target = client.target(getUri() + "{application}/server/");
View Full Code Here

        Response response = target.resolveTemplate("application", applicationName).
                request(MediaType.APPLICATION_JSON).get(Response.class);
        if (response.getStatus() == 404) {
            return null;
        }
        JsonObject rawStatistics = response.readEntity(JsonObject.class);
        return preprocessEntity(rawStatistics);
    }

    public JsonObject fetchMethodStatistics(String applicationName, String ejbName, String methodName) {
        WebTarget target = client.target(getUri() + "{application}/{bean}/bean-methods/{method}");
View Full Code Here

                resolveTemplate("method", methodName).
                request(MediaType.APPLICATION_JSON).get(Response.class);
        if (response.getStatus() == 404) {
            return null;
        }
        JsonObject rawStatistics = response.readEntity(JsonObject.class);
        return preprocessEntity(rawStatistics);
    }

    public JsonObject fetchBeanPoolStatistics(String applicationName, String ejbName) {
        WebTarget target = client.target(getUri() + "{application}/{bean}/bean-pool");
View Full Code Here

                resolveTemplate("bean", ejbName).
                request(MediaType.APPLICATION_JSON).get(Response.class);
        if (response.getStatus() == 404) {
            return null;
        }
        JsonObject rawStatistics = response.readEntity(JsonObject.class);
        return preprocessEntity(rawStatistics);
    }

    public String getUri() {
        return "http://" + location.get() + "/monitoring/domain/server/applications/";
View Full Code Here

    @Test
    public void testSSE() throws IOException, InterruptedException, DeploymentException, ExecutionException {
        final Client client = ClientBuilder.newBuilder().register(SseFeature.class).build();
        Response resp = client.target("http://localhost:8080/ssechannel").request().get();
        NewCookie session = resp.getCookies().get(JSESSIONID);
        final EventInput eventInput = resp.readEntity(EventInput.class);
        final SettableFuture<String> res = new SettableFuture<>();
        new Thread(new Runnable() {
            @Override
            public void run() {
                while (!eventInput.isClosed() && !res.isDone()) {
View Full Code Here

public abstract class AbstractCDITest extends AbstractBusClientServerTestBase {
    @Test
    public void testInjectedVersionIsProperlyReturned() {
        Response r = createWebClient("/rest/api/bookstore/version", MediaType.TEXT_PLAIN).get();
        assertEquals(Status.OK.getStatusCode(), r.getStatus());
        assertEquals("1.0", r.readEntity(String.class));
    }
   
    @Test
    public void testResponseHasBeenReceivedWhenAddingNewBook() {
        Response r = createWebClient("/rest/api/bookstore/books").post(
View Full Code Here

        assertEquals(Status.CREATED.getStatusCode(), r.getStatus());
       
        r = createWebClient("/rest/api/bookstore/books").path(id).get();
        assertEquals(Status.OK.getStatusCode(), r.getStatus());
       
        Book book = r.readEntity(Book.class);
        assertEquals(id, book.getId());
    }
   
    @Test
    public void testAddOneBookWithValidation() {
View Full Code Here

    assertEquals(Response.Status.CREATED, response.getStatusInfo());
    URI bookURI = response.getLocation();

    // With the location, GETs the Book
    response = client.target(bookURI).request().get();
    book = response.readEntity(Book.class);
    assertEquals(Response.Status.OK, response.getStatusInfo());
    assertEquals("The Hitchhiker's Guide to the Galaxy", book.getTitle());

    // Gets the book id and DELETEs it
    String bookId = bookURI.toString().split("/")[6];
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.