use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.
the class RequestPerformanceVersion3 method parseHeaderFromArray.
@Test
public void parseHeaderFromArray() throws Exception {
long time = System.currentTimeMillis();
for (int i = 0; i <= 1000000; i++) {
parseHeaderFromArray(new Request(), buffer);
}
System.out.println("time from array: " + (System.currentTimeMillis() - time) / 1000.0);
}
use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.
the class RequestPerformanceVersion3 method parseHeaderReadBufferFirst.
@Test
public void parseHeaderReadBufferFirst() throws Exception {
long time = System.currentTimeMillis();
for (int i = 0; i <= 1000000; i++) {
parseHeaderReadBufferFirst(new Request(), getStream());
}
System.out.println("time read buffer first: " + (System.currentTimeMillis() - time) / 1000.0);
}
use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.
the class XMLContentFilterTest method getMessage.
private Message getMessage() {
Message m = new Request();
m.setBody(new Body(DOC.getBytes()));
return m;
}
use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.
the class ReverseProxyingInterceptorTest method createExchange.
/**
* Creates a fake exchange which simulates a received redirect by the server.
*/
private Exchange createExchange(String requestHostHeader, String requestDestinationHeader, int port, String requestURI, String redirectionURI) {
Exchange exc = new Exchange(new FakeHttpHandler(port));
Request req = new Request();
req.setUri(requestURI);
Header header = new Header();
if (requestHostHeader != null)
header.setHost(requestHostHeader);
if (requestDestinationHeader != null)
header.add(Header.DESTINATION, requestDestinationHeader);
req.setHeader(header);
exc.setRequest(req);
if (redirectionURI != null) {
Response res = Response.redirect(redirectionURI, false).build();
exc.setResponse(res);
exc.getDestinations().add(requestURI);
}
return exc;
}
use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.
the class WebServiceExplorerInterceptor method createOperationResponse.
@Mapping("[^?]*/operation/([^/?]+)/([^/?]+)/([^/?]+)")
public Response createOperationResponse(QueryParameter params, String relativeRootPath) throws Exception {
try {
final String bindingName = params.getGroup(1);
final String portName = params.getGroup(2);
final String operationName = params.getGroup(3);
final Definitions w = getParsedWSDL();
final Service service = getService(w);
StringWriter sw = new StringWriter();
new StandardPage(sw, null) {
@Override
protected void createContent() {
h1().text("Service Proxy for " + service.getName());
h2().text("Operation: " + operationName).end();
h3().text("Sample Request").end();
pre().text(generateSampleRequest(portName, operationName, bindingName, w)).end();
}
};
return Response.ok(sw.toString()).build();
} catch (IllegalArgumentException e) {
log.error("", e);
return Response.internalServerError().build();
}
}
Aggregations