[opencms-dev] OpenCms and Spring MVC - Is the Integration worth it?

Ludwig Hunecke ludwig.hunecke at hushmail.com
Wed Jul 11 00:18:44 CEST 2012


Hi Marc,

I can totally understand the developer's concerns regarding the integration
of logic into JSPs etc.
On the other hand I think that the combination of different architectures
(OpenCms / Spring MVC) in one single application is a constant source for
complications, in particular in the long term regarding upgrades etc.

We also had the requirement to extend the CMS application by quite some
extensive logic.
In order to gain both benefits to not develop old-style JSP stuff and being
based on modern web technologies (in our case Grails) we implemented
following approach:

Spring MVC is hosted in a separate standalone web application (in our case
also on a different application server). The integration of Spring MVC into
OpenCms is basically done via AJAX. This means:
OpenCms (i.e. a formatter JSP) makes a $.ajax(...) jQuery call to load the
initial view of the Spring MVC application. The result is stored into a DIV
inside the OpenCms web page. Now the integration of an external Spring
application into the OpenCms based web page is basically already done. The
navigation inside the Spring MVC application is now done exclusively via
AJAX. This means, inside the Spring application you cannot use normal links
(otherwise you would leave the OpenCms web page). All navigation is done via
AJAX requests. In our case each AJAX request delivers a HTML snippet, which
is simple placed into the current page.

In order to call back from Spring MVC to OpenCms, we implemented Apache CXF
based JAX-RS (REST) webservices in OpenCms. The services provide basic
functions in order to CRUD contents.
In order to have no hassle with any XML generation, we implemented JAXB/XSLT
based transformations of JPA entities into content types. This works quite
nice, and gives the possibility to transform Java POJOS into XML content.

Authorization / Authentication is done via a Spring Security Auth Provider
which connects to OpenCms (via the JAX-RS Web Services). Using this
approach, it's also possible to use @Secured("ROLE_ROOT_ADMIN") annotations
e.g. inside the Spring MVC application.


Maybe the explanation was a bit rough but I hope it gives at least some
inspiration.


All the best,
Ludwig

-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Marc Fasel
Gesendet: Dienstag, 10. Juli 2012 07:54
An: opencms-dev at opencms.org
Betreff: Re: [opencms-dev] OpenCms and Spring MVC - Is the Integration worth
it?


Hi,

I am working with Bryan on the OpenCMS/ Spring MVC integration. Looking at
Mathias sample project I have been able to get the URL rewrite stuff working
so that the the Spring MVC dispatcher servlet is called before rendering a
Spring-enabled OpenCMS resource. That's good.

Now we have the requirement to allow moving around and renaming those
Spring-enabled OpenCMS resources without having to reconfigure Spring by
hand. I think this is possible but will take some effort. 

Considering that the URL rewrite stuff is already a bit hacky, and that
moving and renaming static OpenCMS resources created a new challenge for the
integration of Spring MVC and OpenCMS: Is this integration really worth it?
I am sure the next challenge is already waiting around the corner.

All our developers dislike putting controller logic in the JSPs, and would
like to see Spring MVC be integrated with OpenCMS, but if those two
technologies don't really match up well I don't think it is a good idea. I
would like to hear some thoughts of those who are using Spring MVC with
OpenCMS. How useful do you find it? What do you loose by using Spring MVC
with OpensCMS?

Cheers

Marc
Senior Consultant
Shine Technologies
Flybuys Loyalty
www.shinetech.com


Steve Bryan-2 wrote:
> 
> Hi
> 
> We have an OpenCms/Spring MVC integration, with controllers forwarding 
> to OpenCms xmlpage resources for the view.
> 
> When clicking directly on the resources on the GUI, and using direct 
> edit, the resulting page preview breaks since the URL of the 
> controller differs from the OpenCms resource url. Has anyone 
> experienced this and could suggest a fix or work around?
> 
> Thanks
> --
> Steve Bryan
> Senior Consultant
> Shine Technologies
> Flybuys Loyalty
> www.shinetech.com
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list To change 
> your list options, or to unsubscribe from the list, please visit 
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
> 
> 
> 
> 
> 

--
View this message in context:
http://old.nabble.com/OpenCms-and-Spring-MVC---preview-and-direct-edit-of-re
sources-tp34132023p34137883.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.

_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your
list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev








More information about the opencms-dev mailing list