01: package net.sf.crispy.server;
02:
03: import java.lang.reflect.Method;
04:
05: import javax.servlet.http.HttpServlet;
06: import javax.servlet.http.HttpServletRequest;
07: import javax.servlet.http.HttpServletResponse;
08:
09: 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
18: ServiceEndpoint {
19:
20: private static final long serialVersionUID = -1228902744637588027L;
21:
22: private ServiceEndpoint serviceEndpoint = new ServiceEndpointImpl();
23:
24: public void setInterceptorHandlerCreator(
25: 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,
48: HttpServletResponse pvResponse) throws Exception {
49: return null;
50: }
51:
52: public Object doInvoke(Object pvServiceImpl, Method pvMethod,
53: Object[] pvArgs, InterceptorHandler pvInterceptorHandler) {
54: return serviceEndpoint.doInvoke(pvServiceImpl, pvMethod,
55: pvArgs, pvInterceptorHandler);
56: }
57:
58: }
|