[1376] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
| 2 | // |
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | // you may not use this file except in compliance with the License. |
---|
| 5 | // You may obtain a copy of the License at |
---|
| 6 | // |
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | // |
---|
| 9 | // Unless required by applicable law or agreed to in writing, software |
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | // See the License for the specific language governing permissions and |
---|
| 13 | // limitations under the License. |
---|
| 14 | |
---|
| 15 | package de.ugoe.cs.autoquest.httpmonitor; |
---|
| 16 | |
---|
| 17 | import java.io.IOException; |
---|
| 18 | |
---|
| 19 | import javax.servlet.ServletException; |
---|
| 20 | import javax.servlet.http.HttpServlet; |
---|
| 21 | import javax.servlet.http.HttpServletRequest; |
---|
| 22 | import javax.servlet.http.HttpServletResponse; |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * @author Patrick Harms |
---|
| 26 | */ |
---|
| 27 | class DummyServlet extends HttpServlet { |
---|
| 28 | |
---|
| 29 | /** */ |
---|
| 30 | private static final long serialVersionUID = 1L; |
---|
| 31 | |
---|
| 32 | /** */ |
---|
| 33 | private String responseMessage; |
---|
| 34 | |
---|
| 35 | /* (non-Javadoc) |
---|
| 36 | * @see org.mortbay.jetty.servlet.DefaultServlet#doGet(HttpServletRequest, HttpServletResponse) |
---|
| 37 | */ |
---|
| 38 | @Override |
---|
| 39 | protected void doGet(HttpServletRequest request, HttpServletResponse response) |
---|
| 40 | throws ServletException, IOException |
---|
| 41 | { |
---|
| 42 | System.err.println("responding on get with: " + responseMessage); |
---|
| 43 | response.getOutputStream().write(responseMessage.getBytes()); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | /* (non-Javadoc) |
---|
| 47 | * @see org.mortbay.jetty.servlet.DefaultServlet#doPost(HttpServletRequest, HttpServletResponse) |
---|
| 48 | */ |
---|
| 49 | @Override |
---|
| 50 | protected void doPost(HttpServletRequest request, HttpServletResponse response) |
---|
| 51 | throws ServletException, IOException |
---|
| 52 | { |
---|
| 53 | System.err.println("responding on post with: " + responseMessage); |
---|
| 54 | response.getOutputStream().write(responseMessage.getBytes()); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | /* (non-Javadoc) |
---|
| 58 | * @see org.mortbay.jetty.servlet.DefaultServlet#doTrace(HttpServletRequest, HttpServletResponse) |
---|
| 59 | */ |
---|
| 60 | @Override |
---|
| 61 | protected void doTrace(HttpServletRequest req, HttpServletResponse response) |
---|
| 62 | throws ServletException, IOException |
---|
| 63 | { |
---|
| 64 | System.err.println("responding on trace with: " + responseMessage); |
---|
| 65 | response.getOutputStream().write(responseMessage.getBytes()); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | /** |
---|
| 69 | * |
---|
| 70 | */ |
---|
| 71 | void setResponse(String responseMessage) { |
---|
| 72 | this.responseMessage = responseMessage; |
---|
| 73 | } |
---|
| 74 | } |
---|