Package org.netmelody.cieye.server.response

Examples of org.netmelody.cieye.server.response.CiEyeResponse


       
        context.checking(new Expectations() {{
            allowing(spyIntermediary).briefingOn(feature); will(returnValue(briefing));
        }});
       
        final CiEyeResponse response = responder.respond(null);
        assertThat(IOUtils.toString(response.inputStream()), startsWith("{\"targets\":[]}"));
    }
View Full Code Here


        context.checking(new Expectations() {{
            allowing(configFetcher).getVersion(); will(returnValue("myVersion"));
            ignoring(updateChecker);
        }});
       
        final CiEyeResponse response = ciEyeVersionResponder.respond(null);
        assertThat(IOUtils.toString(response.inputStream()), containsString("\"currentServerVersion\":\"myVersion\""));
    }
View Full Code Here

        context.checking(new Expectations() {{
            allowing(updateChecker).getLatestVersion(); will(returnValue("myNewVersion"));
            ignoring(configFetcher);
        }});
       
        final CiEyeResponse response = ciEyeVersionResponder.respond(null);
       
        assertThat(IOUtils.toString(response.inputStream()), containsString("\"latestServerVersion\":\"myNewVersion\""));
    }
View Full Code Here

    private final RedirectResponder redirect = new RedirectResponder("myNewLocation");

    @Test public void
    createsAValidHttpMovedPermanentlyResponse() throws Exception {
        final CiEyeResponse response = redirect.respond(request);
        assertThat(response.status, is(Status.MOVED_PERMANENTLY));
        assertThat(response.additionalStringHeaders, includesHeader("Location", "myNewLocation"));
    }
View Full Code Here

    }
   
    @Override
    public void handle(Request request, Response response) {
        try {
            final CiEyeResponse result = responder.respond(request);
            response.set("Content-Type", result.contentType);
            response.set("Server", "CiEye/1.0 (Simple 4.0)");
            response.setDate("Date", result.date);
            response.setDate("Last-Modified", result.lastModified);
            response.setDate("Expires", result.expires);
            response.setContentLength(result.contentLength());
            response.setCode(result.status.getCode());
            response.setText(result.status.getDescription());
            for (Entry<String, String> header : result.additionalStringHeaders.entrySet()) {
                response.set(header.getKey(), header.getValue());
            }
            IOUtils.copy(result.inputStream(), response.getOutputStream());
        }
        catch (Exception e) {
            LOG.error("Failed to respond to request for resource " + request.getPath().getPath(), e);
            response.setCode(Status.NOT_FOUND.getCode());
            response.setText(Status.NOT_FOUND.getDescription());
View Full Code Here

TOP

Related Classes of org.netmelody.cieye.server.response.CiEyeResponse

Copyright © 2018 www.massapicom. 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.