Search in sources :

Example 1 with MutableResponse

use of com.github.dreamhead.moco.MutableResponse 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)

Aggregations

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