Hi everybody, > I'm Pietro Grippa from Milan, Italy and I >would like to have your opinion about my business >need. >I've developed an application based on the XmlRpc >framework. I needed to save the user data, and the >first solution was to create an applicative session, >let's say a singleton where I've a Hashtable, I use >the user identifier as a key and I can save the user >data. >Now we need to use HttpSession to save user data, to >have the possibility to use Tomcat cluster. >So, what I need to know is if you're interested on my >contribution to modify the framework adding the possibility of using the http session management. >I would like to know your opinion about my idea. > >I developed a prototype for this purpose, introducing >the following features: > >Class XmlRpcServer >new method: >public byte[] execute(InputStream is,HttpSession ses) > { > return execute(is, new >DefaultXmlRpcContext(null, null, >getHandlerMapping(),ses)); > } > >Class DefaultXmlRpcContext >new field: >protected HttpSession ses = null; > >new constructor > public DefaultXmlRpcContext(String userName, String >password, XmlRpcHandlerMapping >handlerMapping,HttpSession ses) > { > this.userName = userName; > this.password = password; > this.handlerMapping = handlerMapping; > this.ses = ses; > } > >class XmlRpcWorker >modified method: > >protected static Object invokeHandler(Object handler, >XmlRpcRequest request, XmlRpcContext context) > throws Exception > { > long now = 0; > > try > { > System.out.println("handler invoked >"+handler.getClass().getName()); > if (XmlRpc.debug) > { > now = System.currentTimeMillis(); > } > if (handler == null) > { > throw new NullPointerException > ("Null handler passed to >XmlRpcWorker.invokeHandler"); > } > else if (handler instanceof >ContextXmlRpcHandler) > { > return ((ContextXmlRpcHandler) >handler).execute > (request.getMethodName(), >request.getParameters(), context); > } > else if (handler instanceof XmlRpcHandler) > { > System.out.println("XmlRpcHandler"); > return ((XmlRpcHandler) >handler).execute > (request.getMethodName(), >request.getParameters()); > }else if (handler instanceof >XmlRpcHandlerSession) > { > >System.out.println("XmlRpcHandlerSession"); > return ((XmlRpcHandlerSession) >handler).execute > (request.getMethodName(), >request.getParameters(),context.getSes()); > } > else if (handler instanceof >AuthenticatedXmlRpcHandler) > { > return ((AuthenticatedXmlRpcHandler) >handler) > .execute(request.getMethodName(), >request.getParameters(), > context.getUserName(), >context.getPassword()); > } > else > { > System.out.println("ERROR"); > throw new ClassCastException("Handler >class " + > >handler.getClass().getName() + > " is not a >valid XML-RPC handler"); > } > } > finally > { > if (XmlRpc.debug) > { > System.out.println("Spent " + >(System.currentTimeMillis() - now) > + " millis processing >request"); > } > } > } > > >new interface >public interface XmlRpcHandlerSession >{ > /** > * Return the result, or throw an Exception if >something went wrong. > */ > public Object execute (String method, Vector >params,HttpSession ses) > throws Exception; > >} > >On the client side I modified >XmlRpcClient > >a new field >protected String cooky = null; >with getter and setter > >and I modified XmlRpcClient.Worker.execute(String >s,Vector v) to add the cookie management > >I send you my prototype. > >Thanks for your attention > >Pietro Grippa > >===== >Pietro Grippa >333/7561992 > > > >___________________________________ >Nuovo Yahoo! Messenger: E' molto pià divertente: Audibles, Avatar, Webcam, Giochi, Rubricaâ Scaricalo ora! >http://it.messenger.yahoo.it