I guess one of the main problems is jumping from RemoteServiceServlet 
(setting session data), then handing control over to a 'standard' Servlet 
(which does db work, business logic, sets new session data and attempts to 
write, a now redundant?, response)... then jumping back in to the original 
RemoteServiceServlet and returning the original rpc call.

Btw - Im having problems formatting my posts here (using Firefox 42.0b9), I 
cant put spaces in between words in my post titles, apologies :]

Regards, Sam




On Friday, 19 February 2016 13:54:25 UTC, Sam Wootton wrote:
>
> ​
> ​Dear GWT Users,
>
> Many thanks in advance for any help and advice. Very much appreciated!
>
> I have a legacy application: java Swing client with XML based Servlet 
> communication (request and response).
>
> The server comprised of aro
> ​​
> und 10 Servlets, one 'Front Controller' that forwarded (RequestDispatcher
> ​ ) to other Servlets depending on the initial XML request from client.  
> These delegated Servlets did everything (parsed XML, db queries, session 
> data, etc).​
>
> I decided move java swing client to gwt. Also move from XML to gwt rpc.  
> Ideally I dont want to rewrite the whole server again (even thought it just 
> talks in XML / Strings).
>
> I thought I could just forward my request from my main 
> RemoteServiceServlet class, on to my 'legacy' XML servlets.
>
> What do I have so far?
>
> A working GWT client, making RPC calls to my RemoteServiceServlet.
> Successfully set session data and forward on to a e.g. LoginServlet.
> LoginServlet queries db and updates session data.
> Read updated session data in RemoteServiceServlet.
>
> For example:
>
> *RemoteServiceServlet*
> getThreadLocalRequest().getSession().setAttribute("username", username);
> requestDispatcher = 
> getThreadLocalRequest().getRequestDispatcher("/LoginServlet");
> requestDispatcher.forward(getThreadLocalRequest(), getThreadLocalResponse());
>
> *LoginServlet*
> String username = (String) session.getAttribute("username");
> // do some db stuff & set new session data
> session.setAttribute("userEmail", userEmail);
>
> *RemoteServiceServlet*
> getThreadLocalRequest().getSession().getAttribute("userEmail")
>
>
> This seems very convoluted and hacky, and not scalable for the amount of 
> work done in my 'legacy' servlets.  Is there a better way?
>
> Can I have multiple servlets extend RemoteServiceServlet?
> Whats the best way to implement a 'front controller' style architecture 
> with gwt?
> Whats the best way to integrated multiple legacy XML servlets with a GWT 
> facade / front controller?
> My legacy servlets just read and write a lot of XML, for example
>
> <MFRequest>
> <Request type='SaveSettings' data=''/>
> <UserPrefs download_pref='../' email_pref='yes' decompress_pref='no' 
> password_pref='no'/>
> </MFRequest>
>
>
> This thread was helpful
>
> https://groups.google.com/forum/#!topic/google-web-toolkit/kRmrirPsFC8
>  
> I have a lot of XML data, session data and file upload / download data 
> (hence have these split up in to different servlets).
>
> Anyway-  hope this gives an overall picture of my project / problem(s).
>
> Regards, Sam
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to