Search in sources :

Example 16 with Request

use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.

the class MessageUtil method getGetRequest.

public static Request getGetRequest(String uri) {
    Request req = getStandartRequest(Request.METHOD_GET);
    req.setUri(uri);
    return req;
}
Also used : Request(com.predic8.membrane.core.http.Request)

Example 17 with Request

use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.

the class MessageUtil method getStandartRequest.

private static Request getStandartRequest(String method) {
    Request request = new Request();
    request.setMethod(method);
    request.setVersion(Constants.HTTP_VERSION_11);
    return request;
}
Also used : Request(com.predic8.membrane.core.http.Request)

Example 18 with Request

use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.

the class HttpUtil method createSOAPValidationErrorResponse.

public static Response createSOAPValidationErrorResponse(String message) {
    Response response = new Response();
    response.setStatusCode(400);
    response.setStatusMessage("Bad request");
    response.setHeader(createHeaders(MimeType.TEXT_XML_UTF8));
    response.setBodyContent(getFaultSOAPBody(message).getBytes(Constants.UTF_8_CHARSET));
    return response;
}
Also used : Response(com.predic8.membrane.core.http.Response)

Example 19 with Request

use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.

the class RequestPerformanceVersion4 method testParsing.

@Test
public void testParsing() throws Exception {
    Request request = new Request();
    parseHeaderReadBufferFirst(request, getStream());
    System.out.println(request.getStartLine());
    System.out.println(request.getHeader());
}
Also used : Request(com.predic8.membrane.core.http.Request) Test(org.junit.Test)

Example 20 with Request

use of com.predic8.membrane.core.http.Request in project service-proxy by membrane.

the class RequestPerformanceVersion4 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);
}
Also used : Request(com.predic8.membrane.core.http.Request) Test(org.junit.Test)

Aggregations

Request (com.predic8.membrane.core.http.Request)39 Exchange (com.predic8.membrane.core.exchange.Exchange)20 Test (org.junit.Test)12 IOException (java.io.IOException)11 Header (com.predic8.membrane.core.http.Header)8 Response (com.predic8.membrane.core.http.Response)8 AbstractExchange (com.predic8.membrane.core.exchange.AbstractExchange)5 Message (com.predic8.membrane.core.http.Message)5 Outcome (com.predic8.membrane.core.interceptor.Outcome)5 Body (com.predic8.membrane.core.http.Body)3 Request (com.predic8.membrane.core.http.xml.Request)3 EndOfStreamException (com.predic8.membrane.core.util.EndOfStreamException)3 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)2 CacheBuilder (com.google.common.cache.CacheBuilder)2 HeaderField (com.predic8.membrane.core.http.HeaderField)2 ResponseBuilder (com.predic8.membrane.core.http.Response.ResponseBuilder)2 ResolverMap (com.predic8.membrane.core.resolver.ResolverMap)2 HttpClient (com.predic8.membrane.core.transport.http.HttpClient)2 StringReader (java.io.StringReader)2 SocketException (java.net.SocketException)2