Search in sources :

Example 1 with BufferedRequest

use of org.alfresco.repo.web.scripts.BufferedRequest in project alfresco-remote-api by Alfresco.

the class ApiWebScript method execute.

@Override
public void execute(final WebScriptRequest req, final WebScriptResponse res) throws IOException {
    Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
    Api api = assistant.determineApi(templateVars);
    final BufferedRequest bufferedReq = getRequest(req);
    final BufferedResponse bufferedRes = getResponse(res);
    try {
        execute(api, bufferedReq, bufferedRes);
    } finally {
        // Get rid of any temporary files
        if (bufferedReq != null) {
            bufferedReq.close();
        }
    }
    // Ensure a response is always flushed after successful execution
    if (bufferedRes != null) {
        bufferedRes.writeResponse();
    }
}
Also used : BufferedRequest(org.alfresco.repo.web.scripts.BufferedRequest) BufferedResponse(org.alfresco.repo.web.scripts.BufferedResponse) Api(org.alfresco.rest.framework.Api)

Aggregations

BufferedRequest (org.alfresco.repo.web.scripts.BufferedRequest)1 BufferedResponse (org.alfresco.repo.web.scripts.BufferedResponse)1 Api (org.alfresco.rest.framework.Api)1