1 8 9 package mx4j.tools.remote.http; 10 11 import java.lang.reflect.Method ; 12 import java.lang.reflect.Proxy ; 13 import java.security.AccessControlContext ; 14 import java.util.Map ; 15 16 import javax.security.auth.Subject ; 17 18 import mx4j.tools.remote.SubjectInvoker; 19 20 23 public class HTTPSubjectInvoker extends SubjectInvoker 24 { 25 public static HTTPConnection newInstance(HTTPConnection target, Subject subject, AccessControlContext context, Map environment) 26 { 27 HTTPSubjectInvoker handler = new HTTPSubjectInvoker(target, subject, context, environment); 28 return (HTTPConnection)Proxy.newProxyInstance(target.getClass().getClassLoader(), new Class []{HTTPConnection.class}, handler); 29 } 30 31 private HTTPSubjectInvoker(HTTPConnection target, Subject subject, AccessControlContext context, Map environment) 32 { 33 super(target, subject, context, environment); 34 } 35 36 protected boolean isPlainInvoke(Method method) 37 { 38 boolean plain = super.isPlainInvoke(method); 39 if (plain) return plain; 40 41 String methodName = method.getName(); 42 if ("fetchNotifications".equals(methodName)) return true; 44 if ("close".equals(methodName)) return true; 45 return false; 46 } 47 } 48 | Popular Tags |