Filippo,

You are on an interesting task. IIRC, few months back, you were on search
for a best web framework for OSGi. Looks like you settled with Spring MVC.

<OT>
Last year, I did slices similar work with JSF, but it was not very neat (may
be if I put some more effort I can make it),  there my integration with
Spring WebFlow was a blocking stone, that did not mesh directly with OSGi
slices concept (I used to call them web-modules), and we had to implement
our own flow handler. But right ow due to other project priorities, I have
given up that task. But by looking at your work, it seems similar
</OT>


On Mon, Oct 19, 2009 at 9:00 PM, Filippo Diotalevi <
[email protected]> wrote:

> Hi,
>  I'm trying to write a modular Spring MVC web app, where I can
> install/uninstall new "pages" at runtime, to be run with Pax Web.
>
> Of course that's simple with PaxWeb (whiteboard-ext) and plain
> servlets, but I'm wondering if anybody is trying to do that with
> Spring MVC. The suggestion, on Spring side, is to use Slices [1],
> which is however tied to the Spring DM server.
>
> In theory it shouldn't be that complicated. In the most simple
> approach, one would need
> - an HandleMapper, that takes an URL and maps it with a Controller
> (that can be instantiated in any bundle)
> - a ViewResolver, that takes a view name and maps it with a file (say,
> a JSP) contained in one of the bundles
>
> I've implemented the HandleMapper, a simple implementation is quite
> straightforward, using the whiteboard pattern (exactly how pax
> whiteboard does). Any bundle can publish a Controller service, with a
> property "alias" defining the URL it must be mapped to. Then, when a
> request comes, the HandleMapper just look in the service registry for
> a Controller with the right alias.
>
> Moving to the second part, I'm not sure how to do the mapping between
> a view name and a file. What's the best approach here?
> Should I publish a File object in the service registry, with a
> "view-name" property defining the view it must be mapped to? Not so
> sure here.
>

I have not worked on Spring MVC, however,  I too had to do a similar thing -
mapping view-name to a file. From my experience, the best way would be to
include a namespace convention in your view names. The namespace couold be
for the simplest case be the bundle symbolic name (version if you require,
or rather give the logic of picking up the version as a configuration)

eg.  dashboard for a customer screen --->  myapp-customer-dashboard.do
dashboard for admin screen --> myapp-admin-dashboard.do

And not sure how you are picking up the view file itself from the bundle,
because again that may need a convention, that you can device again sith the
simplest case being bundle symbolic name, or else chose the java package
name itself.

Not sure if you could get my point, and if this is what you need. Let me
know if you want any clarifications

HTH



>
> Does anybody have tried to write a similar application? wdyt?
>
> [1] http://forum.springsource.org/showthread.php?t=75771&highlight=spring
>
> Many thanks,
> --
> Filippo Diotalevi
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>



-- 
-- 
Thanks and Regards,
/Thomas Joseph

LinkedIn: http://www.linkedin.com/in/ethomasjoseph
Twitter: http://twitter.com/ethomasjoseph
Blog: http://openthoughtworks.blogspot.com

------------------------------------------------------------
Promote Open Source - Promote Liberty of Ideas and Software.
------------------------------------------------------------
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to