Sunday, October 26, 2008
GWT & Comet Spring Integration
I'm making good progress integrating GWT & Comet with Spring. I just posted an update to the Spring by Example Web Module for a basic Spring GWT Controller and Spring Bayeux configuration for Comet on Jetty. Basically there is a Spring version of the Bayeux implementation and can configure it completely in Spring. Then it can be injected into BayeuxService implementations and there is a servlet that gets Bayeux from Spring instead of creating it. I think I'll possibly have a GWT version of the Dojo Comet Chat example soon.
Wednesday, October 22, 2008
Spring by Example RSS Feed
The Spring by Example main RSS feed has been updated to a new url, which is http://www.springbyexample.org/feed/. Before the feed was generated by the TWiki so it wasn't also including the static examples. Also, sometimes something on the TWiki was accidentally posted before it was ready and then stayed in a bad state on sites like Google Reader. The TWiki RSS feed is still active.
Spring by Example Update
I finally had time to update the example site and add a new module, but I've decided to start posting Spring by Example site specific postings on it's own blog (http://springbyexample.blogspot.com/). I'll use this blog for more about what I've been doing.
The new module is Custom ServletContext Scope Module. It let's you use Spring's custom scope to store beans in the web applications ServletContext. I needed this to refactor some old webapps that were sharing data using a static class and wanted to have them share the data in the ServletContext, but I don't have time to completely refactor them.
I also have a simple OSGi example using the Spring dm Server that I'll post and write up when I have time. Otherwise I've been putting a lot of time into working on GWT, Comet, and Spring integration. I'll eventually post more on this too when I get further along.
The new module is Custom ServletContext Scope Module. It let's you use Spring's custom scope to store beans in the web applications ServletContext. I needed this to refactor some old webapps that were sharing data using a static class and wanted to have them share the data in the ServletContext, but I don't have time to completely refactor them.
I also have a simple OSGi example using the Spring dm Server that I'll post and write up when I have time. Otherwise I've been putting a lot of time into working on GWT, Comet, and Spring integration. I'll eventually post more on this too when I get further along.
Saturday, October 11, 2008
Commons Configuration with Spring Modules
Tuesday, August 12, 2008
Spring by Example Content Update
I've updated all of the examples on Spring by Example by making them static content instead of being served in the TWiki. I think the formatting is improved and I think it will make maintaining things easier. The Spring by Example TWiki is still running and available for user contributions.
This is the first draft converting the content. If you find any errors or problems with any examples, please let me know.
This is the first draft converting the content. If you find any errors or problems with any examples, please let me know.
Monday, August 4, 2008
Spring Web Services Example
I ended up having time to finish up a really basic Spring Web Services example using JAXB for marshalling. It was very simple. Really once you have a project setup you will just have to focus on your XSD and business logic. It's nice having the marshalling/unmarshalling handled for you, but if the XML you're receiving becomes larger and you just need a specific part of it you can create a method that uses @XPathParam annotation in front of method variables to get a few values.
In the current example once everything is setup the client just has to make a call on the WebServiceTemplate passing in the request and receiving the response. Both are JAXB generated beans.
PersonResponse response =
(PersonResponse) wsTemplate.marshalSendAndReceive(request);
In the current example once everything is setup the client just has to make a call on the WebServiceTemplate passing in the request and receiving the response. Both are JAXB generated beans.
PersonResponse response =
(PersonResponse) wsTemplate.marshalSendAndReceive(request);
Saturday, August 2, 2008
Simple GWT Spring Webapp Example
I finally had time to finish up the GWT example I've been working on. I may add a bit more to it in the future (like an autocomplete search widget), but there is a lot there and should be helpful getting people started integrating GWT with Spring.
My general impression of using GWT is positive. It's definitely nice that you can work in Java and all the JavaScript is generated for you. Especially that it should perform well and work in different browers. It's a little tedious keeping everything in sync between the static servlet I use when running GWT in debug mode (avoids integrating Spring and injection into GWT debug) and the Spring controller. Also to have GWT use the main message resource for internationalization, a JavaScript object has to be maintained on the static HTML and JSP page (GWT debug vs. Spring webapp). It also wasn't obvious that if I made a bean to use with the main GWT entry point class that it had to be in the same package or a subpackage.
Also, as a side note, I have the person form working using Spring JS. It isn't too much work once I realized that it was working, but Spring Web Flow was refreshing the page afterword until I added at the end of the 'save' transition a render element specifying to only update the 'content' fragment. Otherwise only the 'onclick' attribute of the save button has to be modified.
<input type="submit" id="save"
name="_eventId_save" value="<fmt:message key="button.save">"
onclick="Spring.remoting.submitForm('save', 'person', {fragments:'content'}); return false;"/>
You currently can't specify a target div for returned fragments. I filed a JIRA (Enhance AjaxEventDecoration in Spring JS to specify a Target Div) to allow a targetId. Ideally it will be a list like fragments so you can specify what fragment goes with what div. I wanted to be able to have menu links refresh the content div without refreshing the entire page. Current funtionally assumes that you would just use AJAX for updates within functional areas. Like, I'm on the person page and want to just update the messages and personForm divs with fragments. So the fragment is expected to be wrapped in the div that is already is on the page and they are automatically matched up and updated. I think it will be a useful feature and hopefully will get added in an upcoming release.
My general impression of using GWT is positive. It's definitely nice that you can work in Java and all the JavaScript is generated for you. Especially that it should perform well and work in different browers. It's a little tedious keeping everything in sync between the static servlet I use when running GWT in debug mode (avoids integrating Spring and injection into GWT debug) and the Spring controller. Also to have GWT use the main message resource for internationalization, a JavaScript object has to be maintained on the static HTML and JSP page (GWT debug vs. Spring webapp). It also wasn't obvious that if I made a bean to use with the main GWT entry point class that it had to be in the same package or a subpackage.
Also, as a side note, I have the person form working using Spring JS. It isn't too much work once I realized that it was working, but Spring Web Flow was refreshing the page afterword until I added at the end of the 'save' transition a render element specifying to only update the 'content' fragment. Otherwise only the 'onclick' attribute of the save button has to be modified.
<input type="submit" id="save"
name="_eventId_save" value="<fmt:message key="button.save">"
onclick="Spring.remoting.submitForm('save', 'person', {fragments:'content'}); return false;"/>
You currently can't specify a target div for returned fragments. I filed a JIRA (Enhance AjaxEventDecoration in Spring JS to specify a Target Div) to allow a targetId. Ideally it will be a list like fragments so you can specify what fragment goes with what div. I wanted to be able to have menu links refresh the content div without refreshing the entire page. Current funtionally assumes that you would just use AJAX for updates within functional areas. Like, I'm on the person page and want to just update the messages and personForm divs with fragments. So the fragment is expected to be wrapped in the div that is already is on the page and they are automatically matched up and updated. I think it will be a useful feature and hopefully will get added in an upcoming release.
Labels:
gwt,
spring by example,
spring framework,
spring mvc,
tiles
Subscribe to:
Posts (Atom)