1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.web;
17
18 import org.kuali.ole.repository.DocumentStoreManager;
19
20 import javax.servlet.ServletException;
21 import javax.servlet.http.HttpServlet;
22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
24 import java.io.IOException;
25 import java.io.PrintWriter;
26
27
28
29
30
31
32
33 public class CheckoutServlet extends HttpServlet {
34
35 @Override
36 protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
37 String uuid = req.getParameter("uuid");
38 callService(resp, uuid);
39 }
40
41 private void callService(HttpServletResponse resp, String uuid) throws IOException {
42 try {
43 String checkedOutContent = new DocumentStoreManager().checkOut(uuid, "webappUser", "CheckoutServlet.callService()");
44 resp.setCharacterEncoding("UTF-8");
45 PrintWriter out = resp.getWriter();
46 out.println(checkedOutContent);
47 out.flush();
48 out.close();
49 } catch (Exception e) {
50 e.printStackTrace();
51 PrintWriter out = resp.getWriter();
52 out.println("Problem checking the file! Please refer application logs for details");
53 out.flush();
54 out.close();
55 }
56 }
57 }