use of io.milton.resource.PostableResource in project lobcder by skoulouzis.
the class PostJsonResource method processForm.
@Override
public String processForm(Map<String, String> parameters, Map<String, FileItem> files) throws BadRequestException, NotAuthorizedException, ConflictException {
String method = parameters.get(methodParamName);
// what about allowing devs to invoke methods on their resources? do we
// allow any method value, if it matches a method name?
res = jsonResourceFactory.wrapResource(host, this, method, href);
if (res instanceof PostableResource) {
PostableResource pr = (PostableResource) res;
return pr.processForm(parameters, files);
} else {
return null;
}
}
use of io.milton.resource.PostableResource in project lobcder by skoulouzis.
the class PostHandler method processExistingResource.
@Override
public void processExistingResource(HttpManager manager, Request request, Response response, Resource resource) throws NotAuthorizedException, BadRequestException, ConflictException, NotFoundException {
PostableResource r = (PostableResource) resource;
for (CustomPostHandler h : manager.getCustomPostHandlers()) {
if (h.supports(resource, request)) {
log.trace("Found CustomPostHandler supporting this resource and request");
h.process(resource, request, response);
return;
}
}
String url = r.processForm(request.getParams(), request.getFiles());
if (url != null) {
log.debug("redirect: " + url);
responseHandler.respondRedirect(response, request, url);
} else {
log.debug("respond with content");
responseHandler.respondContent(resource, response, request, request.getParams());
}
}
Aggregations