1 30 31 package org.apache.commons.httpclient; 32 33 import java.io.IOException ; 34 35 import javax.servlet.ServletException ; 36 import javax.servlet.http.HttpServletRequest ; 37 import javax.servlet.http.HttpServletResponse ; 38 39 public class StatusLineServlet extends MultiMethodServlet { 40 protected void genericService(HttpServletRequest request, HttpServletResponse response) 41 throws IOException , ServletException { 42 43 response.setHeader("StatusLineSetByServlet","Yes"); 44 45 int code = 402; 46 47 try { 48 code = Integer.parseInt(request.getHeader("Set-StatusCode")); 49 } catch (Exception e) { 50 } 51 52 String message = request.getHeader("Set-StatusMessage"); 53 response.sendError(code, message); 54 55 } 56 } 57 58 | Popular Tags |