1 29 30 package com.caucho.soa.servlet; 31 32 import com.caucho.soa.encoding.ServiceEncoding; 33 34 import javax.servlet.GenericServlet ; 35 import javax.servlet.ServletException ; 36 import javax.servlet.ServletRequest ; 37 import javax.servlet.ServletResponse ; 38 import java.io.IOException ; 39 import java.util.logging.Logger ; 40 41 44 public class RpcServlet extends GenericServlet 45 { 46 private static final Logger log = 47 Logger.getLogger(RpcServlet.class.getName()); 48 49 private final ServiceEncoding _encoding; 50 51 public RpcServlet(ServiceEncoding encoding) 52 { 53 if (encoding == null) 54 throw new NullPointerException (); 55 56 _encoding = encoding; 57 } 58 59 public void service(ServletRequest request, ServletResponse response) 60 throws IOException , ServletException 61 { 62 try { 63 _encoding.invoke(request.getInputStream(), response.getOutputStream()); 64 } catch (IOException e) { 65 throw e; 66 } catch (ServletException e) { 67 throw e; 68 } catch (RuntimeException e) { 69 throw e; 70 } catch (Throwable e) { throw new ServletException (e); 72 } 73 } 74 } 75 | Popular Tags |