Web Sockets in Spring MVC 3.2 and HTML5 - java

I want to use Web HTML5 sockets with Spring MVC. A few days ago I heard that Spring 3.2 release will come up with Web Sockets support for real time updates.
http://blog.springsource.org/2012/05/08/spring-mvc-3-2-preview-techniques-for-real-time-updates/
But still not able to find any sample code which provide me the facility of real time update. I am using Tomcat for this purpose now but want to shift to Spring. Please see if you can help me finding a very good example of to use Web HTML5 sockets with Spring MVC.

At the end of the blog post there's this paragraph:
Coming back to Spring MVC 3.2, the Servlet 3 async feature can be used for long-running requests and also for HTTP streaming, techniques Filip Hanik referred to as "the server version of client AJAX calls". As for WebSockets, there is no support yet in Spring 3.2 but it will most likely be included in Spring 3.3. You can watch SPR-9356 for progress updates.
So there is no support for WebSockets in Spring MVC 3.2. The [SPR-9356] issue says that the feature is in the Spring 4.0 backlog. 1

Related

Integration HDIV and restful APIs with Jersey

I have a Java Restful application that uses Jersey for the APIs implementation and that uses Spring for DI. I'm now trying to integrate HDIV for security.
However the official documentation has examples for the integration with Spring MVC, but not Restful Jersey applications.
Documentation here:
https://hdivsecurity.com/technical-documentation/doc.html
I read online that it's possible to integrate HDIV with REST, but I cannot exactly figure out how this is done, as I cannot find examples.
Does anyone know how this is done?
As you said Hdiv can be integrated with REST APIs, particularly RESTFul APIs that implements the whole REST specification, including Hypermedia or HATEOAS level (level 3 within Richarson model)
This REST support is included inside Hdiv Enterprise edition and that's why is not included in the link related to the technical documentation provided by you. The security level offered in that integration is exactly the same that we have been offering till now for server side MVC applications. It means that Hdiv can automate the protection against OWASP top 10 web risks in REST based applications .
Regarding JAX-RS support it can be possible if you are using the new hypermedia support included within JAX-RS 2/Java EE 7.
If you need more detail about the Hdiv support for RESTFul APIs you can review the slides presented in the last Spring I/O conference.
If you want to test within your project this support please contact using Hdiv support web form within hdivsecurity.com web site.
Regards,
Roberto Velasco

Spring 4 mvc + security for servlet 2.5 in JBoss5.1.0.GA

I want to use spring 4 with minimal xml configuration for the now new project I am about to develop. I will be using Spring in this project for dependency-injection, mvc, security and jdbc. I will use JOOQ for query generation. (Yes, I need to project to support Postgresql and oracle) (maybe, in future, this app will extended support for REST too). The problem I face now is my production application server is JBoss5.1.0.GA, which obviously does not support servlet 3.0. Now I have a working spring 4 mvc code base with servlet 2.5, but I could not figure out how to configure the security with java config. Because I see most of the examples on spring 4 on servlet 3.0+ versions, and very less not good examples on 2.5. Though I read the spring security from the spring website, it made little difference on implementing it. Have anyone implemented security (db/ldap) on servlet 2.5? Share with me your wisdom and experiences.
Spring security (I suppose version 3.2 as you speak of spring 4) works well on servlet 2.5, at least with xml config. I am not sure that you can use full java config for security, but I am sure annotations can be used for method security.

Implementing WebSocket in Java

I have a Spring MVC application. UI makes some asynchronous requests to back end. Backend processes the requests and sends the response. Current implementation is done with the help of queues and listeners.I want to replace it with Web Sockets.I understand that JDK 7 supports websockets out of the box. My application gets deployed on different servers like Tomcat 6.0, WebSphere Application Server etc. Would it make any difference?
Spring MVC does not support WebSocket so what is the work aorund?
There's no support for WebSockets in Spring 3.2 There's a log for it in Spring 4 here
There's also a blog post about how to use it in Spring 4 here
Spring released 4.0 GA which supports Websocket, tomcat 7.0.47+ will be required for the websocket implementation.
http://spring.io/blog/2013/12/12/announcing-spring-framework-4-0-ga-release

Using Spring HTTP invoker between difference versions of spring?

I have a server which uses spring 2.5.6 and currently my client spring mvc application are also using same version 2.5.6. I use httpinvoker for the connection between the two. I want to update and benefit of spring mvc 3, but I can not do anything with the server.
My questions is:
Will it work to use a different version of spring on the web-application than on the server-side?
And can this have side-effects that can cause problems?

Restlet vs Spring MVC for Restful web service

I'm researching how best to create a Restful web service on Google app engine. My end goal is to have an Android application call a web service on GAE to post and get data. At this point I not sure what the best approach is.
What I know at this point is Spring MVC 3 provide the ability to create web service but it does not provide a full implementation of JAX-RS. I also have read a few blog that talk about how Spring and Restlet can be integrated together. On the other side I have read that I could only use Restlet in GAE. I would also like provide a light web interface for users to view their posted data
So my questions are the following.
1. Should I just use Restlet.
2. Should I just use Spring MVC to provide my Restful web service.
3. Should I use Spring and Restlet together.
At this point I think I should invest my time in Restlet because that seems to be the best approach for calling web services in Android. I'm also debating if Spring MVC is just over kill.
Any thoughts would be helpful.
Have a look at the following similar questions:
Easiest frameworks to implement Java REST web services and Can anyone recommend a Java web framework that is based on MVC and supports REST?
I recently set up RESTlet on GAE and it was an absolute breeze! There are docs outlining the procedure on the RESTlet website and I was up and running RESTlet on GAE using the Google datastore within two hours.
The major downside is that performance of the Google data store for low volume apps is atrocious. Timeouts are not uncommon. (Google mandates a maximum 30 second request time and your app can easily take up half of that in coming out of hibernation if it hasn't been accessed recently)
Right now I am building another RESTful app and chose to go the Spring 3 MVC / Hibernate / MYSQL route. I am not new to Spring DI or MySQL, but I am new to Spring MVC and it is taking me days to work through all the issues I am encountering. I am disappointed in the quality of available documentation and I have not been able to find a reasonable and complete Spring 3 MVC RESTful CRUD tutorial anywhere. Argh.
I don't have experience with Restlet but Spring MVC 3.0 is quite powerful for building restful webservice AND webapps. So if you also plan for your service to be accessible through browsers then it is a great solution since your controllers can serve both apps and browsers.
Perhaps this is also possible with Restlet but I have not heard of its capabilities for building webapps.
Just beware that Spring has a high loading time. This means that you have to be careful to avoid slow responses from cold starts.

Categories