use of com.adaptris.core.http.server.RawStatusProvider in project interlok by adaptris.
the class JettyResponseService method buildProducer.
protected StandardResponseProducer buildProducer(AdaptrisMessage msg) {
StandardResponseProducer p = new StandardResponseProducer().withContentTypeProvider(new RawContentTypeProvider(msg.resolve(getContentType()))).withResponseHeaderProvider(getResponseHeaderProvider()).withSendPayload(true).withForwardConnectionException(false).withFlushBuffer(true).withStatusProvider(new RawStatusProvider(Integer.parseInt(msg.resolve(getHttpStatus())))).withMessageFactory(msg.getFactory());
p.registerConnection(new NullConnection());
return p;
}
use of com.adaptris.core.http.server.RawStatusProvider in project interlok by adaptris.
the class RawStatusProviderTest method testGetStatus.
@Test
public void testGetStatus() {
RawStatusProvider prov = new RawStatusProvider(HttpStatus.OK_200.getStatusCode());
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
assertEquals(200, prov.getStatus(msg).getCode());
assertEquals("OK", prov.getStatus(msg).getText());
}
use of com.adaptris.core.http.server.RawStatusProvider in project interlok by adaptris.
the class RawStatusProviderTest method testGetStatus_WithText.
@Test
public void testGetStatus_WithText() {
RawStatusProvider prov = new RawStatusProvider(HttpURLConnection.HTTP_ACCEPTED);
prov.setText("Really Not OK");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
assertEquals(HttpURLConnection.HTTP_ACCEPTED, prov.getStatus(msg).getCode());
assertNotSame("OK", prov.getStatus(msg).getText());
assertEquals("Really Not OK", prov.getStatus(msg).getText());
}
Aggregations