1 /**
2 * Copyright 2005-2014 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
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.kuali.rice.edl.impl;
17
18 import java.io.BufferedReader;
19 import java.io.IOException;
20 import java.io.InputStreamReader;
21
22 import javax.servlet.GenericServlet;
23 import javax.servlet.ServletException;
24 import javax.servlet.ServletRequest;
25 import javax.servlet.ServletResponse;
26
27 /**
28 * Servlet designed to help run tests for EDocLite documents
29 *
30 * @author Kuali Rice Team (rice.collab@kuali.org)
31 *
32 */
33 public class EDocLiteTestServlet extends GenericServlet {
34
35 private static final long serialVersionUID = 4682035504803952278L;
36
37 public static String postData;
38
39 /**
40 * This overridden method saves data to the public static <code>postData</code> variable
41 *
42 * @see javax.servlet.GenericServlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
43 */
44 @Override
45 public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
46 BufferedReader br = new BufferedReader(new InputStreamReader(req.getInputStream()));
47 StringBuilder sb = new StringBuilder();
48 String result = null;
49 while ((result = br.readLine()) != null) {
50 sb.append(result + "\n");
51 }
52 br.close();
53 postData = sb.toString();
54 }
55
56 }