1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.mycore.sword.servlets;
20
21 import java.io.IOException;
22
23 import org.mycore.sword.MCRSwordConfigurationDefault;
24 import org.mycore.sword.manager.MCRSwordContainerManager;
25 import org.mycore.sword.manager.MCRSwordStatementManager;
26 import org.swordapp.server.ContainerAPI;
27
28 import jakarta.servlet.ServletException;
29 import jakarta.servlet.http.HttpServletRequest;
30 import jakarta.servlet.http.HttpServletResponse;
31
32
33
34
35 public class MCRSwordContainerServlet extends MCRSwordServlet {
36
37 private ContainerAPI api;
38
39 public void init() {
40 MCRSwordConfigurationDefault swordConfiguration = new MCRSwordConfigurationDefault();
41 MCRSwordContainerManager containerManager = new MCRSwordContainerManager();
42 MCRSwordStatementManager statementManager = new MCRSwordStatementManager();
43 api = new ContainerAPI(containerManager, statementManager, swordConfiguration);
44 }
45
46 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
47 prepareRequest(req, resp);
48 api.get(req, resp);
49 afterRequest(req, resp);
50 }
51
52 public void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
53 prepareRequest(req, resp);
54 api.head(req, resp);
55 afterRequest(req, resp);
56 }
57
58 public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
59 prepareRequest(req, resp);
60 api.post(req, resp);
61 afterRequest(req, resp);
62 }
63
64 public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
65 prepareRequest(req, resp);
66 api.put(req, resp);
67 afterRequest(req, resp);
68 }
69
70 public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
71 prepareRequest(req, resp);
72 api.delete(req, resp);
73 afterRequest(req, resp);
74 }
75 }