01: /*
02: * Copyright 2007 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.doctaskrunner.serverimpl.httphandlers;
17:
18: import org.outerj.daisy.httpconnector.spi.HttpUtil;
19: import org.outerj.daisy.httpconnector.spi.RequestHandlerSupport;
20: import org.outerj.daisy.repository.Repository;
21: import org.outerj.daisy.doctaskrunner.DocumentTaskManager;
22: import org.outerj.daisy.util.HttpConstants;
23:
24: import javax.servlet.http.HttpServletRequest;
25: import javax.servlet.http.HttpServletResponse;
26: import java.util.Map;
27:
28: public class TaskDocDetailsHandler extends
29: AbstractDocTaskRequestHandler {
30: public void handleRequest(Map matchMap, HttpServletRequest request,
31: HttpServletResponse response, Repository repository,
32: RequestHandlerSupport support) throws Exception {
33: DocumentTaskManager taskManager = (DocumentTaskManager) repository
34: .getExtension("DocumentTaskManager");
35: long taskId = HttpUtil.parseId("task", (String) matchMap
36: .get("1"));
37: if (request.getMethod().equals(HttpConstants.GET)) {
38: taskManager.getTaskDocDetails(taskId).getXml().save(
39: response.getOutputStream());
40: } else {
41: response.sendError(HttpConstants._405_Method_Not_Allowed);
42: }
43: }
44:
45: public String getPathPattern() {
46: return "/task/*/docdetails";
47: }
48: }
|