You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Patrick Heiden <pa...@gmx.de> on 2008/03/07 11:32:04 UTC
Help with Cocoon and Spring
Hello!
I am planning to use Cocoon 2.2 fur a huge web-application and use spring as service-layer together with hibernate for persistance. Both spring and hibernate are within my toolbox for a while, but after reading all tutorials from cocoon.apache.org (and the presentations, too) I am still not able to understand HOW spring is EXACTLY integrated within cocoon and how the combination of the three frameworks should look like for a production-suitable application (missing a sound getting-started-guide). After using mvn archetype:create ... for setting up an standard project-structure for web-apps I could not exactly imagine what configuration nedds to be put in certain place.
More details:
- imagine an application that consists of several pet-store-like facades
- each facade is responsible for processing several well defined requests (the data within them)
- to hook up this with SpringMVC I just define a DispatcherServlet and route through different views
- HOW should I port this to cocoon-context to use FlowControl/continuations as my controller?
- do I 'have to' use several blocks for my application? What I mean here is: a persistence-block, view-rendering-block, etc.. how does an elegant block-usage look like?
- how should the integration of hibernate should look like to enable the pooled connections to be used within flows (found hints for OpenSessionInView filters)
I recognized several opinions about cocoon-2.2 documentation and support. And my opinion is, that a better starting guide could help with above questions. BUT: I am not here to bother anybody! I think you build a nice framework (have some experience with 2.1) and I am not afraid of steep learning curves. I think above questions are within context of first implementation-design and I miss the basic theory behind your ideas and/or usage-scenarios.
Looking forward to answeres with best regards,
Patrick
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Patrick Heiden <pa...@gmx.de>.
Hello!
> > But in addition to my concerns about a final
> deployable war of my webapp,
> > what should I do to deactivate jetty and rcl within my
> production-environment (wich is going to
> > be Tomcat). This has of course security reasons and should keep my war
> as small as possible. Is
> > this the point, where maven running-modes come into play? Are there
> archetypes to set up such an
> > project-hierarchy, maybe including the src/test -setup as well? If those
> solutions already exists
> > I suggest to extend your video and put them right there!
>
> It's a job of webapp (created from webapp archetype) to assemble final,
> production-ready WAR package
> that is clean of RCL dependencies, Jetty dependencies, etc. So apart from
> creating webapp and
> declaring dependencies on your blocks you don't have to do anything more.
> The rest belongs to us and
> Maven.
>
> As I promised, I'll try to officially this video shortly.
Great! Your answer also wiped out my tangled thoughts about packaging final wars. Maybe you could explain one more thing to me: What is actually achieved by the following statement within a blocks rcl.properties file
%exclude-lib=com.mycompany:myBlock2
Thank you very much,
again!
Greetings
Patrick
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Patrick Heiden pisze:
> [...] Already back!
>
>> I would like to suggest you two nice readings which could probably help you understand better
>> Cocoon's architecture and avoid common pitfalls:
>> http://article.gmane.org/gmane.text.xml.cocoon.devel/74571
>> http://thread.gmane.org/gmane.text.xml.cocoon.user/63219 (excellent discussion with Rainer
>> Pruy)
>>
>> Oh, and in your spare time you could probably take a look at this screencast:
>> http://people.apache.org/~gkossakowski/cocoon-tutorial-rcl-2.html (I plan to move it to our
>> main site as soon as I have some free time)
>
> I've just finished watching your rcl-tut-video. Nice work and good starting point to let users
> know about rcl. This should definitely go to user-documentation! Also this could make the point
> clear, that users are able to use the IDE they want to (in my case there is just vim during my
> last developer-years ;) But in addition to my concerns about a final deployable war of my webapp,
> what should I do to deactivate jetty and rcl within my production-environment (wich is going to
> be Tomcat). This has of course security reasons and should keep my war as small as possible. Is
> this the point, where maven running-modes come into play? Are there archetypes to set up such an
> project-hierarchy, maybe including the src/test -setup as well? If those solutions already exists
> I suggest to extend your video and put them right there!
It's a job of webapp (created from webapp archetype) to assemble final, production-ready WAR package
that is clean of RCL dependencies, Jetty dependencies, etc. So apart from creating webapp and
declaring dependencies on your blocks you don't have to do anything more. The rest belongs to us and
Maven.
As I promised, I'll try to officially this video shortly.
--
Grzegorz Kossakowski
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Patrick Heiden <pa...@gmx.de>.
[...]
Already back!
> I would like to suggest you two nice readings which could probably help
> you understand better
> Cocoon's architecture and avoid common pitfalls:
> http://article.gmane.org/gmane.text.xml.cocoon.devel/74571
> http://thread.gmane.org/gmane.text.xml.cocoon.user/63219 (excellent
> discussion with Rainer Pruy)
>
> Oh, and in your spare time you could probably take a look at this
> screencast:
> http://people.apache.org/~gkossakowski/cocoon-tutorial-rcl-2.html (I plan
> to move it to our main
> site as soon as I have some free time)
I've just finished watching your rcl-tut-video. Nice work and good starting point to let users know about rcl. This should definitely go to user-documentation! Also this could make the point clear, that users are able to use the IDE they want to (in my case there is just vim during my last developer-years ;)
But in addition to my concerns about a final deployable war of my webapp, what should I do to deactivate jetty and rcl within my production-environment (wich is going to be Tomcat). This has of course security reasons and should keep my war as small as possible. Is this the point, where maven running-modes come into play? Are there archetypes to set up such an project-hierarchy, maybe including the src/test -setup as well? If those solutions already exists I suggest to extend your video and put them right there!
Thank you - will read the rest know!
Patrick
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Patrick Heiden <pa...@gmx.de>.
[...]
> I would like to suggest you two nice readings which could probably help
> you understand better
> Cocoon's architecture and avoid common pitfalls:
> http://article.gmane.org/gmane.text.xml.cocoon.devel/74571
> http://thread.gmane.org/gmane.text.xml.cocoon.user/63219 (excellent
> discussion with Rainer Pruy)
Just finished reading the first article above. Very usefull information!! I think I will step back a little by reading "Core Java Servlets.." again followed by another reading of that nice article. Will then return with results obtained by that!
Patrick
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Patrick Heiden pisze:
>
>
> To get this clear: Step 1 to N is creating Blocks 1 to N (some of them are shared). Then I just create 'my-webapp' with maven archetype. Block-wiring is done through servlet-service-configuration-files (pom.xml, servlet-service.xml). Usage of the wired blocks is defined through sitemaps and I am able to define global beans within webApplicationContext.xml and 'block'-specific (local) beans within META-INF/cocoon/spring/*-context.xml.
> And thats it?
> Wow!
Almost. ;-)
As I said earlier current implementation of Spring integration is little bit simplistic because
there is only one global Spring container and no block-specific ones. So even if you declare bean in
a block's configuration file it will be visible everywhere. However, you should be warned that it's
not our aim and this will be changed in the future so you should not rely on such implementation
detail and always declare dependencies correctly.
Moreover, almost always you should not touch contents of my-webapp module (especially: not add any
bean declarations there) because it should be considered as a glue and infrastructure module. It
contains all necessary configuration for Maven to make a deployable WAR package and usually its the
only function, in a fact.
--
Grzegorz Kossakowski
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Patrick Heiden <pa...@gmx.de>.
-------- Original-Nachricht --------
> Datum: Sat, 08 Mar 2008 19:37:20 +0100
> Von: Grzegorz Kossakowski <gr...@tuffmail.com>
> An: users@cocoon.apache.org
> Betreff: Re: Help with Cocoon and Spring
> Patrick Heiden pisze:
> > Hello again!
> > First of all: Big compliment for such an active users-list!
>
> Thanks! :)
>
> > [...]
> > To get a bit more specific I am trying to explain what my architecture
> > would/should look like at this state of my cocoon-knowledge. I assume,
> that basic idea
> > behind cocoon-blocks is about to create different parts of an
> application and
> > connect those parts for interoperability. So as you suggested to first
> > establish basic routings, my way would exactly be to split (separable)
> functionality
> > through different blocks.
>
> Right.
>
[...]
> > Following little illustration should make clear what I
> want
> > to achieve:
> >
> > (after login)
> > -------------------> [rootBlock]
> > | (generates)
> > +-- main-site --+ |
> > | |<--------+
> > | hello user |
> > +---------------+
> > | (next request)
> > |
> > | (uses)
> > +---------> [block foo] ---------->[rootBlock]
> > | (generates)
> > +-- main-site --+ |
> > | |<--------+
> > | hello user |
> > | |
> > | block foo- |
> > | content |
> > +---------------+
> >
> > and so on.
>
> Oh, your picture is much better. It clearly suggests that the it's
> specific block that generates its
> response to browser and only uses some shared functionality from
> rootBlock. That is kind of design I
> firmly advise.
>
THANKS !! [1]
> > Therby each block would define its own flow-scripts to reach some
> > part of the domainmodel or global services.
> > Is this way advisable, or are there even simpler ways within cocoons
> > block-context? Asuming, that all blocks are ready to use, there has to
> be a
> > main webApplicationContext (e.g. within rootBlock?), where I put all
> beans for
> > global usage (db-pooling, userManager and the like).
>
> You should put such stuff to shared block and make other blocks depend on
> it. Actually, current
> implementation is little bit simplistic in this area because there is only
> one Spring's application
> context (bean container) so even if you don't declare dependencies (in
> Maven's POM file) correctly
> you will be able to use beans from other blocks. However, it's certainly a
> bad practice, because
> Cocoon could eventually implement real block isolation in the near future.
>
I would say, that I had the same idea about 'sharedBlock', but my naming (rootBlock) sugests wrong usage-scenario!
> If you are wonder who is setting up this global application context: it's
> job of webapp module
> (generate from archetype) which is used for packaging Cocoon blocks in a
> one Webappliction ready to
> be used in servlet container like Tomcat or Jetty. Anyway, you shouldn't
> bother about such details
> too much. Your job, as Cocoon user, is to create blocks, declare
> dependencies between them and
> develop all the functionality in blocks.
>
To get this clear: Step 1 to N is creating Blocks 1 to N (some of them are shared). Then I just create 'my-webapp' with maven archetype. Block-wiring is done through servlet-service-configuration-files (pom.xml, servlet-service.xml). Usage of the wired blocks is defined through sitemaps and I am able to define global beans within webApplicationContext.xml and 'block'-specific (local) beans within META-INF/cocoon/spring/*-context.xml.
And thats it?
Wow!
> > So how should
> > configuration look like to get all blocks interoperate the above way?
> You may
> > think - and it would be right - that I am still a bit confused on how to
> put
> > blocks inside the game. But maybe after all that explanation you are in
> better
> > position to guide me towards better usage of cocoon.
>
> As I said, you don't need to configure too much. Just declare dependencies
> between blocks in Maven's
> POM file and you are done. If you want to use pipelines from other blocks,
> you will need to connect
> to other blocks' servlets but you already know how to do this.
>
> I would like to suggest you two nice readings which could probably help
> you understand better
> Cocoon's architecture and avoid common pitfalls:
> http://article.gmane.org/gmane.text.xml.cocoon.devel/74571
> http://thread.gmane.org/gmane.text.xml.cocoon.user/63219 (excellent
> discussion with Rainer Pruy)
>
> Oh, and in your spare time you could probably take a look at this
> screencast:
> http://people.apache.org/~gkossakowski/cocoon-tutorial-rcl-2.html (I plan
> to move it to our main
> site as soon as I have some free time)
I will check all of your references and reply as far as I am ready with this! Hopefully those links will wipe out my thoughts about what's definitely beeing packed inside a final an deployable war. At this point this is something I am not clear with, because every block has it's own dependencies shiped as complere block-foo.jar. So there maybe some overlapping, e.g. block foo and block bar could have equal dependencies during usage of the cocoon-forms block and some block-specific one, such as what-ever-i-need-to-do-my-block-job.jar.
I think that this point will become clear next hours/days.
I could not thank you enough for supporting my first steps with cocoon-2.2, you've really flattened my learning curve!
Greetings
Patrick
[1]http://en.wikipedia.org/wiki/A_picture_is_worth_a_thousand_words
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Patrick Heiden <pa...@gmx.de>.
[...]
> I would like to suggest you two nice readings which could probably help
> you understand better
> Cocoon's architecture and avoid common pitfalls:
> http://article.gmane.org/gmane.text.xml.cocoon.devel/74571
> http://thread.gmane.org/gmane.text.xml.cocoon.user/63219 (excellent
> discussion with Rainer Pruy)
Actually I was not able to finish the day before reading the second article!
What I think kicks me further a huge step was your following cite out of that article:
--[...]
However, in your case the call to A is not about asking a data. In fact, it's delegation of the
_control_ because it depends on A block implementation how sequence of browser-server interactions
will look like. In such scenario block M is redundant (as being only dumb proxy) and breaks
cleanness of the design. I think that the best practise is always keep control layer in a one block,
and it should always be the one handling browser's request directly. I think following such rule
guarantees clear, easy to maintain code.
--[...]
I think that this is what you were trying to tell me about seperation of concerns in context if first implementation-design. My road now looks like that:
Create a global shared block as main controller (e.g. 'containing' the 'facades' of several sub-modules as accordingly sub-controllers/blocks). From there it is easy and straight forward to establish connections to other servlets/*blocks* wich enrich the (sub-) controller by their rendering-pipelines. So what you did by integrating spring into cocoon is to take springs ability of AOP into the context of servlets (I am aware of the fact that AOP was not introduced by spring ;). So cocoon 2.2 gives architects/developers the chance of designing their applications controllers in a cross-cutting-concerns-like way. That means, that it is possible to arrange web-layer-functionality like (e.g.)
- file uploadings
- form processings
- pdf-creation (view-rendering in general if you want so)
- ..
in a somewhat orthogonal way and use those 'generic' pipelines to process a users request generating the final response/view.
That is of course only abstract understanding (and hopefully not that far away from the truth) and I will put those thoughts into action.. tomorrow!
Patrick
--
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games!
http://games.entertainment.gmx.net/de/entertainment/games/free
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Patrick Heiden pisze:
> Hello again!
> First of all: Big compliment for such an active users-list!
Thanks! :)
> [...]
> To get a bit more specific I am trying to explain what my architecture
> would/should look like at this state of my cocoon-knowledge. I assume, that basic idea
> behind cocoon-blocks is about to create different parts of an application and
> connect those parts for interoperability. So as you suggested to first
> establish basic routings, my way would exactly be to split (separable) functionality
> through different blocks.
Right.
> As far as I can see, there should be some kind of
> 'rootBlock', where I put basic site-rendering.
It shouldn't be root and shouldn't be called root. I mean, you should almost always not have any
root block, each block should process browser's request directly. For site rendering I would suggest
"shared" block because other block will use it's basic rendering capabilities in order to generate
full response with block's specific content.
> Directory structure would look like this:
>
> ./myProject
> |-- (maybe) loginBlock
> |-- rootBlock
> |-- block 1
> |-- block 2
> |-- ...
> |-- block N
>
> So maybe after users have logged in via some login-form (wich I would make as
> seperate block as well), they will be routed to my rootBlock. The specific
> sitemap for that block would contain pipelines to render the main-site.
Main site and shared rendering capabilities should be separated.
> After users decision for using a specific app-part in some of the other blocks (by
> clicking some link) the sitemap of that block would be engaged to render
> specific response-content. The trick should be, that this specific block is
> able to use the already defined pipelines from my rootBlock, rendering the
> main-site first. Following little illustration should make clear what I want
> to achieve:
>
> (after login)
> -------------------> [rootBlock]
> | (generates)
> +-- main-site --+ |
> | |<--------+
> | hello user |
> +---------------+
> | (next request)
> |
> | (uses)
> +---------> [block foo] ---------->[rootBlock]
> | (generates)
> +-- main-site --+ |
> | |<--------+
> | hello user |
> | |
> | block foo- |
> | content |
> +---------------+
>
> and so on.
Oh, your picture is much better. It clearly suggests that the it's specific block that generates its
response to browser and only uses some shared functionality from rootBlock. That is kind of design I
firmly advise.
> Therby each block would define its own flow-scripts to reach some
> part of the domainmodel or global services.
> Is this way advisable, or are there even simpler ways within cocoons
> block-context? Asuming, that all blocks are ready to use, there has to be a
> main webApplicationContext (e.g. within rootBlock?), where I put all beans for
> global usage (db-pooling, userManager and the like).
You should put such stuff to shared block and make other blocks depend on it. Actually, current
implementation is little bit simplistic in this area because there is only one Spring's application
context (bean container) so even if you don't declare dependencies (in Maven's POM file) correctly
you will be able to use beans from other blocks. However, it's certainly a bad practice, because
Cocoon could eventually implement real block isolation in the near future.
If you are wonder who is setting up this global application context: it's job of webapp module
(generate from archetype) which is used for packaging Cocoon blocks in a one Webappliction ready to
be used in servlet container like Tomcat or Jetty. Anyway, you shouldn't bother about such details
too much. Your job, as Cocoon user, is to create blocks, declare dependencies between them and
develop all the functionality in blocks.
> So how should
> configuration look like to get all blocks interoperate the above way? You may
> think - and it would be right - that I am still a bit confused on how to put
> blocks inside the game. But maybe after all that explanation you are in better
> position to guide me towards better usage of cocoon.
As I said, you don't need to configure too much. Just declare dependencies between blocks in Maven's
POM file and you are done. If you want to use pipelines from other blocks, you will need to connect
to other blocks' servlets but you already know how to do this.
I would like to suggest you two nice readings which could probably help you understand better
Cocoon's architecture and avoid common pitfalls:
http://article.gmane.org/gmane.text.xml.cocoon.devel/74571
http://thread.gmane.org/gmane.text.xml.cocoon.user/63219 (excellent discussion with Rainer Pruy)
Oh, and in your spare time you could probably take a look at this screencast:
http://people.apache.org/~gkossakowski/cocoon-tutorial-rcl-2.html (I plan to move it to our main
site as soon as I have some free time)
--
Grzegorz Kossakowski
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Patrick Heiden <pa...@gmx.de>.
Hello again!
First of all: Big compliment for such an active users-list!
[...]
> I could not exactly imagine what configuration nedds to be put in certain
> place.
> > More details:
> > - imagine an application that consists of several pet-store-like facades
> > - each facade is responsible for processing several well defined
> requests (the data within them)
>
> It maps to several separate blocks each containing SitemapServlet mounted
> at certain path. Each
> block can be created using archetype and you will already find default
> configuration of SitemapServlet.
>
> > - to hook up this with SpringMVC I just define a DispatcherServlet and
> route through different views
>
> We have DispatcherServlet too but you don't need to bother about it, just
> create servlet beans
> declarations in a file placed at /META-INF/cocoon/spring/*.xml of your
> block, see[1]. Routing to
> servlet beans is done basing on mount-path attribute.
>
> > - HOW should I port this to cocoon-context to use
> FlowControl/continuations as my controller?
>
> Once you define high-level routings to your separate SitemapServlet you
> just need to create matchers
> in your sitemap file tied to concrete SitemapServlet and call FlowControl
> functions.
>
> > - do I 'have to' use several blocks for my application? What I mean here
> is: a persistence-block, view-rendering-block, etc.. how does an elegant
> block-usage look like?
>
> It's advised to have several blocks if your application can be split into
> separate structure units.
>
> > - how should the integration of hibernate should look like to enable the
> pooled connections to be used within flows (found hints for
> OpenSessionInView filters)
>
> It's more question for Spring usage than Cocoon usage. You need to check
> documentation of Spring to
> see how to configure connection pooling.
[...]
> I hope I'll be able to help you more once you came with more concrete
> problems. Feel free to ask
> more questions.
[...]
To get a bit more specific I am trying to explain what my architecture
would/should look like at this state of my cocoon-knowledge. I assume, that basic idea
behind cocoon-blocks is about to create different parts of an application and
connect those parts for interoperability. So as you suggested to first
establish basic routings, my way would exactly be to split (separable) functionality
through different blocks. As far as I can see, there should be some kind of
'rootBlock', where I put basic site-rendering.
Directory structure would look like this:
./myProject
|-- (maybe) loginBlock
|-- rootBlock
|-- block 1
|-- block 2
|-- ...
|-- block N
So maybe after users have logged in via some login-form (wich I would make as
seperate block as well), they will be routed to my rootBlock. The specific
sitemap for that block would contain pipelines to render the main-site.
After users decision for using a specific app-part in some of the other blocks (by
clicking some link) the sitemap of that block would be engaged to render
specific response-content. The trick should be, that this specific block is
able to use the already defined pipelines from my rootBlock, rendering the
main-site first. Following little illustration should make clear what I want
to achieve:
(after login)
-------------------> [rootBlock]
| (generates)
+-- main-site --+ |
| |<--------+
| hello user |
+---------------+
| (next request)
|
| (uses)
+---------> [block foo] ---------->[rootBlock]
| (generates)
+-- main-site --+ |
| |<--------+
| hello user |
| |
| block foo- |
| content |
+---------------+
and so on. Therby each block would define its own flow-scripts to reach some
part of the domainmodel or global services.
Is this way advisable, or are there even simpler ways within cocoons
block-context? Asuming, that all blocks are ready to use, there has to be a
main webApplicationContext (e.g. within rootBlock?), where I put all beans for
global usage (db-pooling, userManager and the like). So how should
configuration look like to get all blocks interoperate the above way? You may
think - and it would be right - that I am still a bit confused on how to put
blocks inside the game. But maybe after all that explanation you are in better
position to guide me towards better usage of cocoon.
Regards
Patrick
--
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games!
http://games.entertainment.gmx.net/de/entertainment/games/free
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Help with Cocoon and Spring
Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Patrick Heiden pisze:
> Hello!
>
> I am planning to use Cocoon 2.2 fur a huge web-application and use spring as service-layer together with hibernate for persistance. Both spring and hibernate are within my toolbox for a while, but after reading all tutorials from cocoon.apache.org (and the presentations, too) I am still not able to understand HOW spring is EXACTLY integrated within cocoon and how the combination of the three frameworks should look like for a production-suitable application (missing a sound getting-started-guide). After using mvn archetype:create ... for setting up an standard project-structure for web-apps I could not exactly imagine what configuration nedds to be put in certain place.
> More details:
> - imagine an application that consists of several pet-store-like facades
> - each facade is responsible for processing several well defined requests (the data within them)
It maps to several separate blocks each containing SitemapServlet mounted at certain path. Each
block can be created using archetype and you will already find default configuration of SitemapServlet.
> - to hook up this with SpringMVC I just define a DispatcherServlet and route through different views
We have DispatcherServlet too but you don't need to bother about it, just create servlet beans
declarations in a file placed at /META-INF/cocoon/spring/*.xml of your block, see[1]. Routing to
servlet beans is done basing on mount-path attribute.
> - HOW should I port this to cocoon-context to use FlowControl/continuations as my controller?
Once you define high-level routings to your separate SitemapServlet you just need to create matchers
in your sitemap file tied to concrete SitemapServlet and call FlowControl functions.
> - do I 'have to' use several blocks for my application? What I mean here is: a persistence-block, view-rendering-block, etc.. how does an elegant block-usage look like?
It's advised to have several blocks if your application can be split into separate structure units.
> - how should the integration of hibernate should look like to enable the pooled connections to be used within flows (found hints for OpenSessionInView filters)
It's more question for Spring usage than Cocoon usage. You need to check documentation of Spring to
see how to configure connection pooling.
> I recognized several opinions about cocoon-2.2 documentation and support. And my opinion is, that a better starting guide could help with above questions. BUT: I am not here to bother anybody! I think you build a nice framework (have some experience with 2.1) and I am not afraid of steep learning curves. I think above questions are within context of first implementation-design and I miss the basic theory behind your ideas and/or usage-scenarios.
I hope I'll be able to help you more once you came with more concrete problems. Feel free to ask
more questions.
> Looking forward to answeres with best regards,
> Patrick
[1] http://cocoon.apache.org/2.2/core-modules/core/2.2/1263_1_1.html
--
Best regards,
Grzegorz Kossakowski (who eventually went back online)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org