1 7 package org.jboss.test.remoting.transport.web; 8 9 import javax.management.MBeanServer ; 10 import org.jboss.remoting.InvocationRequest; 11 import org.jboss.remoting.ServerInvocationHandler; 12 import org.jboss.remoting.ServerInvoker; 13 import org.jboss.remoting.callback.InvokerCallbackHandler; 14 15 18 public class WebInvocationHandler implements ServerInvocationHandler 19 { 20 public static final String RESPONSE_VALUE = "This is the return to SampleInvocationHandler invocation"; 22 public static final ComplexObject OBJECT_RESPONSE_VALUE = new ComplexObject(5, "dub", false); 23 24 public static final String NULL_RETURN_PARAM = "return_null"; 25 public static final String OBJECT_RETURN_PARAM = "return_object"; 26 public static final String THROW_EXCEPTION_PARAM = "throw_exception"; 27 public static final String STRING_RETURN_PARAM = "return_string"; 28 public static final String HTML_PAGE_RESPONSE = "<html><head><title>Test HTML page</title></head><body>" + 29 "<h1>HTTP/Servlet Test HTML page</h1><p>This is a simple page served for test." + 30 "<p>Should show up in browser or via invoker client</body></html>"; 31 32 33 40 public Object invoke(InvocationRequest invocation) throws Throwable 41 { 42 System.out.println("Invocation request is: " + invocation.getParameter()); 44 if(NULL_RETURN_PARAM.equals(invocation.getParameter())) 45 { 46 return null; 47 } 48 else if(THROW_EXCEPTION_PARAM.equals(invocation.getParameter())) 49 { 50 throw new Exception ("This is an exception being thrown as part of test case. It is intentional."); 51 } 52 else if(invocation.getParameter() instanceof ComplexObject) 53 { 54 return OBJECT_RESPONSE_VALUE; 55 } 56 else if(STRING_RETURN_PARAM.equals(invocation.getParameter())) 57 { 58 return RESPONSE_VALUE; 60 } 61 else 62 { 63 return HTML_PAGE_RESPONSE; 64 } 65 } 66 67 73 public void addListener(InvokerCallbackHandler callbackHandler) 74 { 75 } 77 78 84 public void removeListener(InvokerCallbackHandler callbackHandler) 85 { 86 } 88 89 94 public void setMBeanServer(MBeanServer server) 95 { 96 } 98 99 104 public void setInvoker(ServerInvoker invoker) 105 { 106 } 108 109 } | Popular Tags |