use of com.github.dreamhead.moco.ResponseHandler in project moco by dreamhead.
the class ContentHandler method apply.
@Override
public ResponseHandler apply(final MocoConfig config) {
ResponseHandler handler = super.apply(config);
if (handler != this) {
return handler;
}
Resource appliedReosurce = this.resource.apply(config);
if (appliedReosurce != this.resource) {
return new ContentHandler((ContentResource) appliedReosurce);
}
return this;
}
use of com.github.dreamhead.moco.ResponseHandler in project moco by dreamhead.
the class SubResourceSetting method getMatched.
@Override
public Optional<ResponseHandler> getMatched(final RestIdMatcher resourceName, final HttpRequest httpRequest) {
for (RestSetting setting : settings) {
RestIdMatcher idMatcher = RestIdMatchers.match(join(resourceName.resourceUri(), this.id.resourceUri(), this.name));
Optional<ResponseHandler> responseHandler = setting.getMatched(idMatcher, httpRequest);
if (responseHandler.isPresent()) {
return responseHandler;
}
}
return Optional.absent();
}
use of com.github.dreamhead.moco.ResponseHandler in project moco by dreamhead.
the class BaseResponseSettingConfiguration method response.
@Override
public T response(final ResponseHandler handler, final ResponseHandler... handlers) {
ResponseHandler responseHandler = and(checkNotNull(handler, "Handler should not be null"), checkNotNull(handlers, "Handlers should not be null"));
this.handler = targetHandler(responseHandler);
return self();
}
Aggregations