1 package net.sf.crispy.server; 2 3 import java.lang.reflect.Method; 4 5 import javax.servlet.http.HttpServlet; 6 import javax.servlet.http.HttpServletRequest; 7 import javax.servlet.http.HttpServletResponse; 8 9 import net.sf.crispy.InterceptorHandler; 10 11 /** 12 * A special implementation from a <code>ServiceEndpoint</code> for the http protocoll. 13 * 14 * @author Linke 15 * @since 1.1.0 16 */ 17 public class HttpServiceEndpoint extends HttpServlet implements ServiceEndpoint { 18 19 20 private static final long serialVersionUID = -1228902744637588027L; 21 22 private ServiceEndpoint serviceEndpoint = new ServiceEndpointImpl(); 23 24 25 public void setInterceptorHandlerCreator(InterceptorHandlerCreator pvCreator) { 26 serviceEndpoint.setInterceptorHandlerCreator(pvCreator); 27 } 28 29 public InterceptorHandlerCreator getInterceptorHandlerCreator() { 30 return serviceEndpoint.getInterceptorHandlerCreator(); 31 } 32 33 public final InterceptorHandler createNewInterceptorHandlerInstance() { 34 return serviceEndpoint.createNewInterceptorHandlerInstance(); 35 } 36 37 /** 38 * This is a alternative to the <code>Object getService(String pvServiceInterfaceName)</code> method. 39 * With this method you can use <i>SessionID</i> (<code>request.getSession().getId()</code>) 40 * for a service with scope equals <i>Session</i>. 41 * 42 * @param pvRequest 43 * @param pvResponse 44 * @return The service implementation. Default retun value is <code>null</code>. 45 * For a real service implementation must override this method. 46 */ 47 public Object getService(HttpServletRequest pvRequest, HttpServletResponse pvResponse) throws Exception { 48 return null; 49 } 50 51 public Object doInvoke(Object pvServiceImpl, Method pvMethod, Object[] pvArgs, InterceptorHandler pvInterceptorHandler) { 52 return serviceEndpoint.doInvoke(pvServiceImpl, pvMethod, pvArgs, pvInterceptorHandler); 53 } 54 55 }