use of com.github.dreamhead.moco.setting.Setting in project moco by dreamhead.
the class MocoHandler method doGetHttpResponse.
private DefaultMutableHttpResponse doGetHttpResponse(final HttpRequest request) {
DefaultMutableHttpResponse httpResponse = newResponse(request, DEFAULT_STATUS);
SessionContext context = new SessionContext(request, httpResponse);
for (Setting setting : settings) {
if (setting.match(request)) {
setting.writeToResponse(context);
return httpResponse;
}
}
if (anySetting.match(request)) {
anySetting.writeToResponse(context);
return httpResponse;
}
monitor.onUnexpectedMessage(request);
return newResponse(request, HttpResponseStatus.BAD_REQUEST.code());
}
Aggregations