Search in sources :

Example 1 with Response

use of com.github.dreamhead.moco.Response in project moco by dreamhead.

the class AbstractContentResponseHandler method writeToResponse.

@Override
public final void writeToResponse(final SessionContext context) {
    Request request = context.getRequest();
    Response response = context.getResponse();
    if (HttpRequest.class.isInstance(request) && MutableHttpResponse.class.isInstance(response)) {
        HttpRequest httpRequest = HttpRequest.class.cast(request);
        MutableHttpResponse httpResponse = MutableHttpResponse.class.cast(response);
        doWriteToResponse(httpRequest, httpResponse);
        return;
    }
    MutableResponse mutableResponse = MutableResponse.class.cast(response);
    mutableResponse.setContent(requireResponseContent(request));
}
Also used : MutableResponse(com.github.dreamhead.moco.MutableResponse) MutableHttpResponse(com.github.dreamhead.moco.MutableHttpResponse) Response(com.github.dreamhead.moco.Response) HttpRequest(com.github.dreamhead.moco.HttpRequest) MutableResponse(com.github.dreamhead.moco.MutableResponse) MutableHttpResponse(com.github.dreamhead.moco.MutableHttpResponse) HttpRequest(com.github.dreamhead.moco.HttpRequest) Request(com.github.dreamhead.moco.Request)

Example 2 with Response

use of com.github.dreamhead.moco.Response in project moco by dreamhead.

the class AbstractHttpResponseHandler method writeToResponse.

@Override
public final void writeToResponse(final SessionContext context) {
    Request request = context.getRequest();
    Response response = context.getResponse();
    if (HttpRequest.class.isInstance(request) && MutableHttpResponse.class.isInstance(response)) {
        HttpRequest httpRequest = HttpRequest.class.cast(request);
        MutableHttpResponse httpResponse = MutableHttpResponse.class.cast(response);
        doWriteToResponse(httpRequest, httpResponse);
    }
}
Also used : MutableHttpResponse(com.github.dreamhead.moco.MutableHttpResponse) Response(com.github.dreamhead.moco.Response) HttpRequest(com.github.dreamhead.moco.HttpRequest) MutableHttpResponse(com.github.dreamhead.moco.MutableHttpResponse) HttpRequest(com.github.dreamhead.moco.HttpRequest) Request(com.github.dreamhead.moco.Request)

Aggregations

HttpRequest (com.github.dreamhead.moco.HttpRequest)2 MutableHttpResponse (com.github.dreamhead.moco.MutableHttpResponse)2 Request (com.github.dreamhead.moco.Request)2 Response (com.github.dreamhead.moco.Response)2 MutableResponse (com.github.dreamhead.moco.MutableResponse)1