content: package com.weixinpay;
  
  import java.io.IOException;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import org.apache.log4j.Logger;
  
  import com.weixinpay.common.StreamUtil;
  
  /**
   * 接收支付结果
   */
  public class PayResult extends HttpServlet {
  	private static final long serialVersionUID = 1L;
  	private static final Logger L = Logger.getLogger(PayResult.class);
         
      /**
       * @see HttpServlet#HttpServlet()
       */
      public PayResult() {
          super();
          // TODO Auto-generated constructor stub
      }
  
  	/**
  	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
  	 */
  	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  		// TODO Auto-generated method stub
  		//response.getWriter().append("Served at: ").append(request.getContextPath());
  		
  		String reqParams = StreamUtil.read(request.getInputStream());
  		L.info("-------支付结果:"+reqParams);
  		StringBuffer sb = new StringBuffer("<xml><return_code>SUCCESS</return_code><return_msg>OK</return_msg></xml>");
  		response.getWriter().append(sb.toString());
  	}
  
  	/**
  	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
  	 */
  	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  		// TODO Auto-generated method stub
  		doGet(request, response);
  	}
  
  }
  