Re: How to configure TraxProcessor in 2.2?

2019-12-05 Thread Javier Puerto
Hi Mark,

I recommend you to use the Spring configuration. I never had this
requirement before but by the error message and the configuration fragment
that you have sent the NPE is caused because you are not passing an
instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
passing a String instead.



IIRC you should change it to:

  


The attribute "value" is for literal values. You can also define the bean
with an ID and then use the attribute "ref" with the ID of the bean.
I hope that helps.

Salu2.

El mié., 4 dic. 2019 a las 22:46, Mark H. Wood () escribió:

> I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
> factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> advice I've found in several places around the Web doesn't seem to be
> working:  my factory class never gets instantiated.
>
> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
>
> 
> 
>class="org.apache.cocoon.components.xslt.TraxProcessor">
> 
> value="org.dspace.saxon.ConfigurableTransformerFactory"/>
>   
> 
>
> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
> there either.
>
> I do have  and  in the Spring
> config.
>
> Is there some way to debug component configuration and see if the file
> is even being looked for (and where *is* configuration looking)?  The
> Cocoon site directs me to Excalibur, which directs me to Avalon, which
> says that Avalon is wound up and directs me back to Excalibur
>
>
>
> I've also tried to configure the thing using Spring:
>
>class='org.apache.cocoon.components.xslt.TraxProcessor'
>   init-method='initialize'
>   destroy-method='dispose'>
>   
>value='org.dspace.saxon.ConfigurableTransformerFactory'/>
> 
>
> but so far I'm missing something:  TraxProcessor.sourceToSAX throws an
> NPE.  I'm probably not setting the parameters correctly -- there isn't
> a setter for use-store at all, for example.
>
> I've found any number of pages that tell me Avalon configuration is
> being replaced by Spring, but nothing practical on how to convert
> Avalon configuration (such as the first sample above) to Spring, or
> even how to write fresh Spring configuration for Cocoon components.
> It would be nice to know how to do this even if I wind up using the
> Avalon approach with the present task.
>
> --
> Mark H. Wood
> Lead Technology Analyst
>
> University Library
> Indiana University - Purdue University Indianapolis
> 755 W. Michigan Street
> Indianapolis, IN 46202
> 317-274-0749
> www.ulib.iupui.edu
>


Re: Handling errors retrieving a for

2016-08-24 Thread Javier Puerto
2016-08-21 18:38 GMT+02:00 Christopher Schultz <ch...@christopherschultz.net
>:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Javier
>
> On 6/1/16 3:19 PM, Javier Puerto wrote:
> > Hi Christopher,
> >
> > I more used to version 2.2 but it should be the same. By you
> > description I think about creating a new pipeline with a matcher to
> > handle the external request with a specific error handler[1] that
> > contains a reader with an empty file.
> >
> > It should be something like:
> >
> > 
> >
> >   > src="http://remote-server/{1}"/> 
> >
> >  
> > 
> >
> > 
> >
> > Then you could substitute all your calls to external resources
> > that needs to produce an empty XML in case of error to call to the
> > new matcher. This way you can tune up the external pipeline for
> > caching if it's needed.
>
> I tried:
>
> 
>   
> 
>   
>   
> 
> 
> 
>   
>   
> 
>   
> 
>
> When I get a "no route to host" error from the unavailable-resource, I
> get the standard Cocoon error page with a stack trace. I would have
> expected the  from the unavailable resource to simply
> provide no content to aggregate with the other sources.
>

The exception will be handled at pipeline level so if the source fails, the
handle-errors that you defined will be triggered.


>
> Do I need a more complicated handle-errors section? All of the
> examples in the docs have a  in them to check the
> exception type.
>

The problem is that you want that your resources return an empty content in
case that the application can not get the data in the middle of the
process. So you need to declare another pipeline with a matcher that will
accept any URL and retrieves it for you, this matcher will have the
"handle-errors" tag that will read an empty XML file.

Create a new pipeline like I send previously and just call the resources in
the aggregator to resolve the internal pipeline.

  
  
  


Notice the protocol and the internal pipeline matcher path preffix. You
should get what you expect with this change.


> Thanks,
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJXudkCAAoJEBzwKT+lPKRY5NIP/2j5npsvm4VZEXDkCPYDrZCv
> Zk8mfShffDkf0Xh1lOUnbXiwezv3YkQIq7gRa1rhWnR69lriAJQku1vsSsnagADH
> Re4BzJXxWhJ8a+x7Hv8Ibhvjzl53qxxVl9U/cop8R4u9tQAH4aVWPaLUrkxtnFGh
> 0G+MEnOr8x62NG1RHSVuhNfXgFTxVaXDkxcS3w47Vq/Ts+ulU7Hm0XXfPUJB5XG/
> /sREax46fY0/9Qweb82QbG5CHaI22Uv/xnxq4t+HHA1I3DJtZDpiHHcueF02Hn5R
> LtRq4gDvYqAriGSy31W+roNCT+ItT2yThQ9EdcRg4Dc2meN/0s7jTdbIhF1YU2ut
> GjfW1504z5GoPYO1kaS5pSFH5zIaOaKUp3SYCHrkCAhEY5u5u10NIqleHUnj8g6z
> latO8gp26UgdlBMZwaVXc2TOIX3BbKhZTveEjwc9wCd1EyrrryoLr6xT5hKUctaf
> u1oGOaQcgHVNAskztwDNAYzyeep+lRAIPPGQ1irhXrPA66nOuyHW6+I4EBiboQ8J
> RUi0djAUZg/srOxpWvC5ww+FyGleH+a0bJe3qz6BhSPVqy+VddjUl4SnqeT+1m6t
> yU/K+q8i3TPGHGDJwDQeGqkesB5e3okT9UJuj2SqOMOQ7yHe0aR0JOepP4Y9oNuI
> sTgQuM/AzAsTpO60ML1v
> =ewdz
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> For additional commands, e-mail: users-h...@cocoon.apache.org
>
>


Re: Handling errors retrieving a for

2016-06-02 Thread Javier Puerto
2016-06-02 15:35 GMT+02:00 Christopher Schultz <ch...@christopherschultz.net
>:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Javier,
>
> On 6/1/16 3:19 PM, Javier Puerto wrote:
> > I more used to version 2.2 but it should be the same. By you
> > description I think about creating a new pipeline with a matcher to
> > handle the external request with a specific error handler[1] that
> > contains a reader with an empty file.
> >
> > It should be something like:
> >
> > 
> >
> >   > src="http://remote-server/{1}"/> 
> >
> >  
> > 
> >
> > 
> >
> > Then you could substitute all your calls to external resources
> > that needs to produce an empty XML in case of error to call to the
> > new matcher. This way you can tune up the external pipeline for
> > caching if it's needed.
> >
> > I hope it helps.
>
> Thanks.
>
> How can I reference a matcher from a different pipeline? Do I need to
> address it any differently than I would if the matcher were in the
> same pipeline?
>

An example is better: http://wiki.apache.org/cocoon/CocoonProtocolExample


>
> Speaking of caching, I'd prefer for the "remote-handler" matcher to
> re-try pretty regularly. Do matchers cache at all under normal
> circumstances? I've never bothered attempting to configure any caching
> in Cocoon before.
>

You should configure the pipeline as "noncaching". There are more details
at:
https://cocoon.apache.org/2.1/userdocs/concepts/caching.html

Salu2.


>
> Thanks,
> - -chris
>
> > 2016-06-01 19:56 GMT+02:00 Christopher Schultz
> > <ch...@christopherschultz.net
> > <mailto:ch...@christopherschultz.net>>:
> >
> > All,
> >
> > Using Cocoon 2.1, I've got an aggregate generator like this:
> >
> >  
> >   > src="http://remote-server/baz.xml; />  ...
> > 
> >
> > There are times when "remote-server" is not available and I'd like
> > to basically include nothing at that location within the aggregate
> > document .
> >
> > Can I do that within the  or  elements, or
> > is it better to wrap the  another  with an
> > error handled?
> >
> > Followup question: how can I configure an error handler to do
> > whatever I want? I only want this particular behavior to happen for
> > this particular  ... presumably, I'll want other behavior
> > in other situations.
> >
> > Thanks, -chris
> >
> > -
> >
> >
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> > <mailto:users-unsubscr...@cocoon.apache.org> For additional
> > commands, e-mail: users-h...@cocoon.apache.org
> > <mailto:users-h...@cocoon.apache.org>
> >
> >
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJXUDY/AAoJEBzwKT+lPKRY7TcP/jxbYNldkn7MFFwKKR9SYtEd
> Ow6XBZ/dTyXhrcSWz9lyOulZ2/WqHpar7S1jwPmYSx+Ga9FOlWghU+5CYI3Ohovi
> R+v44GTLaydwp2QnqG7sEXl3l2UxY83pzGl/1ae5M5BTULPdkM8LTRNl1U1bssAC
> W2BY2ScSv5g8psLLc7dKOCfY7QQqwz84M6YVzorLsUJ96NETvuKn2yvWoYYs+iuX
> LZrFTRWDwbWxedm5fArFoNYd1uYgslvc4Ua7sZbv3qLimy8ms1h61vABbI/bUcwM
> M2JxXIgOAsMc7MGVuw5jjZQOSvg7S/8H/QUPQ+BflXlEBkaZNnz0RFN7wTGgEjVl
> fzdyY9FF9QxVQysfyaFquJqZCbvIRy1c7vpzpG5B3NXVm92ZFrfVgOr1vFb4tcY2
> nR7FQoCZ2ZuHtNcPgyNhk2MpHtjkj14mFq0jIyxzRu/A6Ltd//pyw7cGosP7xzFn
> +12KdigPK45nSRo7TOlSxv7RZ7FfYFwOj2UeXP/5xPoaWom5PoYemzSn7HULr4NM
> MSX7v02Ndb0ZBKEn7O1YOLdQmaQTYGnTPP7zhJ2jaccHAxz5RmbjWR2r0EE3MtdO
> 6Gu2KC/PqiIJF3qM6l/xcLHRRSilh+Xl/qu/0cUIGbzWtgAfkkZAWP42DT/pzA/o
> I0gdBU+WWcqZaPCEFYcf
> =89az
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> For additional commands, e-mail: users-h...@cocoon.apache.org
>
>


Re: Handling errors retrieving a for

2016-06-01 Thread Javier Puerto
Hi Cristopher,

I more used to version 2.2 but it should be the same. By you description I
think about creating a new pipeline with a matcher to handle the external
request with a specific error handler[1] that contains a reader with an
empty file.

It should be something like:



  
http://remote-server/{1}"/>
  

  

  



Then you could substitute all your calls to external resources that needs
to produce an empty XML in case of error to call to the new matcher. This
way you can tune up the external pipeline for caching if it's needed.

I hope it helps.

Salu2.

[1]:
http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html#Error+Handler+Hierarchy

2016-06-01 19:56 GMT+02:00 Christopher Schultz :

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> All,
>
> Using Cocoon 2.1, I've got an aggregate generator like this:
>
>   
> 
>   
>   http://remote-server/baz.xml; />
> 
> ...
>   
>
> There are times when "remote-server" is not available and I'd like to
> basically include nothing at that location within the aggregate document
> .
>
> Can I do that within the  or  elements, or is
> it better to wrap the  another  with an error
> handled?
>
> Followup question: how can I configure an error handler to do whatever
> I want? I only want this particular behavior to happen for this
> particular  ... presumably, I'll want other behavior in
> other situations.
>
> Thanks,
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEARECAAYFAldPIeUACgkQ9CaO5/Lv0PBW7wCfZtyG7w8bcgOuVn80V4NZtxoy
> n10AnAtqYx0F2uHml7wbEPh4Bg9G3s3Y
> =aPSk
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> For additional commands, e-mail: users-h...@cocoon.apache.org
>
>


Re: What are the alternatives to in Cocoon 2.2?

2016-03-04 Thread Javier Puerto
Hi Mark,


2016-03-04 16:21 GMT+01:00 Mark H. Wood :

> We use a large Cocoon 2.2 application (which we don't own and can't
> just port to v3) and at startup it complains, " deprecation - The
> 'component-configurations' section in the sitemap is
> deprecated. Please check for alternatives."


The problem is because there exists configuration elements in the sitemap.
This is how Apache Cocoon 2.1 was configured before migrating to Spring for
version 2.2.

See http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html


> So I'm checking for
> alternatives.  Where would I find some detailed discussion of the
> alternatives to  and how to map what we
> have to them?
>

To migrate the configuration you can follow the documentation of Apache
Cocoon 2.2 and also check the block examples that you can see in the source
code.

See
http://cocoon.apache.org/subprojects/configuration/spring-configurator/index.html
And http://svn.apache.org/repos/asf/cocoon/trunk/blocks/

Regards.

>
> --
> Mark H. Wood
> Lead Technology Analyst
>
> University Library
> Indiana University - Purdue University Indianapolis
> 755 W. Michigan Street
> Indianapolis, IN 46202
> 317-274-0749
> www.ulib.iupui.edu
>


Re: Resize images

2014-09-11 Thread Javier Puerto
Hi Peter,

If you can use ImageMagick, you can try with:
http://im4java.sourceforge.net/

2014-09-11 16:27 GMT+02:00 Edward David eda...@ucalgary.ca:

 Peter,
 There are numerous image resizer programs out there.
 Check out this Free Picture Resizer at
 http://download.cnet.com/Free-Picture-Resizer/3000-12511_4-10297789.html


 Thanks,
 ___
 Edward David
 Information Technologies Services,
 Libraries and Cultural Resources,
 The University of Calgary
 Phone: (403) 220-3383
 Fax: (403) 282-1218

 -Original Message-
 From: Peter Sparkes [mailto:pe...@didm.co.uk]
 Sent: September-11-14 8:23 AM
 To: users@cocoon.apache.org  Cocoon users
 Subject: Resize images

 Hi,

 I currently have a cocoon application which enables the site owner to
 upload images and then  within the upload javascript uses java to move the
 images to the required directory.

 Most of the uploaded images are  large and therefore they are  slow in
 displaying in a web page.

 I, therefore, wish to resize them before saving them.

 I am not sure how to do it.

 Please, can anyone help

 Thanks

 Peter

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Fwd: [REMINDER] ApacheCon NA 2014 Travel Assistance Applications now open!

2014-02-05 Thread Javier Puerto
-- Forwarded message --
From: lewis john mcgibbney lewi...@apache.org
Date: 2014-02-05
Subject: [REMINDER] ApacheCon NA 2014 Travel Assistance Applications now
open!
To: p...@apache.org
Cc: travel-assista...@apache.org travel-assista...@apache.org


Hi pmcs@,

This is a gentle reminder that Travel Assistance Applications are closing
on Friday February 7th 2014.
It would be grealt appreciated if you could forward this message to your
user@ and dev@ community lists.
Kind regards, good luck with your applications and we look forward to
seeing you in Denver :)

Lewis
(On behalf of the Travel Assistance Committee)


-- Forwarded message --
From: lewis john mcgibbney lewi...@apache.org
Date: Wed, Jan 15, 2014 at 4:41 PM
Subject: ApacheCon NA 2014 Travel Assistance Applications now open!
To: p...@apache.org
Cc: travel-assista...@apache.org


To: p...@apache.org
Reply-To: travel-assista...@apache.org

Hi pmcs@,

The Travel Assistance Committee (TAC) are pleased to announce that travel
assistance applications for ApacheCon North America 2014 are now open! This
announcement serves as a purpose for you (pmcs@) to let members of your
community know about both ApacheConNA 2014 and about the TAC assistance to
attend. Could you please forward this announcement to your community, along
if possible with information on how your project is involved in ApacheCon
this year?

ApacheConNA will be held in Denver, Colorado, April 7-9, 2014.

TAC exists to help those that would like to attend ApacheCon events, but
are unable to do so for financial reasons. For more info on this years
applications and qualifying criteria please visit the TAC website at 
http://www.apache.org/travel/ .   Applications are already open, so don't
delay!

*The important date*...

   - Friday February 7th 2014 - TAC applications close.

Applicants have until the the closing date above to submit their
applications (which should contain as much supporting material as required
to efficiently and accurately process your request), this will enable TAC
to announce successful awards shortly afterwards.

As usual TAC expects to deal with a range of applications from a diverse
range of backgrounds. We therefore encourage (as always) anyone thinking
about sending in an application to do so ASAP.

We look forward to greeting everyone in Denver, Colorado in April.

Kind Regards

Lewis

(On behalf of the Travel Assistance Committee)



-- 


 _ _  _ _  _ ___ _
   _   _ _   _
|_   _| |_ ___   |  _  |___ ___ ___| |_ ___   |   __|___|  _| |_ _ _ _
___ ___ ___   |   __|___ _ _ ___ _| |___| |_|_|___ ___
  | | |   | -_|  | | . | .'|  _|   | -_|  |__   | . |  _|  _| | |
| .'|  _| -_|  |   __| . | | |   | . | .'|  _| | . |   |
  |_| |_|_|___|  |__|__|  _|__,|___|_|_|___|  |_|___|_| |_|
|_|__,|_| |___|  |__|  |___|___|_|_|___|__,|_| |_|___|_|_|
   |_|

http://people.apache.org/~lewismc || @hectorMcSpector ||
http://www.linkedin.com/in/lmcgibbney

   Apache Gora V.P || Apache Nutch PMC || Apache Any23 PMC
|| Apache OODT PMC || Apache TAC


Re: cocoon-xml-2.0.4

2014-01-17 Thread Javier Puerto
2014/1/16 gelo1234 gelo1...@gmail.com

 Hi Salu2,

 Thanks for clarifying this.

 Now I got interested in cocoon-osgi, but it seems like rather old stuff
 (and uses old spring release).
 Any plans to reactivate this subproject ? It would be awesome to see
 cocoon integrated with
 e.g. Karaf with Blueprint config.


That should be great but unfortunately I don't know the status about osgi
support. I don't know about osgi so I can't contribute about but I can help
with the Apache Cocoon side :-). I remember that some Cocoon members talked
about in the past ApacheCon 2012 in Sinsheim about integrate it with osgi.
Maybe someone wants to contribute.

There's an issue open in the Jira system with a patch, you could give it a
try.

https://issues.apache.org/jira/browse/COCOON3-87

Regards (Salu2)

PD: Salu2 is a Spanish phonetic word that means regards but it's
written like l8ter. The original word is Saludos. ;-)


 Greetings,
 Greg


 2014/1/16 Javier Puerto jpue...@gmail.com

 Hi Greg,


 2014/1/16 gelo1234 gelo1...@gmail.com


 Hello,

 I wonder how to classify C3-beta dependency: cocoon-xml ?
 Which project does that dependency belong to ?


 It's part of Apache Cocoon subprojets.

 http://svn.apache.org/repos/asf/cocoon/subprojects/
 http://cocoon.apache.org/subprojects/



 As I got it right, it is NOT part of Cocoon 3.0-beta package ? Is it
 just a separate jar file from Apache Maven repo ? Or a part or separate
 project like Apache Commons ?


 It's part of Cocoon as libraries and are used by different releases like
 version 2.2.x. For maven you can use Apache repository.

 https://repository.apache.org/index.html#view-repositories




 cocoon-sax (which is part of C3-beta) depends on cocoon-xml

 Greetings,
 Greg


 Salu2.





Re: cocoon-xml-2.0.4

2014-01-16 Thread Javier Puerto
Hi Greg,


2014/1/16 gelo1234 gelo1...@gmail.com


 Hello,

 I wonder how to classify C3-beta dependency: cocoon-xml ?
 Which project does that dependency belong to ?


It's part of Apache Cocoon subprojets.

http://svn.apache.org/repos/asf/cocoon/subprojects/
http://cocoon.apache.org/subprojects/



 As I got it right, it is NOT part of Cocoon 3.0-beta package ? Is it just
 a separate jar file from Apache Maven repo ? Or a part or separate project
 like Apache Commons ?


It's part of Cocoon as libraries and are used by different releases like
version 2.2.x. For maven you can use Apache repository.

https://repository.apache.org/index.html#view-repositories




 cocoon-sax (which is part of C3-beta) depends on cocoon-xml

 Greetings,
 Greg


 Salu2.


Re: [C3] Calling another from REST resource

2013-08-26 Thread Javier Puerto
2013/8/26 Andre Juffer andre.juf...@oulu.fi

  I am working on using the Java pipe. So far so so good.  I have two
 issues:

 1. I intend to use a TextSerializer in the final step as I need just a
 single String returned from the other block, but I cannot find the
 org.apache.cocoon.sax.component.TextSerializer:


 http://cocoon.apache.org/3.0/apidocs/org/apache/cocoon/sax/component/TextSerializer.html

 It extends org.apache.cocoon.sax.component.XMLSerializer. All other
 classes are fine (Pipeline, SAXPipelineComponent, etc). Is there an extra
 dependency required. If so, which one?


TextSerializer class is in cocoon-sax project, the spring declaration is
available at cocoon-sitemap project in file
cocoon-sitemap/src/main/resources/META-INF/cocoon/spring/cocoon-pipeline-component.xml.
You only need these two projects as dependencies.




 2. Also, the example of a VideoController contains the line:

 return new Page(servlet:/screen/video, data);

 In which package is Page located? I just cannot find it.


I can't see the fragment code you shown and neither the Page class. Where
did you get the example?
Anyway, seems like you are trying to create a controller. You can check the
samples to check what kind of object is expected from the controller
because probably the Page class inherits from another object.



 Thanks,
 André



 On 08/19/2013 12:19 PM, Thorsten Scherler wrote:

 On 08/19/2013 10:58 AM, Andre Juffer wrote:

  Hi Thorsten,

 I already thought that it would down to what you suggested. Seems to me
 that calling a pipeline in the way you suggested is the most logical way,
 as the other block has everything in place to receive requests for
 accounts, given the hash. I will give it a try.


 Another possibility would be to create a java pipe. See e.g. for an usage
 see

 cocoon-rest-optional/src/main/java/org/apache/cocoon/rest/optional/sample/SendMailPipeService.java
 and

 cocoon-rest-optional/src/main/java/org/apache/cocoon/rest/optional/mail/pipelines/pipes/EmailPlainPipe.java

 This gives you a broader possibility. For example in one project I
 extended the pipeline interface to work with a hashmap and I injected the
 values via the pipe. This way I did not need to bother with the stream but
 directly could access the values I needed in the pipeline.

 salu2


 Best,
 André





 --
 Andre H. Juffer
 Biocenter Oulu and Department of Biochemistry
 University of Oulu, Finland
 Phone: +358-294-481161
 Email: andre.juf...@oulu.fi
  WWW:
   www.biochem.oulu.fi/Biocomputing/
   www.oulu.fi/biocenter/biocomputing-and-bioinformatics
   www.oulu.fi/biocenter/groups/juffer

  StrucBioCat, www.strucbiocat.oulu.fi
 Triacle Biocomputing, www.triacle-bc.com

 --
 *From:* Thorsten Scherler [scher...@gmail.com]
 *Sent:* Monday, August 19, 2013 10:12 AM
 *To:* users@cocoon.apache.org
 *Subject:* Re: [C3] Calling another from REST resource

  On 08/15/2013 04:34 PM, Andre Juffer wrote:

  To clarify my question:

 I need to identify persons when they access a resource. On the client
 side, a temporal hash is stored. On the server side, I use that hash to
 connect with an account associated with a person. The hash is not unique,
 it is assigned upon signing in, and lost after signing out. When accessing
 the resource, say a VideoResource in block A,

 @POST
 Response doSomething(@PathParam(hash) String hash)
 {
 Account account =  // Use the hash here.

 this.facade_.doSomething(account, );

 return someResponse;
 }

 The account information is obtained from another block (B), which is
 accessed by various others block for the same purpose. These blocks
 represent various services for which a person may have an account.

 Thus, the line with

 Account account =  // Use the hash here.

 would access another block.

 Can this easily be facilitated with cocoon3 at this stage?

 thanks for your time,



 The question is do you need to call/use a java class or do you want to
 call a pipeline?

 To call another java class a simple import should do, when you have the
 dep to the other block set.

 In case of calling another pipeline should be working with
 http://cocoon.apache.org/subprojects/servlet-service/servlet-service-impl/architecture.htmlservlet:
 final URL url = new URL(servlet:blockB:/someUrl);

 HTH

 salu2



 --
 Andre H. Juffer
 Biocenter Oulu and Department of Biochemistry
 University of Oulu, Finland
 Phone: +358-294-481161
 Email: andre.juf...@oulu.fi
  WWW:
   www.biochem.oulu.fi/Biocomputing/
   www.oulu.fi/biocenter/biocomputing-and-bioinformatics
   www.oulu.fi/biocenter/groups/juffer

  StrucBioCat, www.strucbiocat.oulu.fi
 Triacle Biocomputing, www.triacle-bc.com

 

Re: [C3] Calling another from REST resource

2013-08-26 Thread Javier Puerto
2013/8/26 Andre Juffer andre.juf...@oulu.fi





 --
 Andre H. Juffer
 Biocenter Oulu and Department of Biochemistry
 University of Oulu, Finland
 Phone: +358-294-481161
 Email: andre.juf...@oulu.fi
  WWW:
   www.biochem.oulu.fi/Biocomputing/
   www.oulu.fi/biocenter/biocomputing-and-bioinformatics
   www.oulu.fi/biocenter/groups/juffer

  StrucBioCat, www.strucbiocat.oulu.fi
 Triacle Biocomputing, www.triacle-bc.com

 --
 *From:* Javier Puerto [jpue...@gmail.com]
 *Sent:* Monday, August 26, 2013 12:04 PM

 *To:* users@cocoon.apache.org
 *Subject:* Re: [C3] Calling another from REST resource




 2013/8/26 Andre Juffer andre.juf...@oulu.fi

  I am working on using the Java pipe. So far so so good.  I have two
 issues:

 1. I intend to use a TextSerializer in the final step as I need just a
 single String returned from the other block, but I cannot find the
 org.apache.cocoon.sax.component.TextSerializer:


 http://cocoon.apache.org/3.0/apidocs/org/apache/cocoon/sax/component/TextSerializer.html

 It extends org.apache.cocoon.sax.component.XMLSerializer. All other
 classes are fine (Pipeline, SAXPipelineComponent, etc). Is there an extra
 dependency required. If so, which one?


  TextSerializer class is in cocoon-sax project, the spring declaration
 is available at cocoon-sitemap project in file
 cocoon-sitemap/src/main/resources/META-INF/cocoon/spring/cocoon-pipeline-component.xml.
 You only need these two projects as dependencies.

 OK, thanks. I will have a look.




 2. Also, the example of a VideoController contains the line:

 return new Page(servlet:/screen/video, data);

 In which package is Page located? I just cannot find it.


  I can't see the fragment code you shown and neither the Page class.
 Where did you get the example?
  Anyway, seems like you are trying to create a controller.

 That is correct.


 You can check the samples to check what kind of object is expected from
 the controller because probably the Page class inherits from another object.

 I am referring to

 http://cocoon.apache.org/3.0/features.html

 There is an example towards the end.


I see now, seems like you have found a bug in the documentation and needs
to be updated. The Page object must implement the interface RestResponse
that you can see in the cocoon-rest project. I've checked the source and
we have some base implementation in the same package,
org.apache.cocoon.rest.response. You can choose a base implementation,
extends or implements your own according to your needs. See:

http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/






 Thanks,
 André



 On 08/19/2013 12:19 PM, Thorsten Scherler wrote:

 On 08/19/2013 10:58 AM, Andre Juffer wrote:

 Hi Thorsten,

 I already thought that it would down to what you suggested. Seems to me
 that calling a pipeline in the way you suggested is the most logical way,
 as the other block has everything in place to receive requests for
 accounts, given the hash. I will give it a try.


 Another possibility would be to create a java pipe. See e.g. for an usage
 see

 cocoon-rest-optional/src/main/java/org/apache/cocoon/rest/optional/sample/SendMailPipeService.java
 and

 cocoon-rest-optional/src/main/java/org/apache/cocoon/rest/optional/mail/pipelines/pipes/EmailPlainPipe.java

 This gives you a broader possibility. For example in one project I
 extended the pipeline interface to work with a hashmap and I injected the
 values via the pipe. This way I did not need to bother with the stream but
 directly could access the values I needed in the pipeline.

 salu2


 Best,
 André





 --
 Andre H. Juffer
 Biocenter Oulu and Department of Biochemistry
 University of Oulu, Finland
 Phone: +358-294-481161
 Email: andre.juf...@oulu.fi
  WWW:
   www.biochem.oulu.fi/Biocomputing/
   www.oulu.fi/biocenter/biocomputing-and-bioinformatics
   www.oulu.fi/biocenter/groups/juffer

  StrucBioCat, www.strucbiocat.oulu.fi
 Triacle Biocomputing, www.triacle-bc.com

 --
 *From:* Thorsten Scherler [scher...@gmail.com]
 *Sent:* Monday, August 19, 2013 10:12 AM
 *To:* users@cocoon.apache.org
 *Subject:* Re: [C3] Calling another from REST resource

  On 08/15/2013 04:34 PM, Andre Juffer wrote:

 To clarify my question:

 I need to identify persons when they access a resource. On the client
 side, a temporal hash is stored. On the server side, I use that hash to
 connect with an account associated with a person. The hash is not unique,
 it is assigned upon signing in, and lost after signing out. When accessing
 the resource, say a VideoResource in block A,

 @POST
 Response doSomething(@PathParam(hash) String hash

Re: XSLT import/include errors

2013-06-22 Thread Javier Puerto
Hi Greg,

Did you tried yourself with Saxon? I had caching issues with Xalan but
never tried with Saxon before.

Salu2.
El 22/06/2013 10:34, gelo1234 gelo1...@gmail.com escribió:

 Now when everything is up and working fine, the really ennoying part of C3
 is caching imported/included XSL files.

 Is there any way to invalidate that cache ? Or to turn if off ?

 I wouldn't like to restart the application server every time I make a
 small change inside imported/included XSL file :(

 Greetings,
 Greg


 2013/6/21 gelo1234 gelo1...@gmail.com

 Solution: If you want to call Java functions freely from C3 XSLT, use
 older Saxon implementation.
 Version 9.1 works perfectly!

 Greetings,
 Greg


 2013/6/21 gelo1234 gelo1...@gmail.com

 Looks like Saxon-HE doesn't support anymore calling Java functions that
 way:


 http://saxon-xslt-and-xquery-processor.13853.n7.nabble.com/XSLT-2-0-Saxon-9-HE-and-call-java-functions-td4347.html

 But there are available in PE and EE versions, huh

 Greetings,
 Greg



 2013/6/21 gelo1234 gelo1...@gmail.com

 Thanks for the tip. Unfortunately it doesn't work with:
 Saxon-HE-9.5.0.2.jar :(

 Greetings,
 Greg


 2013/6/21 Robby Pelssers robby.pelss...@the-future-group.com

  That is possible but the how-to part depends on the Saxon version
 you are using.  You will need to dive into how to write extension 
 functions
 for that particular implementation.

  I used it a number of times with Saxon 8.7


 http://robbypelssers.blogspot.nl/2012/10/creating-unix-timestamp-with-xslt20.html


 http://robbypelssers.blogspot.nl/2011/09/power-of-apache-cocoon-xquery-and-xslt.html

  But i never tried with the latest version of Saxon which works
 differently.

  Robby
  --
 *Van:* gelo1234 [gelo1...@gmail.com]
 *Verzonden:* vrijdag 21 juni 2013 15:23
 *To:* Cocoon Users
 *Onderwerp:* Re: XSLT import/include errors

  OK, one more question. Is it possible with Saxon/Xalan in C3 to
 invoke external Java function ?
 I can't get it working:

 xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
 version=1.0
 xmlns:utils=java:org.example.Utils
 exclude-result-prefixes=utils

  xsl:template match=Page

   xsl:variable name=fileName select=file/

   Root
 xsl:value-of
 select=utils:exists($fileName)/
   /Root
  /xsl:template

  /xsl:stylesheet

  Tried Xalan, tried Saxon. Both generates some strange errors with XML
 Document.

  Greetings,
 Greg


 2013/6/20 gelo1234 gelo1...@gmail.com

  The latest Saxon got the same _global_ variable context scope and
 doesn't allow overriding xsl:variables.
  OK, I will fix that :)

  Greetings,
 Greg


 2013/6/20 gelo1234 gelo1...@gmail.com


 Thank you! I will try to bring back Saxon :)

  Greetings,
 Greg


This was discused before in the mailing list [1], it's a two
 step process

 * Add saxon dependency to pom file. [2]

  I think it's better to try Saxon directly if you used to work
 with it. Xalan is usually faster but as you have to migrate already 
 made
 templates from Saxon IMO it's better to switch the engine.

 [1] http://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE
 [2]
 http://cocoon.markmail.org/message/mjuftsfwdxmnc5fn?q=saxon#query:saxon+page:1+mid:fe2faygf7jdfrzb3+state:results





  *The Future Group, dé maat in ondernemen*


   [image: The Future Group] http://www.the-future-group.com [image:
 The Future Group kantoor]   Röntgenlaan 27 | 2719 DX Zoetermeer [image:
 Mobiel nummer] 06 15879926  [image: Web-site]
 http://www.the-future-group.com [image: E-mail adres]
 robby.pelss...@the-future-group.com  [image: Telefoonnummer]   +31
 (0)79 - 363 2905 [image: LinkedIn account]   [image: Twitteraccount]
 http://twitter.com/futuregroup








Re: XSLT import/include errors

2013-06-20 Thread Javier Puerto
Hi Greg,

El 20/06/2013 20:00, gelo1234 gelo1...@gmail.com escribió:


 It looks like XSLT also got cut in functionality in C3. I tried to rerun
old XSL stylesheets with new C3 and gave up.

 The error says nothing meaningful:

 exception-report class=org.apache.cocoon.pipeline.SetupException
timestamp=Thu, 20 Jun 2013 19:58:23 +0200messageImpossible to read
XSLT from 'javax.xml.transform.stream.StreamSource@cba24d', see nested
exception/messagecauseCould not compile
stylesheet/causestacktraceCausejavax.xml.transform.TransformerConfigurationException:
Could not compile stylesheet
 at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown
Source)
 at
org.apache.cocoon.sax.component.XSLTTransformer.load(XSLTTransformer.java:216)
 at
org.apache.cocoon.sax.component.XSLTTransformer.load(XSLTTransformer.java:165)
 at
org.apache.cocoon.sax.component.XSLTTransformer.setConfiguration(XSLTTransformer.java:264)
 at
org.apache.cocoon.sitemap.InvocationImpl.installComponent(InvocationImpl.java:257)
 at

 It looks like there is a problem with xsl:import/xsl:include from the
main xsl stylesheet.

You are right, seems to be a problem with the imports. I've used Imports
and includes with cocoo3 without problems, except that imported files are
cached and doesn't update running in RCL. The xslt engine is still xalan so
the templates should work like before except for the sources with cocoon:/
protocol that aren't supported.

 Moreover I found that when xsl:template match=RootElement is not in
the main XSL stylesheet the same error appears.

Could you send an example block to reproduce the issue?


 Can we switch on more debugging info what is wrong ?

You can edit the logback.xml file and set level to debug but the exception
comes from xalan. I suggest to look for sources loaded with cocoon:/ in
your code and substitute by servlet:/.


 Greetings,
 Greg

Salu2.


Re: XSLT import/include errors

2013-06-20 Thread Javier Puerto
)
 at
 org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
 at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

 Greetings,
 Greg



 2013/6/20 Javier Puerto jpue...@gmail.com

 Hi Greg,

 El 20/06/2013 20:00, gelo1234 gelo1...@gmail.com escribió:

 
 
  It looks like XSLT also got cut in functionality in C3. I tried to
 rerun old XSL stylesheets with new C3 and gave up.
 
  The error says nothing meaningful:
 
  exception-report class=org.apache.cocoon.pipeline.SetupException
 timestamp=Thu, 20 Jun 2013 19:58:23 +0200messageImpossible to read
 XSLT from 'javax.xml.transform.stream.StreamSource@cba24d', see nested
 exception/messagecauseCould not compile
 stylesheet/causestacktraceCausejavax.xml.transform.TransformerConfigurationException:
 Could not compile stylesheet
  at
 com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown
 Source)
  at
 org.apache.cocoon.sax.component.XSLTTransformer.load(XSLTTransformer.java:216)
  at
 org.apache.cocoon.sax.component.XSLTTransformer.load(XSLTTransformer.java:165)
  at
 org.apache.cocoon.sax.component.XSLTTransformer.setConfiguration(XSLTTransformer.java:264)
  at
 org.apache.cocoon.sitemap.InvocationImpl.installComponent(InvocationImpl.java:257)
  at
 
  It looks like there is a problem with xsl:import/xsl:include from the
 main xsl stylesheet.

 You are right, seems to be a problem with the imports. I've used Imports
 and includes with cocoo3 without problems, except that imported files are
 cached and doesn't update running in RCL. The xslt engine is still xalan so
 the templates should work like before except for the sources with cocoon:/
 protocol that aren't supported.

  Moreover I found that when xsl:template match=RootElement is not in
 the main XSL stylesheet the same error appears.

 Could you send an example block to reproduce the issue?

 
  Can we switch on more debugging info what is wrong ?

 You can edit the logback.xml file and set level to debug but the
 exception comes from xalan. I suggest to look for sources loaded with
 cocoon:/ in your code and substitute by servlet:/.

 
  Greetings,
  Greg

 Salu2.






Re: Doubt about file upload in Cocoon 2.2

2013-06-06 Thread Javier Puerto
Hola Miguel,


2013/6/6 Miguel miguel.valen...@juntadeandalucia.es

 Hi

   At present, I work on project based on cocoon 2.2 and I want to use file
 upload option to send an email with cocoon. Documentation of cocoon
 indicates about the parameters:

 org.apache.cocoon.uploads.**enable=true
 org.apache.cocoon.uploads.**autosave=true
 org.apache.cocoon.uploads.**maxsize=1000

 The last parameter is very interesting because limit the size of files to
 upload the platform, so I think cocoon would be safe if people try upload
 ver big files.

 I have checked that the MultipartParser java class manage this upload
 process, but it seems that the file is readed fully although size of file
 is higher than parameter maxsize, żit is correct this behaviour?


Not always, if content length is available in the request object, the
MultipartParser reject the file without save it in memory nor disk. See
methods getParts(...) and parsePaths(...) methods [1]



 After debugging MultipartParser class, I see the process is:
 1) if (oversized) , so if size of file is higher than parameter maxsize,
 then it is created object out = new NullOutputStream();
 2) stream of file is readed and put into object out, and variable lenght
 is size of readed content.
 3) if (oversized) then it is created object RejectedPart.

 I don't understand because read full file if in this case always it's
 created RejectedPart object. it's necesary length variable for RejectedPart
 object?.


The rejected part is a dummy representation so you can get information
about the rejected object. You can see in javadoc [2] that getImputStream()
method will throw an IOException.

I've rescue a snippet from an old project that used this:


//To handle the file upload limit we can detect if the part is instance of
//   org.apache.cocoon.servlet.multipart.RejectedPart

final Part part = RequestUtil.getPart(getRequest());
if(part instanceof RejectedPart) {
 throw new IllegalArgumentException(File size exceeds the maximum.);
}




 if at the begining of process you know content length of file and this
 number is higher of limit then it's better option not read file and create
 RejectedPart object with length = 0, isn't it?. Maybe, I don't know source
 of cocoon fully, and I am wrong.


I'm not sure 100% but it could be also related with your configuration
autosave=true that according to [3] it's responsible to store all the
uploaded files in the upload dir.



 Anybody can explain me.


I hope that avobe helps.

salu2.


 thanks


[1]
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
[2]
http://cocoon.apache.org/2.2/core-modules/core/2.2/apidocs/org/apache/cocoon/servlet/multipart/RejectedPart.html
[3]
http://cocoon.apache.org/2.2/core-modules/core/2.2/apidocs/org/apache/cocoon/servlet/multipart/MultipartConfigurationHelper.html#autosaveUploads




 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org



Re: Dom Transformer

2013-03-15 Thread Javier Puerto
2013/3/15 Mansour Al Akeel mansour.alak...@gmail.com

 I have tags with id's like:

 some-section-tag id='109876_n00069  

 And those ids are used for links inside the document. They are linked
 from different sections.
 I like to transform the links and the ids to something that makes sense.
 Like,

 xref href=the-section-title-with-dashes-only  My Link Label/xref

 And

 The anchor

 some-section-tag id='the-section-title-with-dashes-only  

 I think this can be done is Stax, xslt or Sax, however, I am trying to
 do it in a clean way without any hacks.

 Do you have any suggestion ??


You can do it whithout any hack with all the ways, sax, stax and xslt.

XSLT:

sitemap.xmap

map:transform src=resources/xslt/page2html.xsl
map:parameter name=language value={locale:1}/map:parameter
name=dojoVersion value={global:ch.sobu.dojo.version}/map:parameter
name=staticBaseUri value={global:proxy.static}/map:parameter
name=publicBaseUri value={global:proxy.public}/map:parameter
name=env value={global:ch.sobu.build.env}/map:parameter
name=version value={global:ch.sobu.build.version}//map:transform





 On Fri, Mar 15, 2013 at 2:18 PM, gelo1234 gelo1...@gmail.com wrote:
  The question is WHY? you want DOM transformation in Cocoon environment ?
 
  Greetings,
  -Greg
 
 
  2013/3/15 Mansour Al Akeel mansour.alak...@gmail.com
 
  I know this may sound strange, but I like to create a transformation
 with
  DOM.
  I was able to see Stax and Sax transformation. I was not able to see
  one for DOM.
 
  Any advice ?? Examples ??
 
  -
  To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
  For additional commands, e-mail: users-h...@cocoon.apache.org
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Re: Dom Transformer

2013-03-15 Thread Javier Puerto
2013/3/15 Javier Puerto jpue...@gmail.com



 2013/3/15 Mansour Al Akeel mansour.alak...@gmail.com

 I have tags with id's like:

 some-section-tag id='109876_n00069  

 And those ids are used for links inside the document. They are linked
 from different sections.
 I like to transform the links and the ids to something that makes sense.
 Like,

 xref href=the-section-title-with-dashes-only  My Link Label/xref

 And

 The anchor

 some-section-tag id='the-section-title-with-dashes-only  

 I think this can be done is Stax, xslt or Sax, however, I am trying to
 do it in a clean way without any hacks.

 Do you have any suggestion ??


 You can do it whithout any hack with all the ways, sax, stax and xslt.

 XSLT:
 sitemap.xmap


Sorry, the message was sent by error before the example was finished. :)













 On Fri, Mar 15, 2013 at 2:18 PM, gelo1234 gelo1...@gmail.com wrote:
  The question is WHY? you want DOM transformation in Cocoon environment ?
 
  Greetings,
  -Greg
 
 
  2013/3/15 Mansour Al Akeel mansour.alak...@gmail.com
 
  I know this may sound strange, but I like to create a transformation
 with
  DOM.
  I was able to see Stax and Sax transformation. I was not able to see
  one for DOM.
 
  Any advice ?? Examples ??
 
  -
  To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
  For additional commands, e-mail: users-h...@cocoon.apache.org
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org





Re: Dom Transformer

2013-03-15 Thread Javier Puerto
2013/3/15 Mansour Al Akeel mansour.alak...@gmail.com

 I have tags with id's like:

 some-section-tag id='109876_n00069  

 And those ids are used for links inside the document. They are linked
 from different sections.
 I like to transform the links and the ids to something that makes sense.
 Like,

 xref href=the-section-title-with-dashes-only  My Link Label/xref

 And

 The anchor

 some-section-tag id='the-section-title-with-dashes-only  

 I think this can be done is Stax, xslt or Sax, however, I am trying to
 do it in a clean way without any hacks.

 Do you have any suggestion ??


XSLT sample:

You can add the following transformation to oyur pipeline sitemap.xmap:

map:transform src=resources/xslt/uuid2title.xsl/

And create an xslt file that maches the elements you want to change
uuid2title.xsl

xsl:template match=some-section-tag/@id
  xsl:attribute name=id
xsl:value-of select=replace([your tile node xpath],  , )/
  /xsl:attribute
/xsl:template

I hope that helps, I've not tested it. With SAX and StAX it's similar but
written in java, you have to locate the element you are looking for and
replace the attribute with the new one. Most times XSLT is enough, SAX and
StAX is used if you have to do some business logic.

DOM is not good idea because is not event based and Cocoon pipeline is
based on XML events so to work with DOM you have to do double work,
transform to DOM and generate SAX or StAX events later to hook the pipeline.

Salu2.





 On Fri, Mar 15, 2013 at 2:18 PM, gelo1234 gelo1...@gmail.com wrote:
  The question is WHY? you want DOM transformation in Cocoon environment ?
 
  Greetings,
  -Greg
 
 
  2013/3/15 Mansour Al Akeel mansour.alak...@gmail.com
 
  I know this may sound strange, but I like to create a transformation
 with
  DOM.
  I was able to see Stax and Sax transformation. I was not able to see
  one for DOM.
 
  Any advice ?? Examples ??
 
  -
  To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
  For additional commands, e-mail: users-h...@cocoon.apache.org
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Re: Generator with XMLFilterImpl

2012-12-06 Thread Javier Puerto
Hi Mansour,

2012/12/6 Mansour Al Akeel mansour.alak...@gmail.com

 Hello all,
 I am using C2.2 for this project, and I need to add some functionality
 to the current file generator (ie, logging and warning for broken
 links). I know this can be done in a transformer,
 but since it's required in many places, I want it in the Generator.


 Since the generator, generates SAX events, the simplest way is to
 insert an XMLFilterImpl that does the logging, between the generator
 and the consumer. For example:


I think that use a Transformer is the Cocoon way and simplest (no need of
java code).

map:pipeline match=myCustomFileGenerator/**
  map:generator src={1}/
  map:transform src=yourXSLT/
  mao:serialize/
/map:pipeline

Then you can use from other pipelines in the same sitemap like this:

map:pipeline match=my/service
  map:generate src=cocoon:/myCustomFileGenerator/your/file/to/consume/
  

From another block you can consume also with the sevlet: protocol, just add
the name of the block with the service you want to consume:
map:pipeline match=my/service
  map:generate
src=servlet:myBlock:/myCustomFileGenerator/your/file/to/consume/



 Currently:

 FileGenerator -- events --- XMLConsumer

 I need it to be:

 FileGenerator -- events -- XMLFilterImpl --- XMLConsumer
 OR
 FileGenerator -- events --- XMLConsumer -- XMLFilterImpl

 The issue is I couldn't find any example on connecting and setting up
 a filter between the generator and the consumer.
 Additionally, setting the contentHandler doesn't seem to have any
 effect. Currently this is what I have and the events are not passing
 through LinkValidator Filter.


 public class MyGenerator extends FileGenerator {

 @Override
 public void setup(SourceResolver resolver, Map objectModel, String
 src, Parameters parameters) throws ProcessingException, SAXException,
 IOException {

 super.setup(resolver, objectModel, src, parameters);

 LinkValidator validator = new
 LinkValidator(this.contentHandler);

 this.setContentHandler(validator);

 }

 @Override
 public void generate() throws IOException, SAXException,
 ProcessingException {
 super.generate();
 }

 }


 Thank you


If you have implemented the XMLFilter already, you can easily transform
into a Cocoon transformer, the interface is very similar.

Salu2.



 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Re: Generator with XMLFilterImpl

2012-12-06 Thread Javier Puerto
El 06/12/2012 20:40, gelo1234 gelo1...@gmail.com escribió:


 But you should really consider using Transformer as Jaxier suggested.
Thats what filters XML data in Cocoon so acts as a Filter.

Exactly, recently I have to migrate a Cocoon application to pure java and
transformers are just XMLFilters. That's why I suggest this approach. If
you can't do it with xslt you can create your own transformer.

 If you need to do this in Java (write your own Transformer [Filter]), you
can take a look at one of the simplest Transformers
 in Cocoon sources: CleaningTransformer


cocoon-sax/src/main/java/org/apache/cocoon/sax/component/CleaningTransformer.java

 You just consume SAX events and generate new ones :)

 Greetings,
 Greg



 2012/12/6 gelo1234 gelo1...@gmail.com


 If you need to do this in generator why not writing your own Generator ?
that extends AbstractSAXGenerator ?
 You can find example in:
 cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/

 Greetings,
 Greg


 2012/12/6 Mansour Al Akeel mansour.alak...@gmail.com

 Javier, thank you for replying.
 For many additional reasons, I need to do this in a generator. It's
 not my call on this. So I need to connect the XMLFilterImpl to the
 Generator.
 I know it can be done, but looking for the simplest and cleanest way.


 On Thu, Dec 6, 2012 at 12:25 PM, Javier Puerto jpue...@gmail.com
wrote:
  Hi Mansour,
 
  2012/12/6 Mansour Al Akeel mansour.alak...@gmail.com
 
  Hello all,
  I am using C2.2 for this project, and I need to add some
functionality
  to the current file generator (ie, logging and warning for broken
  links). I know this can be done in a transformer,
  but since it's required in many places, I want it in the Generator.
 
 
  Since the generator, generates SAX events, the simplest way is to
  insert an XMLFilterImpl that does the logging, between the generator
  and the consumer. For example:
 
 
  I think that use a Transformer is the Cocoon way and simplest (no
need of
  java code).
 
  map:pipeline match=myCustomFileGenerator/**
map:generator src={1}/
map:transform src=yourXSLT/
mao:serialize/
  /map:pipeline
 
  Then you can use from other pipelines in the same sitemap like this:
 
  map:pipeline match=my/service
map:generate
src=cocoon:/myCustomFileGenerator/your/file/to/consume/

 
  From another block you can consume also with the sevlet: protocol,
just add
  the name of the block with the service you want to consume:
  map:pipeline match=my/service
map:generate
  src=servlet:myBlock:/myCustomFileGenerator/your/file/to/consume/
 
 
 
  Currently:
 
  FileGenerator -- events --- XMLConsumer
 
  I need it to be:
 
  FileGenerator -- events -- XMLFilterImpl --- XMLConsumer
  OR
  FileGenerator -- events --- XMLConsumer -- XMLFilterImpl
 
  The issue is I couldn't find any example on connecting and setting up
  a filter between the generator and the consumer.
  Additionally, setting the contentHandler doesn't seem to have any
  effect. Currently this is what I have and the events are not passing
  through LinkValidator Filter.
 
 
  public class MyGenerator extends FileGenerator {
 
  @Override
  public void setup(SourceResolver resolver, Map objectModel,
String
  src, Parameters parameters) throws ProcessingException, SAXException,
  IOException {
 
  super.setup(resolver, objectModel, src, parameters);
 
  LinkValidator validator = new
  LinkValidator(this.contentHandler);
 
  this.setContentHandler(validator);
 
  }
 
  @Override
  public void generate() throws IOException, SAXException,
  ProcessingException {
  super.generate();
  }
 
  }
 
 
  Thank you
 
 
  If you have implemented the XMLFilter already, you can easily
transform into
  a Cocoon transformer, the interface is very similar.
 
  Salu2.
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
  For additional commands, e-mail: users-h...@cocoon.apache.org
 
 

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org





Re: accessing a spring bean methods from sitemap

2012-11-11 Thread Javier Puerto
2012/11/10 Thorsten Scherler scher...@gmail.com

 Hi Mansour,

 Javier is on a flight to Zürich ATM but I know what code he is talking
 about.


Yeah, for an input module. If you want to access from a flowscript as
Francesco suggested you can use this:

var yourComponentInstance = cocoon.getComponent(BEAN-ID);



 I read between the lines that you are on 2.2. If you happen to be on 3
 then the whole thing is much straight forward.

 I am not sure whether the following is the best approach for your problem
 since it depends on where you want to come the hashMap from. Next outlines
 how to access one from spring.

 in your spring file you have to add the ns declaration and something like
 the following:
 !--ns--
 xmlns:util=http://www.**springframework.org/schema/**utilhttp://www.springframework.org/schema/util
 
   xsi:schemaLocation=...
 http://www.springframework.**org/schema/utilhttp://www.springframework.org/schema/util
 http://www.springframework.**org/schema/util/spring-util-2.**5.xsdhttp://www.springframework.org/schema/util/spring-util-2.5.xsd
 

 bean id=collection
 name=org.apache.cocoon.**components.modules.input.**
 InputModule/collection
 class=es.sadesi.module.input.**Collection
 property name=map ref=sections/
 /bean

 util:map id=sections map-class=java.util.HashMap
   entry key=0 value=0. Disposiciones estatales /
   entry key=1 value=1. Disposiciones generales /
   entry key=2 value=2. Autoridades y personal /
   entry key=2.1 value=2.1. Nombramientos, situaciones e incidencias /
   entry key=2.2 value=2.2. Oposiciones, concursos y otras
 convocatorias /
   entry key=3 value=3. Otras disposiciones /
   entry key=4 value=4. Administración de justicia /
   entry key=5 value=5. Anuncios /
   entry key=5.1 value=5.1. Licitaciones públicas y adjudicaciones /
   entry key=5.2 value=5.2. Otros anuncios oficiales /
 /util:map

 Then create a es.sadesi.module.input.**Collection class with something
 like
 package es.sadesi.module.input;

 import java.util.Map;

 import org.apache.avalon.framework.**configuration.Configuration;
 import org.apache.avalon.framework.**configuration.**
 ConfigurationException;
 import org.apache.cocoon.components.**modules.input.**AbstractInputModule;
 import org.apache.cocoon.components.**modules.input.InputModule;
 import org.springframework.beans.**factory.annotation.Required;

 public class Collection extends AbstractInputModule {
 private InputModule map;

 public Object getAttribute(String name, Configuration modeConf,
 Map objectModel) throws ConfigurationException {

 final Object result =  map.getAttribute(name, null, null);
 return result;

 }

 public Object getAttribute(String name) throws ConfigurationException {
   return getAttribute(name, null, null);
 }

 @Required
 public void setMap(InputModule map) {
 this.map = map;
 }
 }

 then use it in your sitemap with
 {collection:2.2} which should return 2.2. Oposiciones, concursos y otras
 convocatorias

 That should work in 2.2 (I have no time to test it so it may miss
 something in the extraction of the customer use case but it should get you
 started).

 HTH

 salu2


 On 11/10/2012 08:07 PM, Mansour Al Akeel wrote:

 Javier,
 thank you.
 The module I am going to implement is to be used by one block only,
 and would love to be able to declare it in the sitemap.xmap.
 I haven't implemented input modules before, but reading this:

 http://cocoon.apache.org/2.1/**userdocs/concepts/modules.htmlhttp://cocoon.apache.org/2.1/userdocs/concepts/modules.html


 Step 1: Making a new module known to Apache Cocoon

 Like other core components of Apache Cocoon, modules are declared in
 cocoon.xconf. There are already too many to list here.

 input-modules
component-instance name=request
class=org.apache.cocoon.**components.modules.input.**
 RequestParameterModule/
 .
 

 since I am developing with maven and jetty, and doing it in on block,
 I like to declare this new input module in the sitemap.xmap or in the
 same block (jar).

 Is there a way to do this ??




 On Sat, Nov 10, 2012 at 1:09 PM, Javier Puerto jpue...@gmail.com wrote:

 I did something similar for a client. We did it with a custom input
 module
 so you can define a protocol on when the input is the key an the output
 the
 value.

 Also I can't access to my laptop now but I have an example about
 accessing
 to spring beans from flow script, probably the input module it's enough.

 Salu2

 El 10/11/2012 18:41, Francesco Chicchiriccò ilgro...@apache.org
 escribió:

  On 10/11/2012 18:38, Mansour Al Akeel wrote:

 I need to link documents through some identification. For example,
 assuming that I have:

 articles/my-first-article.xml
 articles/second-one.xml
 articles/hello-world-article.**xml

 books/book1.xml  which has  references to  artice-1 and article-3
 identified by an id of the form: A001

 I need to create a hashtable linking both so that I pass query

Re: accessing a spring bean methods from sitemap

2012-11-10 Thread Javier Puerto
I did something similar for a client. We did it with a custom input module
so you can define a protocol on when the input is the key an the output the
value.

Also I can't access to my laptop now but I have an example about accessing
to spring beans from flow script, probably the input module it's enough.

Salu2
El 10/11/2012 18:41, Francesco Chicchiriccò ilgro...@apache.org
escribió:

 On 10/11/2012 18:38, Mansour Al Akeel wrote:
  I need to link documents through some identification. For example,
  assuming that I have:
 
  articles/my-first-article.xml
  articles/second-one.xml
  articles/hello-world-article.xml
 
  books/book1.xml  which has  references to  artice-1 and article-3
  identified by an id of the form: A001
 
  I need to create a hashtable linking both so that I pass query param
  by ID or by name. The idea I have is to initialize spring bean that
  will extract the data from these files,
  and construct a MapString,String.
 
  My question is how can I access this HashTable from sitemap ??
 
  I am using C2.2.

 Hi,
 I don't think there is any direct way to access an Hashtable from the
 sitemap: maybe the only chance is to get to it through flowscript...

 Don't have idea of how to access a Spring bean from flowscript,
 though... any C2.2. expert around?

 Regards.

 --
 Francesco Chicchiriccò

 ASF Member, Apache Cocoon PMC and Apache Syncope PPMC Member
 http://people.apache.org/~ilgrosso/


 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Re: database connections used up by script?

2012-10-12 Thread Javier Puerto
Hi Paul,

Your pool is configured to max 200 connections. Is your postgres configured
to support this quantity? (by default is 100). The error is thrown by
postgres itself so I suspect that's could be the cause. See
http://www.postgresql.org/docs/8.1/static/runtime-config-connection.html

Salu2

2012/10/12 Paul Joseph pjos...@gmail.com

 Hi there,

 I've supported a Cocoon application for many years now but yesterday a new
 problem was reported that I haven't' seen before.

 The customer was doing something relatively unusual---using a script to
 read a spreadsheet and automatically fill in a Cocoon CForm and then save
 data in a plain old database table.

 The error is as shown below.  Not sure what setting to use for my
 connection-pool in the jdbc-connection-descriptor (below).


 jdbc-connection-descriptor

 jcd-alias=WebStore
 default-connection=true
 platform=PostgreSQL
 jdbc-level=3.0
 driver=org.postgresql.Driver
 protocol=jdbc
 subprotocol=postgresql
 dbalias=//localhost:5432/**WebStore
 username=*
 eager-release=false
 batch-mode=false

 connection-pool maxActive=200 validationQuery= /
 sequence-manager 
 className=org.apache.ojb.**broker.util.sequence.**SequenceManagerNextValImpl
 /

 /jdbc-connection-descriptor

 Other than that it is Cocoon 2.1 using Java6 in Tomcat 7.x and Postgresql
 9.1 with a JDBC 3.0 driver.
 The actual error is shown below.

 brgds
 Paul

 NFO: Server startup in 5045 ms
 org.postgresql.util.**PSQLException: FATAL: sorry, too many clients
 already
 at org.postgresql.core.v3.**ConnectionFactoryImpl.**
 readStartupMessages(**ConnectionFactoryImpl.java:**464)
 at org.postgresql.core.v3.**ConnectionFactoryImpl.**
 openConnectionImpl(**ConnectionFactoryImpl.java:**112)
 at org.postgresql.core.**ConnectionFactory.**openConnection(**
 ConnectionFactory.java:66)
 at org.postgresql.jdbc2.**AbstractJdbc2Connection.init**
 (AbstractJdbc2Connection.java:**125)
 at org.postgresql.jdbc3.**AbstractJdbc3Connection.init**
 (AbstractJdbc3Connection.java:**30)
 at org.postgresql.jdbc3.**Jdbc3Connection.init(**
 Jdbc3Connection.java:24)
 at org.postgresql.Driver.**makeConnection(Driver.java:**393)
 at org.postgresql.Driver.connect(**Driver.java:267)
 at java.sql.DriverManager.**getConnection(Unknown Source)
 at java.sql.DriverManager.**getConnection(Unknown Source)
 at org.apache.cocoon.ojb.samples.**SuperDAO.getConnection(**
 SuperDAO.java:302)
 at org.apache.cocoon.ojb.samples.**SuperDAO.getMaxValue(SuperDAO.**
 java:459)
 at sun.reflect.**GeneratedMethodAccessor126.**invoke(Unknown Source)
 at sun.reflect.**DelegatingMethodAccessorImpl.**invoke(Unknown Source)
 at java.lang.reflect.Method.**invoke(Unknown Source)
 at org.mozilla.javascript.**NativeJavaMethod.call(**
 NativeJavaMethod.java:230)
 at org.mozilla.javascript.**ScriptRuntime.call(**
 ScriptRuntime.java:1244)
 at org.mozilla.javascript.**continuations.**ContinuationInterpreter.**
 interpret(**ContinuationInterpreter.java:**1134)
 at org.mozilla.javascript.**continuations.**ContinuationInterpreter.**
 interpret(**ContinuationInterpreter.java:**190)
 at org.mozilla.javascript.**continuations.**ContinuationInterpreter.**
 interpret(**ContinuationInterpreter.java:**138)
 at org.mozilla.javascript.**continuations.**
 InterpretedFunctionImpl.call(**InterpretedFunctionImpl.java:**121)
 at org.mozilla.javascript.**ScriptRuntime.call(**
 ScriptRuntime.java:1244)
 at org.mozilla.javascript.**ScriptableObject.callMethod(**
 ScriptableObject.java:1591)
 at org.apache.cocoon.components.**flow.javascript.fom.FOM_**
 JavaScriptInterpreter.**handleContinuation(FOM_**
 JavaScriptInterpreter.java:**841)
 at org.apache.cocoon.components.**treeprocessor.sitemap.**
 CallFunctionNode.invoke(**CallFunctionNode.java:124)
 at org.apache.cocoon.components.**treeprocessor.**
 AbstractParentProcessingNode.**invokeNodes(**AbstractParentProcessingNode.
 **java:47)
 at org.apache.cocoon.components.**treeprocessor.sitemap.**
 MatchNode.invoke(MatchNode.**java:108)
 at org.apache.cocoon.components.**treeprocessor.**
 AbstractParentProcessingNode.**invokeNodes(**AbstractParentProcessingNode.
 **java:69)
 at org.apache.cocoon.components.**treeprocessor.sitemap.**
 PipelineNode.invoke(**PipelineNode.java:143)
 at org.apache.cocoon.components.**treeprocessor.**
 AbstractParentProcessingNode.**invokeNodes(**AbstractParentProcessingNode.
 **java:69)
 at org.apache.cocoon.components.**treeprocessor.sitemap.**
 PipelinesNode.invoke(**PipelinesNode.java:93)
 at org.apache.cocoon.components.**treeprocessor.**
 ConcreteTreeProcessor.process(**ConcreteTreeProcessor.java:**235)
 at org.apache.cocoon.components.**treeprocessor.**
 ConcreteTreeProcessor.process(**ConcreteTreeProcessor.java:**177)
 at org.apache.cocoon.components.**treeprocessor.TreeProcessor.**
 process(TreeProcessor.java:**254)
 at 

Re: two scripts to handle flowscript in one sitemap

2012-10-05 Thread Javier Puerto
Hi Paul,

I can tell you for 2.2 version, but you can try...

2012/10/5 Paul Joseph pjos...@gmail.com

 Hi there,

 I have a flowscript that has a lot of functiofnality (functions).


 It is possible for one sitemap to handle more than one flowscript? That
 way I can split this file out into smaller units associated with the
 submenus.


We had the same issue. You can load more than one script, also if I
remember correctly, you can use functions defined in the same sitemap.xmap.
Like a web page, the declaration order is important.

  map:flow language=javascript
map:script src=flow/utils.js /
map:script src=flow/script1.js /
map:script src=flow/script2.js /
...
map:script src=flow/scriptN.js /
  /map:flow





 (Cocoon 2.1.11,  Apache Tomcat 7, Windows 2008)

 brgds
 Paul


Salu2


 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@cocoon.**apache.orgusers-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Re: Cocoon 2.1 web application base path

2012-05-16 Thread Javier Puerto
2012/5/16 Bob Harrod rjhar...@gmail.com

 Ok, thank you!  I can look at the LinkRewriterTransformer.  Since I'm new
 to this, I have some follow up questions:

 1. Is this a plugin that I have to install or does it exist in the stock
 version of cocoon 2.1?


It's included as a block for cocoon-2.1 and it's builded with cocoon-2.1 by
default but I've used it for Cocoon 2.2  3 so I'm not sure how to
configure it. I remember that you have to declare the component at the
beginning of the sitemap before use it. You can browse the block code and
samples for linkrewritter here

http://svn.apache.org/viewvc/cocoon/tags/cocoon-2.1/RELEASE_2_1_11/src/blocks/linkrewriter/

Or even better, download the sources and play a bit with the samples :)

http://svn.apache.org/repos/asf/cocoon/tags/cocoon-2.1/RELEASE_2_1_11


 2. The examples reference the transformer from a sitemap context.  Is
 there a way to use the LinkRewriterTranformer directly from another
 transform (as this transform is actually creating the anchor)?


The LinkRewriterTransformer is a transformer component for pipeline process
and must be used from a sitemap context. You should place the transformer
in the pipeline so the links get transformed to the right location, usually
at the end of the pipeline before the serializer.

map:pipeline
...

  map:match pattern=welcome
map:generate src=welcome.xml
map:transform src=xslt/xml2page.xsl/ !-- your transformation --
map:transform type=linkrewritter src=cocoon:/linkmap !-- the
links are transformed --
  map:parameter name=namespace-uri value=
http://www.w3.org/1999/xhtml/
/map:transform
map:serialize type=xml/
  /map:match

...
/map:pipeline




 Thanks so much for your help.

 - Bob


 On Wed, May 16, 2012 at 10:24 AM, Bob Harrod rjhar...@gmail.com wrote:

 I'm rending html in a transform, and would like to render an anchor who's
 href is absolute, not relative.  For example, instead of this:

 a href=../home.../a

 I would like to be able to provide a full url in the href:

 a href=http://mysite/application1/home;.../a

 Thank you for your assistance with this!


 On Wed, May 16, 2012 at 12:52 AM, Bob Harrod rjhar...@gmail.com wrote:

 I'm quite new to cocoon, and supporting an older version (2.1).  Does
 anyone know how I can gain access the web application base path inside of a
 transform?  Of course, it can be passed by the sitemap...  Any help would
 be appreciated!

 Thanks!






Re: Transformer parameters are intermittently not set.

2011-09-14 Thread Javier Puerto
2011/9/14 Alec Bickerton alec.bicker...@net-m.ch

 On 14/09/11 11:48, Thorsten Scherler wrote:
  On Wed, 2011-09-14 at 10:58 +0200, Alec Bickerton wrote:
  Hi,
 
  I'm seeing some unusual behaviour in Cocoon 2.1.9. It appears that it
 possible for the xalan transformer parameters to
  not be set in a pipeline. Is this a known issue?
 
  Relevant part of the sitemap.xmap
 
  map:match pattern=general
   map:generate
 src=cocoon://projects/pe/templatetrafo/generic-common /
   !-- No failure of the generator ever detected --
 
   map:transform src=transformer_one.xsl
   map:parameter name=hostname value=myhost.example.com
 /
   map:parameter name=jsessionid
 value={request-param:jsessionid}/
   map:parameter name=bi_show
 value={request-param:bi_show}/
   map:parameter name=basehosttest
 value={request-param:basehosttest}/
   map:parameter name=portalnumber
 value={request-param:portalnumber}/
   /map:transform
 
   map:transform src=transformer_two.xsl
   map:parameter name=jsessionid
 value={request-param:jsessionid}/
   /map:transform
   map:serialize type=xml/
  /map:match
 
  Using the above sitemap 1 in 5 requests fails to set the parameters
 triggering the pipeline to fail. I see this by
  setting a breakpoint in the extension method called from
 transformer_one.
 
  The transformer is configure as shown.
  map:transformer logger=sitemap.transformer.xslt name=xslt
 pool-max=2048 pool-min=32 pool-grow=8
  src=org.apache.cocoon.transformation.TraxTransformer 
use-request-parametersfalse/use-request-parameters
use-session-parametersfalse/use-session-parameters
use-cookie-parametersfalse/use-cookie-parameters


I think that the above three parameters are to control the caching key. If
it's set to true, the parameters are included to build the caching key.


xslt-processor-rolexalan/xslt-processor-role
check-includestrue/check-includes
use-delifalse/use-deli
  encodingUTF-8/encoding
  /map:transformer
 
  Has anyone seen this behaviour in the past, or suggest a place to look
 for a misconfiguration?
 
  Hmm, try with use-request-parameterstrue/use-request-parameters
  however calling localhost:/general?bi_show=true should work
 
  salu2
 

 Thanks for the suggestion, unfortunately I already tried setting
 use-request-parameterstrue/use-request-parameters
 and using
 map:parameter name=use-request-parameters value=true /.

 Neither of which solves the problem.


IMO it should be true for use-request-parameters due you use this
parameters on the transformation. But I didn't experienced this kind of
problems on Cocoon 2.2, I didn't tested 2.1.9.



 Alec,

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Re: cocoon 3: Javascript in jars

2011-09-14 Thread Javier Puerto
Hi Andre,

2011/9/14 Andre Juffer ajuf...@cc.oulu.fi

 Hi,

 with cocoon 2.2 one can read javascript resources residing in separate jars
 like:

 map:match pattern=dojoroot/**
  map:read src=resource://dojoroot/{1} /
 /map:match

 (the above is for loading javascript from the dojotoolkit. I made a
 separate maven project for Dojo, and make a cocoon-based project depending
 on it. I have different maven projects for different versions of Dojo.)


 It seems that cocoon 3 is currently not supporting the resource protocol? A
 solution would be to physically have all the Dojo javascript located in a
 subdirectory dojoroot (for example), and in the sitemap have something like

 map:match pattern=dojoroot/**
  map:read src=dojoroot/{1} mime-type=text/javascript/
 /map:match

 (as in the example web application)

 However, this is inconvenient, as one would need to copy dojo to a
 subdirectory for each project that requires dojo. The maven way is much more
 easier and certainly more elegant, as all projects requiring dojo are
 updated automatically.

 My question is now: If there is no resource protocol, how can one achieve
 the above?


I can't found in 3.0 documentation , but you can try blockcontext:/ protocol
that's available on 2.2.

http://cocoon.apache.org/2.2/1291_1_1.html

Salu2



 Thanks,

 --
 Andre H. Juffer  | Phone: +358-8-553 1161
 Biocenter Oulu and   | Fax: +358-8-553-1141
 Department of Biochemistry   | Email: andre.juf...@oulu.fi
 University of Oulu, Finland  | WWW: 
 www.biochem.oulu.fi/**Biocomputing/http://www.biochem.oulu.fi/Biocomputing/
 StruBioCat   | WWW: www.strubiocat.oulu.fi
 NordProt | WWW: www.nordprot.org
 Triacle Biocomputing | WWW: www.triacle-bc.com

 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@cocoon.**apache.orgusers-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




Re: cocoon 3: Javascript in jars

2011-09-14 Thread Javier Puerto
2011/9/14 Andre Juffer andre.juf...@oulu.fi

 **
 Hi Javier,

 Thanks for your reply.

 Yes, your suggestion probably would work, but seems more cumbersome.
 Response returned from another block must be XML, right?


No, you can access resources from other blocks with this protocol.

blockcontext:/[block-name]/[resource-path]

ex.
blockcontext:/my-dojo-block/dojo/dojo.js



 That is, the requested javascript has to be inserted into XML with at least
 one containing element before it is send to the requesting block.
 Subsequently, the requesting block would need to create a text/javascript
 response that is send to the client. The latter can be accomplish with a
 TextSerializer. More importantly, every cocoon-based web application must
 have a block specifically for this particular purpose, which would mean more
 overhead for maintaining the software. Finally, the block serving the
 javascript would need to access javascript as well, which have to be stored
 in a directory, as indicated in my original email. I would like to avoid all
 of this, and simply read javascript from a jar (maintained centrally as a
 maven project).


Yeah, with blockcontext protocol you must define a cocoon block so this
solution will not work for you if you want to get the javascript from a jar.



 Could the developers possibly confirm that there is in fact no resource
 protocol in cocoon 3. And if so, would there be any chance for having this
 feature available in next release of cocoon 3. At least to me, this would be
 extremely useful.


AFAIK, Resource protocol is not yet implemented in Cocoon 3.



 Thanks,
 André


Salu2.






 On 14/09/11 13:06, Javier Puerto wrote:

 Hi Andre,

 2011/9/14 Andre Juffer ajuf...@cc.oulu.fi

 Hi,

 with cocoon 2.2 one can read javascript resources residing in separate
 jars like:

 map:match pattern=dojoroot/**
  map:read src=resource://dojoroot/{1} /
 /map:match

 (the above is for loading javascript from the dojotoolkit. I made a
 separate maven project for Dojo, and make a cocoon-based project depending
 on it. I have different maven projects for different versions of Dojo.)


 It seems that cocoon 3 is currently not supporting the resource protocol?
 A solution would be to physically have all the Dojo javascript located in a
 subdirectory dojoroot (for example), and in the sitemap have something like

 map:match pattern=dojoroot/**
  map:read src=dojoroot/{1} mime-type=text/javascript/
 /map:match

 (as in the example web application)

 However, this is inconvenient, as one would need to copy dojo to a
 subdirectory for each project that requires dojo. The maven way is much more
 easier and certainly more elegant, as all projects requiring dojo are
 updated automatically.

 My question is now: If there is no resource protocol, how can one achieve
 the above?


 I can't found in 3.0 documentation , but you can try blockcontext:/
 protocol that's available on 2.2.

 http://cocoon.apache.org/2.2/1291_1_1.html

 Salu2



 Thanks,

 --
 Andre H. Juffer  | Phone: +358-8-553 1161
 Biocenter Oulu and   | Fax: +358-8-553-1141
 Department of Biochemistry   | Email: andre.juf...@oulu.fi
 University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
 StruBioCat   | WWW: www.strubiocat.oulu.fi
 NordProt | WWW: www.nordprot.org
 Triacle Biocomputing | WWW: www.triacle-bc.com

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org




 --
 Andre H. Juffer  | Phone: +358-8-553 1161
 Biocenter Oulu and   | Fax: +358-8-553-1141
 Department of Biochemistry   | Email: andre.juf...@oulu.fi
 University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/

 StrucBioCat  | WWW: www.strucbiocat.oulu.fi

 Triacle Biocomputing | WWW: www.triacle-bc.com




Re: How-to disable caching for Cocoon2.2 completely

2011-02-17 Thread Javier Puerto
Hi Robby,

2011/2/17 Robby Pelssers robby.pelss...@ciber.com


 Hi all,

 I was just wondering if it is possible to completely disable caching of
 components.  I have severe issues lately with wrong content being shown and
 the only way to resolve these issues is by deleting the
 tomcat/work/catalina/localhost folder and doing a restart.


To disable the cache you only need to configure the pipelines as type
noncaching. You can configure the default type too in your sitemap.xmap
file.

map:components
  map:pipes default=noncaching
your pipe declarations ...
  /map:pipes
...

Also you can remove the cache without clean the work directory:
http://cocoon.apache.org/2.2/core-modules/core/2.2/1006_1_1.html
Your problems with the content can be related to a bad caching
implementation, you should review your custom components caching strategy.



 I would like to check out the performance without any caching and check if
 I can live with it... if so it will at least solve my corrupted cache issue.


The performance without caching it's not very good. I recommend you to use
caching if you can with an Apache HTTPD or SQUID acting as proxy cache. I
got good results with this solution.


 I sincerely look forward to any advise.


Salu2.


 Kind regards,
 Robby Pelssers

 -
 To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
 For additional commands, e-mail: users-h...@cocoon.apache.org