1 7 8 package org.jboss.net.axis.server; 9 10 import org.jboss.axis.transport.http.HTTPConstants; 11 import org.jboss.logging.Logger; 12 13 import javax.servlet.ServletException ; 14 import javax.servlet.http.HttpServletRequest ; 15 import javax.servlet.http.HttpServletRequestWrapper ; 16 import javax.servlet.http.HttpServletResponse ; 17 import java.io.IOException ; 18 19 44 public class FlashAxisServiceServlet extends AxisServiceServlet 45 { 46 50 public class FilteredHttpServletRequest extends HttpServletRequestWrapper 51 { 52 53 protected String soapAction; 54 55 63 public FilteredHttpServletRequest(HttpServletRequest req) 64 throws IllegalArgumentException 65 { 66 super(req); 67 68 soapAction = (String )req.getHeader(HTTPConstants.HEADER_SOAP_ACTION); 69 70 if (null != soapAction) 71 { 72 log.error(Constants.ERR_EXISTING_HEADER); 74 throw new IllegalArgumentException (Constants.ERR_EXISTING_HEADER); 75 } 76 77 soapAction = getParameter(HTTPConstants.HEADER_SOAP_ACTION); 78 79 if (null == soapAction) 80 { 81 log.error(Constants.ERR_MISSING_PARM); 82 throw new IllegalArgumentException (Constants.ERR_MISSING_PARM); 83 } 84 85 log.trace("FilteredHttpServletRequest.ctor(): Matched SOAPAction parameter"); 86 87 } 89 98 99 public String getHeader(String name) 100 { 101 log.trace("FlashAxisServiceServlet.FilteredHttpServletRequest.getHeader()"); 102 if (name.equals(HTTPConstants.HEADER_SOAP_ACTION)) 103 { 104 log.trace("getHeader(): Matched SOAPAction header request"); 105 return soapAction; 106 } 107 else 108 { 109 log.trace("getHeader(): Not a SOAPAction header request, called base class method."); 110 return super.getHeader(name); 111 } 112 } 114 } 116 121 protected Logger log; 122 123 126 public FlashAxisServiceServlet() 127 { 128 super(); 129 130 log = Logger.getLogger(getClass()); 131 log.trace("Constructing"); 132 } 133 134 147 public void doPost(HttpServletRequest req, HttpServletResponse res) 148 throws ServletException , IOException 149 { 150 HttpServletRequest newReq = req; 151 try 152 { 153 newReq = new FilteredHttpServletRequest(req); 154 log.trace("doPost(): Successfully created a FilteredHttpServletRequest object."); 155 } 156 catch (IllegalArgumentException e) 157 { 158 log.error("doPost(): Failed to create a FilteredHttpServletRequest object. Use original HttpServletRequest."); 159 } 160 161 super.doPost(newReq, res); 162 } 163 164 } | Popular Tags |