001 /**
002 * Copyright 2005-2011 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.edl.impl;
017
018 import java.io.BufferedReader;
019 import java.io.IOException;
020 import java.io.InputStreamReader;
021
022 import javax.servlet.GenericServlet;
023 import javax.servlet.ServletException;
024 import javax.servlet.ServletRequest;
025 import javax.servlet.ServletResponse;
026
027 /**
028 * Servlet designed to help run tests for EDocLite documents
029 *
030 * @author Kuali Rice Team (rice.collab@kuali.org)
031 *
032 */
033 public class EDocLiteTestServlet extends GenericServlet {
034
035 private static final long serialVersionUID = 4682035504803952278L;
036
037 public static String postData;
038
039 /**
040 * This overridden method saves data to the public static <code>postData</code> variable
041 *
042 * @see javax.servlet.GenericServlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
043 */
044 @Override
045 public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
046 BufferedReader br = new BufferedReader(new InputStreamReader(req.getInputStream()));
047 StringBuilder sb = new StringBuilder();
048 String result = null;
049 while ((result = br.readLine()) != null) {
050 sb.append(result + "\n");
051 }
052 br.close();
053 postData = sb.toString();
054 }
055
056 }