Thank you Gilberto, good advice. Im not sure it will reduce work or achieve
the 'minimal' server rewrite (or rather maximal legacy reuse), but at least
it will be done properly.  I hadnt heard of RestyGWTbefore, so thanks.
I'll give your advice a go, and see where it takes me.

Regards, Sam

On 19 February 2016 at 18:35, Gilberto <gilberto.torre...@gmail.com> wrote:

> I don't think my comment will help you out, but in my opinion you
> shouldn't go to GWT RPC if you're rewriting the communication with the
> server. Go RESTful. Given the nature of your application, a pure RESTful
> structure can not be achieved, but at least you can start using REST
> frameworks, such as Jersey (on the server) and RestyGWT (on the client).
>
> I say that because I'm currently working on a project where I have to
> convert GWT RPC calls to REST calls, to enable the server to be called from
> native mobile apps. Trust me: I'd be happier if I had started RESTful since
> day 1.
>
> About the XML stuff: were you using SOAP? Or something else? Is the XML
> just the transport for the entity data? If so, you could replace it with
> JSON... without having to write the parsers for it. You get it for free
> when using Jersey or any other REST framework for Java.
>
>
> On Friday, February 19, 2016 at 3:18:44 PM UTC-2, Sam Wootton wrote:
>>
>> 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 a topic in the
> Google Groups "GWT Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-web-toolkit/rR0liCZDSl4/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
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