I don't know as I would do a redirect with all of them. There are a number of different ways I could potentially attack this. First, you could call a common starting internal pipeline:

<map:match pattern="internal-logging/**">
   <database stuff in here>
</map:match>

<map:match pattern="somepage">
   <map:generate src="cocoon:/internal-logging/somepage"/>
   <rest of pipeline>
</map:match>

I realize this takes up the precious generator spot in your pipeline, but is a possible solution I have used where I want all my pipelines to do something common. You still could use an aggregator if you wanted.

Another possibility is to use a transformer or an action and then reuse that in various pipelines.

<map:match pattern="somepage">
   <map:action type="mydatabase">
      <map:param name="page" value="somepage"/>
      <now do rest of pipeline>
   </map:action>
</map:match>

<map:match pattern="somepage">
   <map:generate src="whatever"/>
    <map:transform type="mydatabase"/>
   <rest of pipeline>
</map:match>

They both have pros and cons. With the transformer, you could do special tags that represent what you want logged and then just make sure they are in your XML pipeline going through the system. This is usually have I write something like that. In fact, if you piggybacked it on the SQLTransformer, then the mydatabase transformer could just be an XSL that sets up the SQL calls.

Hopefully this helps somewhat.

Irv

David Swearingen wrote:

I'm building a little logging system that will create a record in a database
anytime one of about 20 different pages on my site is hit.  So there are now
say 20 different map:matches for these pages.  I don't want to insert some
kind of database call (ESQL, Action, other) in each map:match pattern since
that isn't very elegant nor maintainable.  So I need suggestions on good
Cocoon patterns or best practices that allow "something" to happen for a
specific set of map:match's.

I'm thinking maybe if I slightly modify my existing 20 patterns to always
start the same, e.g. in this case with the 'mypages' path:

<map:match pattern="mypages/somepath/about_this_site.html>
<map:match pattern="mypages/somepath/management.html>
<map:match pattern="mypages/somepath/services.html>

then I could create an additional new match like this, that every request
would go through first:

<map:match pattern=mypages/**/*.html>
        do the database call
        <map:redirect-to uri="mypages/{1}/{2}.html"/>
</map:match>

And then the redirect would send the request on to the next proper match.

Will this work?  Is this the best way?

Thanks,
David


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to