Thank you both for your answers and your attention. I apologize for my confusing post, I was trying to make it very simple and easy to read by not getting into too much detail but I guess it didn't turn up well.
So as I said my goal is to turn my single user webApp into a multiuser webApp. The client side webApp was developed using two key technologies, one is Cappuccino which is basically a compiler that translates Objective-J language (similar to Apple's Objective-C) into javascript and CP2JavaWS which is a a two part bridge written in Objective-J and
Java. The Objective-J parts are some classes that I must include in the client code and the Java part is basically a filter and a listener.
Locally what I do is basically create an Objective-J class or classes interfaces that declares the same methods as a the beans on the in the server, then I create a connection (by means of CP2JavaWS object) to one of the filters that is mapped to an address path and I call the remote method as if it was local, then CP2JavaWS translates the call into JSON and send it to server. The filter in the server intercepts the httpServletRequest, analyze the JSON
string, gets a Spring service factory from the servlet context, this factory then allocates an instance of a bean by calling getBean that matches the requested class, method and attributes from the intercepted httpServletRequest. Finally executes the method and returns to the client the method return value, again as JSON object.
There is already a primitive login authentication and authorization system and when the user logs in it does it by a an html form that POST to a servlet that checks the credentials and store a principal in the session.
There is a bean, is basically a POJO (sounds like
chicken in spanish ;) ) that needs that session in order to access the right DB schema.
I have a basic knowledge on how to get a session or the HttpServletRequest from filters, servlets, and even beans but in this case it is not working since I think the bean wasn't instantiated by a
jsp call but from a filter.
The only solution that comes to my mind is not pretty, is to pass the httpServletRequest or the session from the CP2JavaWS filter to the allocated bean but that will break the abstraction of CP2JavaWS.
The other idea doesn't have a knowledge foundation, I was imagining to somehow when I call the Spring context getBean method fake or pass the httpServletRequest to the Spring context so it thinks the bean allocation comes from a JSP request. That way I could call FacesContext and get the httpServletRequest or make the bean session aware or something more common.
I hope this new post makes more sense, I'm not a native english speaker.