Re: [C3] Calling another from REST resource

2013-08-26 Thread Andre Juffer
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?

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.

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.fimailto:andre.juf...@oulu.fi
WWW:
  www.biochem.oulu.fi/Biocomputing/http://www.biochem.oulu.fi/Biocomputing/
  
www.oulu.fi/biocenter/biocomputing-and-bioinformaticshttp://www.oulu.fi/biocenter/biocomputing-and-bioinformatics
  
www.oulu.fi/biocenter/groups/jufferhttp://www.oulu.fi/biocenter/groups/juffer

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com


From: Thorsten Scherler [scher...@gmail.commailto:scher...@gmail.com]
Sent: Monday, August 19, 2013 10:12 AM
To: users@cocoon.apache.orgmailto: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.html
 servlet:
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.fimailto:andre.juf...@oulu.fi
WWW:
  www.biochem.oulu.fi/Biocomputing/http://www.biochem.oulu.fi/Biocomputing/
  
www.oulu.fi/biocenter/biocomputing-and-bioinformaticshttp://www.oulu.fi/biocenter/biocomputing-and-bioinformatics
  
www.oulu.fi/biocenter/groups/jufferhttp://www.oulu.fi/biocenter/groups/juffer

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com


From: Andre Juffer [andre.juf...@oulu.fimailto:andre.juf...@oulu.fi]
Sent: Wednesday, August 14, 2013 4:20 PM
To: users@cocoon.apache.orgmailto:users@cocoon.apache.org
Subject: [C3] Calling another from

RE: [C3] Calling another from REST resource

2013-08-26 Thread Andre Juffer
Yes, I already had a look at the TextResponse earlier,

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

and now you confirmed my thoughts.

Great, thanks!



--
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:38 PM
To: users@cocoon.apache.org
Subject: Re: [C3] Calling another from REST resource




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



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

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com


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

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




2013/8/26 Andre Juffer andre.juf...@oulu.fimailto: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

Re: [C3] Calling another from REST resource

2013-08-26 Thread Andre Juffer
On 08/26/2013 12:05 PM, Javier Puerto wrote:



2013/8/26 Andre Juffer andre.juf...@oulu.fimailto: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.

Sorry, but this doesn't seem to be correct. Note that I rely on the 
3.0.0-alpha-3 release. Thus, in pom.xml, one would have
dependency
groupIdorg.apache.cocoon.sax/groupId
artifactIdcocoon-sax/artifactId
version3.0.0-alpha-3/version
/dependency
dependency
groupIdorg.apache.cocoon.sitemap/groupId
artifactIdcocoon-sitemap/artifactId
version3.0.0-alpha-3/version
/dependency

according to

http://mvnrepository.com/artifact/org.apache.cocoon.sax/cocoon-sax/3.0.0-alpha-3
http://mvnrepository.com/artifact/org.apache.cocoon.sitemap/cocoon-sitemap/3.0.0-alpha-3

None of these contain the org.apache.cocoon.sax.component.TextSerializer.



--
Andre H. Juffer  | Phone: +358-294-481161
Biocenter Oulu and   | Fax: +358-8-553-1141
Department of Biochemistry   | Email: 
andre.juf...@oulu.fimailto: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.fihttp://www.strubiocat.oulu.fi
Triacle Biocomputing | WWW: 
www.triacle-bc.comhttp://www.triacle-bc.com


Re: [C3] Calling another from REST resource

2013-08-26 Thread Andre Juffer
On 08/26/2013 12:39 PM, Javier Puerto wrote:



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



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

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com


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

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




2013/8/26 Andre Juffer andre.juf...@oulu.fimailto: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.

As far as I can see, the TextSerializer does exist in trunk, but not in 
cocoon-sax-3.0.0-alpha-3

In any case, I got it working, as the response of the other blog is very simple 
(like elementsomeValue/element, no big deal).




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-481161tel:%2B358-294-481161
Email: andre.juf...@oulu.fimailto:andre.juf...@oulu.fi
WWW:
  www.biochem.oulu.fi/Biocomputing/http://www.biochem.oulu.fi/Biocomputing/
  
www.oulu.fi/biocenter/biocomputing-and-bioinformaticshttp://www.oulu.fi/biocenter/biocomputing-and-bioinformatics
  
www.oulu.fi/biocenter/groups/jufferhttp://www.oulu.fi/biocenter/groups/juffer

StrucBioCat, www.strucbiocat.oulu.fihttp

RE: [C3] Calling another from REST resource

2013-08-19 Thread Andre Juffer
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.

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.html
 servlet:
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.fimailto:andre.juf...@oulu.fi
WWW:
  www.biochem.oulu.fi/Biocomputing/http://www.biochem.oulu.fi/Biocomputing/
  
www.oulu.fi/biocenter/biocomputing-and-bioinformaticshttp://www.oulu.fi/biocenter/biocomputing-and-bioinformatics
  
www.oulu.fi/biocenter/groups/jufferhttp://www.oulu.fi/biocenter/groups/juffer

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com


From: Andre Juffer [andre.juf...@oulu.fimailto:andre.juf...@oulu.fi]
Sent: Wednesday, August 14, 2013 4:20 PM
To: users@cocoon.apache.orgmailto:users@cocoon.apache.org
Subject: [C3] Calling another from REST resource

Is it actually possible to call an another block (say block A) from within a 
REST resource that resides in block B?

Thanks,


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

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com




--
Thorsten Scherler scherler.at.gmail.com
codeBusters S.L. - web based systems
consulting, training and solutions

http://www.codebusters.es/



RE: [C3] Calling another from REST resource

2013-08-19 Thread Andre Juffer

--
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 12:18 PM
To: users@cocoon.apache.org
Subject: Re: [C3] Calling another from REST resource

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.

OK, I will check this option as well.
Thanks!


salu2


Best,
André




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

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com


From: Thorsten Scherler [scher...@gmail.commailto:scher...@gmail.com]
Sent: Monday, August 19, 2013 10:12 AM
To: users@cocoon.apache.orgmailto: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.html
 servlet:
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.fimailto:andre.juf...@oulu.fi
WWW:
  www.biochem.oulu.fi/Biocomputing/http://www.biochem.oulu.fi/Biocomputing/
  
www.oulu.fi/biocenter/biocomputing-and-bioinformaticshttp://www.oulu.fi/biocenter/biocomputing-and-bioinformatics
  
www.oulu.fi/biocenter/groups/jufferhttp://www.oulu.fi/biocenter/groups/juffer

StrucBioCat, www.strucbiocat.oulu.fihttp://www.strucbiocat.oulu.fi
Triacle Biocomputing, www.triacle-bc.comhttp://www.triacle-bc.com


From: Andre Juffer [andre.juf...@oulu.fimailto:andre.juf...@oulu.fi]
Sent: Wednesday, August 14, 2013 4:20 PM
To: users@cocoon.apache.orgmailto:users@cocoon.apache.org
Subject: [C3] Calling another from REST resource

Is it actually possible

RE: [C3] Calling another from REST resource

2013-08-15 Thread Andre Juffer
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,


--
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: Andre Juffer [andre.juf...@oulu.fi]
Sent: Wednesday, August 14, 2013 4:20 PM
To: users@cocoon.apache.org
Subject: [C3] Calling another from REST resource

Is it actually possible to call an another block (say block A) from within a 
REST resource that resides in block B?

Thanks,


--
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



[C3] Calling another from REST resource

2013-08-14 Thread Andre Juffer
Is it actually possible to call an another block (say block A) from within a 
REST resource that resides in block B?

Thanks,


--
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: Mobile Website

2013-05-14 Thread Andre Juffer

On 05/14/2013 09:49 AM, Peter Sparkes wrote:


Or stylesheets


Have a look at responsive web design. Instead of having different pages 
(HTML) returned for which you may use different sitemaps and/or XSL 
stylesheets, you could return the same content, but presented 
differently depending on the size of the screen of the device using CSS.


http://www.smashingmagazine.com/responsive-web-design-guidelines-tutorials/



On 14/05/2013 07:36, Peter Sparkes wrote:

Hi,

I have a requirement to use different sitemap.xmap for mobiles 
depending on the screen size.


I am using 2.1.11

Please, how do I do this?

Peter



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




--
Andre H. Juffer  | Phone: +358-294-481161
Biocenter Oulu and   | Fax: +358-8-5531141
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


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



Re: Cocoon2.2 maven jetty plugin issue

2012-04-11 Thread Andre Juffer
About moving from Maven 2 to 3, I prepare everything with maven 3 
(integrated into Netbeans). When testing an application with jetty, I 
start it up with maven2 on a Ubuntu) Linux box. I have never seen any 
issues with this. I do not think that the problem is caused by maven 2 
or 3. Instead I would look at at the configuration of the application, 
as the error indicates that it basically cannot start up properly. Maybe 
there is XML error in one of the configuration files for Spring, or 
something like that.


On 04/11/2012 04:51 PM, Robby Pelssers wrote:


In reply to my own question.  We don't see consistent behaviour.  Some 
blocks startup properly so this might be caused by another issue.  
It's too bad from the stacktrace I don't get any insight into the 
issue ;-(


Robby

*From:*Robby Pelssers [mailto:robby.pelss...@nxp.com]
*Sent:* Wednesday, April 11, 2012 3:39 PM
*To:* d...@cocoon.apache.org; users@cocoon.apache.org
*Subject:* Cocoon2.2 maven jetty plugin issue

Hi guys,

I have been facing an issue related to the maven jetty plugin which is 
used to start a single C2.2 block.   Just for the record I have to 
mention that this has always worked in the past.  I have a strong 
suspicion that this is somehow related to our upgrade to Maven 3.


Did anybody else have similar issues and if so, were you able to 
resolve this?   I already tried switching to a newer jetty plugin but 
I could not get it working unfortunately.


2012-04-11 15:33:01.805:INFO:/:Initializing Spring root 
WebApplicationContext


2012-04-11 15:33:03.102:WARN::Failed startup of context 
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@dd0f87{/,C:\development\workspaces\intellij11\CTPI-PX\spider2\shared\target\rcl\webapp}


java.lang.RuntimeException: Cannot invoke listener 
org.springframework.web.context.ContextLoaderListener@182752b


at 
org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener.invoke(ReloadingListener.java:190)


at 
org.apache.cocoon.tools.rcl.wrapper.servlet.ReloadingListener.contextInitialized(ReloadingListener.java:213)


at 
org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:549)


at 
org.mortbay.jetty.servlet.Context.startContext(Context.java:136)


at 
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)


at 
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)


at 
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)


at 
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)


at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)


at 
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)


at 
org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)


at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)


at 
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)


at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)


at 
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)


at org.mortbay.jetty.Server.doStart(Server.java:224)

at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)


at 
org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)


at 
org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)


at 
org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)


at 
org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)


at 
org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)


at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)


at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)


at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)


at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)


at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)


at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)


at 
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)


at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)


at 

Re: data binding

2012-03-28 Thread Andre Juffer

Hi Mika,

not sure if I completely understood your question. By stating my forms 
are created dynamically based on data in database you mean to say that 
form elements values constitute the dynamical aspect of the form (thus 
the data) or do you mean to say the form element themselves are changing 
based upon data that is received. Thus, suppose you would be dealing 
with a form for car information. The form has e.g. form element for 
entering the license plate number. This form element could be say a 
simple input form element of type text for one set of data, while for 
another data set the same input is now an text area?


Best,
André

On 03/28/2012 10:34 AM, m...@digikartta.net wrote:


Suggesting to myself:
Modular Database Actions?
Right?

On Tue, 27 Mar 2012 22:50:56 +0300, Mika M Lehtonen 
m...@digikartta.net wrote:

Hi,
what is the right and the proper way of inserting  form data to
database table (PostgreSQL)?
What makes this more interesting is that instead of horizontal data
in table, the data is stored in a vertical manner because of the
highly dynamic nature of the application and the relation model. That
is, my forms are created dynamically based on data in database. In the
same way, the values shoud be stored vertically, because the the table
structure would otherwise have to vary based on form types and
eventually I would have hundreds of different tables.

I have done some testing with XSP and ESQL in order to retrieve my
forms. That works fine, although if I have understood right, XSPs'
aren't recommended to use, am I right?

But now I would have to insert form values to another table
vertically (different columns for different datatypes). How should I
approahce the challenge? Any thoughts?

Sorry if I am asking entirely obvious questions. I don't have such a
long experience with the Cocoon. Testing things now with the 2.11 and
am going to shift to 2.2, even 3.0 some day later or sooner. Also
coming more from .NET side.. forgive me..

- mika -


-
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




--
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


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



Re: data binding

2012-03-28 Thread Andre Juffer

OK, thus each data TYPE decides the form element to be used?

On 03/28/2012 11:23 AM, m...@digikartta.net wrote:


Hi André,
form element themselves are changing based upon data that is received

Forms have a number of fields defined in the db, UI-controls are 
defined in the db, even the validation restrictions will be defined in 
the db. So this is highly dynamical system.
Basically the administrator has tools to create form (and other) 
types, tools to create instances based on those types and tools for 
creating hierarcial structure.
So a form type or an instance of it can be constructed of any number 
of different elements. There is no theoretical limit for the number of 
different form types.


- mika -

On Wed, 28 Mar 2012 10:48:40 +0300, Andre Juffer 
andre.juf...@oulu.fi wrote:

Hi Mika,

not sure if I completely understood your question. By stating my
forms are created dynamically based on data in database you mean to
say that form elements values constitute the dynamical aspect of the
form (thus the data) or do you mean to say the form element themselves
are changing based upon data that is received. Thus, suppose you would
be dealing with a form for car information. The form has e.g. form
element for entering the license plate number. This form element could
be say a simple input form element of type text for one set of data,
while for another data set the same input is now an text area?

Best,
André

On 03/28/2012 10:34 AM, m...@digikartta.net wrote:


Suggesting to myself:
Modular Database Actions?
Right?

On Tue, 27 Mar 2012 22:50:56 +0300, Mika M Lehtonen 
m...@digikartta.net wrote:

Hi,
what is the right and the proper way of inserting  form data to
database table (PostgreSQL)?
What makes this more interesting is that instead of horizontal data
in table, the data is stored in a vertical manner because of the
highly dynamic nature of the application and the relation model. That
is, my forms are created dynamically based on data in database. In the
same way, the values shoud be stored vertically, because the the table
structure would otherwise have to vary based on form types and
eventually I would have hundreds of different tables.

I have done some testing with XSP and ESQL in order to retrieve my
forms. That works fine, although if I have understood right, XSPs'
aren't recommended to use, am I right?

But now I would have to insert form values to another table
vertically (different columns for different datatypes). How should I
approahce the challenge? Any thoughts?

Sorry if I am asking entirely obvious questions. I don't have such a
long experience with the Cocoon. Testing things now with the 2.11 and
am going to shift to 2.2, even 3.0 some day later or sooner. Also
coming more from .NET side.. forgive me..

- mika -



-
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




-
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


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



Re: data binding

2012-03-28 Thread Andre Juffer
The way I typically do things is to rely on Spring and Hibernate, the 
latter for mapping between the tables and domain entities. Postgresql is 
employed for SQL databases. Spring of course for creating objects, but 
also for transaction boundaries. I have transferred all (but one) C2 
applications to C3, and work always with facades. The database 
transactions start and end at the facades, while REST resources receives 
requests and call upon facades to fulfill the requests. I return JSON or 
XML to the client and the GUI is based upon the Dojo toolkit. I do not 
use XSP or ESQL.


The reason for using facades is that one can very easily test everything 
outside of cocoon (whatever version one uses) before preparing a 
Cocoon-based web application. The facades returns DTOs with getters 
(return Strings) to build the response in JSON or XML (or anything 
else). Building the response with Cocoon's sitemap concepts is extremely 
convenient. At no point one ever has to write code in Java for producing 
XML or JSON (well, I wrote a simple JSON transformer). In my mind, this 
is far more easier accomplished with C3 pipelines using XSLT and string 
templates.


In your case, one could return a JSON object with actual data and data 
type names, the latter is them employed to create the correct forms with 
Dojo (or any other framework) on the client. I do not think that one 
should do this on the server. If you use Hibernate, you would need 
decide upon the (domain) entities to which your table correspond 
(actually one should do this the other way around).



On 03/28/2012 11:36 AM, m...@digikartta.net wrote:


Yep,
something like that if simplifying. And the table that holds the 
actual data has columns for each data type. And each field value in 
the form will create its own row in that table. So in any 
circumstance, we don't have to add any columns in the table structure 
whether we have form with one field or with 100 fields.


- mika -

On Wed, 28 Mar 2012 11:27:59 +0300, Andre Juffer 
andre.juf...@oulu.fi wrote:

OK, thus each data TYPE decides the form element to be used?

On 03/28/2012 11:23 AM, m...@digikartta.net wrote:


Hi André,
form element themselves are changing based upon data that is received

Forms have a number of fields defined in the db, UI-controls are 
defined in the db, even the validation restrictions will be defined 
in the db. So this is highly dynamical system.
Basically the administrator has tools to create form (and other) 
types, tools to create instances based on those types and tools for 
creating hierarcial structure.
So a form type or an instance of it can be constructed of any number 
of different elements. There is no theoretical limit for the number 
of different form types.


- mika -

On Wed, 28 Mar 2012 10:48:40 +0300, Andre Juffer 
andre.juf...@oulu.fi wrote:

Hi Mika,

not sure if I completely understood your question. By stating my
forms are created dynamically based on data in database you mean to
say that form elements values constitute the dynamical aspect of the
form (thus the data) or do you mean to say the form element themselves
are changing based upon data that is received. Thus, suppose you would
be dealing with a form for car information. The form has e.g. form
element for entering the license plate number. This form element could
be say a simple input form element of type text for one set of data,
while for another data set the same input is now an text area?

Best,
André

On 03/28/2012 10:34 AM, m...@digikartta.net wrote:


Suggesting to myself:
Modular Database Actions?
Right?

On Tue, 27 Mar 2012 22:50:56 +0300, Mika M Lehtonen 
m...@digikartta.net wrote:

Hi,
what is the right and the proper way of inserting  form data to
database table (PostgreSQL)?
What makes this more interesting is that instead of horizontal 
data

in table, the data is stored in a vertical manner because of the
highly dynamic nature of the application and the relation model. 
That
is, my forms are created dynamically based on data in database. 
In the
same way, the values shoud be stored vertically, because the the 
table

structure would otherwise have to vary based on form types and
eventually I would have hundreds of different tables.

I have done some testing with XSP and ESQL in order to retrieve my
forms. That works fine, although if I have understood right, XSPs'
aren't recommended to use, am I right?

But now I would have to insert form values to another table
vertically (different columns for different datatypes). How should I
approahce the challenge? Any thoughts?

Sorry if I am asking entirely obvious questions. I don't have such a
long experience with the Cocoon. Testing things now with the 2.11 
and

am going to shift to 2.2, even 3.0 some day later or sooner. Also
coming more from .NET side.. forgive me..

- mika -




- 


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

Re: pipeline in flowscript

2012-03-14 Thread Andre Juffer

On 03/14/2012 07:31 PM, Mika M Lehtonen wrote:

Hi list,
I started to experiment with the Cocoon 2.11 after a long while. I did
some adjustment on the registration example.

I added this to the samples/blocks/forms/ sitemap:


Did you to say here that this particular sitemap is a subdirectory 
called forms...



map:match pattern=registration.mika
map:generate src=forms/registration2.xml/


if yes, then this probably would try to load a file in 
forms/registration2.xml, that is subdirectory of forms, thus 
forms/forms/registration2.xml in the block context.




map:serialize/
/map:match
and this modification to the registration.js
var form = new Form(registration.mika);

This is not working. Obviously this is trying to fetch a file with that
name.
java.io.FileNotFoundException:
/home/tomcat/webapps/cocoon/samples/blocks/forms/registration.mika (No
such file or directory)

How can I make this work with the pipelines?

I am trying to create forms based on data in database, anyway that is
the ultimate goal. I found some examples how to use pipelines in flow
script, but I haven't been able to get them work.


An alternative is to send the form data back to the client, and let the 
client create the form, instead of creating the form plus form data by 
the server. See for instance the dojotoolkit (do not use the one 
included in cocoon, nor required at all).






cheers,
- mika -


-
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/
StruBioCat   | WWW: www.strubiocat.oulu.fi
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



Re: pipeline in flowscript

2012-03-14 Thread Andre Juffer

On 03/14/2012 08:24 PM, Mika M Lehtonen wrote:

14.3.2012 20:00, Andre Juffer kirjoitti:

On 03/14/2012 07:31 PM, Mika M Lehtonen wrote:

Hi list,
I started to experiment with the Cocoon 2.11 after a long while. I did
some adjustment on the registration example.

I added this to the samples/blocks/forms/ sitemap:


Did you to say here that this particular sitemap is a subdirectory
called forms...

that is ...cocoon/samples/blocks/forms/sitemap.xmap



map:match pattern=registration.mika
map:generate src=forms/registration2.xml/


if yes, then this probably would try to load a file in
forms/registration2.xml, that is subdirectory of forms, thus
forms/forms/registration2.xml in the block context.

This one works
http://host:8080/cocoon/samples/blocks/forms/registration.mika
The actual file is here:
/home/tomcat/webapps/cocoon/samples/blocks/forms/forms/registration2.xml


Thus, your sitemap is at the top directory (block context) and not in 
forms/forms directory. You registration2.xml should then be in 
forms/registration2.xml and not in forms/forms/registration2.xml.



You did read this all, right?

http://cocoon.apache.org/2.1/userdocs/binding.html

Forms can be pre-filled using something like

?xml version=1.0 encoding=UTF-8?
fb:context
xmlns:fb=http://apache.org/cocoon/forms/1.0#binding;
path=/ 

  fb:value id=surname path=surname /
  fb:value id=initials path=initials /
  fb:value id=firstname path=firstname /
  fb:value id=email path=email /

/fb:context

Still, I would argue not to use this, and move this all to the client 
and use a toolkit like dojo instead. This is much more efficient.






map:serialize/
/map:match
and this modification to the registration.js
var form = new Form(registration.mika);

This is not working. Obviously this is trying to fetch a file with that
name.
java.io.FileNotFoundException:
/home/tomcat/webapps/cocoon/samples/blocks/forms/registration.mika (No
such file or directory)

How can I make this work with the pipelines?

I am trying to create forms based on data in database, anyway that is
the ultimate goal. I found some examples how to use pipelines in flow
script, but I haven't been able to get them work.


An alternative is to send the form data back to the client, and let
the client create the form, instead of creating the form plus form
data by the server. See for instance the dojotoolkit (do not use the
one included in cocoon, nor required at all).

Original question still remains; how can I use data from pipelines in
flowscript instead of static files, or can I?

- mika -






cheers,
- mika -


-
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




--
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
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



Re: pipeline in flowscript

2012-03-14 Thread Andre Juffer

From a old application, written many years ago:

In Flow:

var form = new Form(resource/internal/forms/feedback-definition.xml);
form.createBinding(resource/internal/forms/feedback-binding.xml);
var feedback = new Feedback();  // Holds data for the form, could be 
obtained from a database.

form.load(feedback);
form.showForm(feedback-display);
form.save(feedback);
do-something-with-feedback(feedback);  // e.g. prepare some response.


In sitemap.xmap:

map:match pattern=*-display internal-only=true
  map:generate type=jx src=resource/internal/forms/{1}-template.xml /
  ...
/map:match

I have the feedback-definition.xml located in the given folder relative 
to the folder containing sitemap.xmpa. There is no separate map:match to 
this file. The statement above form = new Form(...) finds the file.






On 03/14/2012 09:41 PM, Mika M Lehtonen wrote:

getting closer!
No pipeline matched request: registration2.mika

14.3.2012 21:35, Robby Pelssers kirjoitti:


Try

var form = new Form(cocoon://registration.mika);

Cheers,

Robby

*From:*Mika M Lehtonen [mailto:m...@digikartta.net]
*Sent:* Wednesday, March 14, 2012 8:33 PM
*To:* users@cocoon.apache.org
*Subject:* Re: pipeline in flowscript

Hi Robby,
..create form definitions on the fly..
That is my ultimate goal.

Any reason why you don't switch to C2.2 or C3?
Any reason why not continue using C2.1?
This is something I newer understood. Why did the C2.1 were almost
abandoned. As far as I know, it is like 99% ready piece of software
with little childhood diseases. I understand how much clever these new
versions can be, especially in front of the expert eyes. But how much
is left from the original idea? And anyway, the learning curve or the
opportunity costs are little too high to switch into entirely
different framework, albeit it would have the same name. And C3 is all
the way too alfa for production usage.

But if I find Cocoon to be the right framework for our needs, I will
do the switching at some stage. But how long does it take before C3 is
in stable state..

Back to my question, what am I doing wrong?
var form = new Form(registration.mika); doesn't work
var form = new Form(forms/registration2.xml); does work



map:match pattern=registration.mika
map:generate src=forms/registration2.xml/
map:serialize/
/map:match

- mika -



14.3.2012 20:39, Robby Pelssers kirjoitti:

Hi Mika,

I can reassure you that this is possible. Most use cases have a static form 
definition and you can bind data from your database to the widgets declared in 
this form definition.Hack, you can even use repeaters to get some dynamic 
behavior or even create form definitions on the fly but those are more exotic 
use cases.

Just one question though.You only recently started to experiment with 
C2.11.Any reason why you don't switch to C2.2 or C3?

Back to your question:
 From flowscript you can access your Java components responsible for retrieving 
data from the database. Next you can use the Cocoon forms api to dynamically 
populate your widgets with values. This also works vice versa where on a form 
submit you intercept the widget values and save them back.

Robby

-Original Message-
From: Mika M Lehtonen [mailto:m...@digikartta.net]
Sent: Wednesday, March 14, 2012 6:32 PM
To:users@cocoon.apache.org  mailto:users@cocoon.apache.org
Subject: pipeline in flowscript

Hi list,
I started to experiment with the Cocoon 2.11 after a long while. I did
some adjustment on the registration example.

I added this to the samples/blocks/forms/ sitemap:
map:match pattern=registration.mika
map:generate src=forms/registration2.xml/
map:serialize/
/map:match
and this modification to the registration.js
var form = new Form(registration.mika);

This is not working. Obviously this is trying to fetch a file with that
name.
java.io.FileNotFoundException:
/home/tomcat/webapps/cocoon/samples/blocks/forms/registration.mika (No
such file or directory)

How can I make this work with the pipelines?

I am trying to create forms based on data in database, anyway that is
the ultimate goal. I found some examples how to use pipelines in flow
script, but I haven't been able to get them work.


cheers,
- mika -


-
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


-
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







--
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/

Re: Cocoon Forms [absolute beginner]

2011-11-29 Thread Andre Juffer

On 11/29/2011 11:02 AM, Francesco Chicchiriccò wrote:

On 28/11/2011 20:12, Andre Juffer wrote:

On 11/28/2011 05:51 PM, Francesco Chicchiriccò wrote:


A combination you may want to have a look at is using Dojo toolkit (
http://dojotoolkit.org/ ) on the client and cocoon's REST
implementation on the server. From a performance point of view this is
very efficient. Dojo does not require any knowledge of XML. It favors
JSON (www.joson.org) instead.


Hey, this looks very interesting: do you have any running (simple)
example about this? Are you planning to write something about this?


I am working on several applications, but they are not yet public. 
But it is all fairly simple. I would start with reading on cocoon to 
understand how to receive and handle REST-like requests. The cocoon 3 
website is very clear (at least to me). These requests can be 
generated with dojo [1].


Hem, I was wondering if you plan to write something about your work (a 
blog, wiki page, ...) mainly to have a common reference - or better, a 
working example - for people wanting to approach Cocoon 3.


Ah OK, yeah, sure, at some point I could do this. In the mean time, you 
should have a look at the sample application [1] that C3 provides.


[1] http://cocoon.apache.org/3.0/download.html



Regards.


[1] http://dojotoolkit.org/documentation/tutorials/1.6/ajax/



Thanks.


-Original Message-
From: Francesco Chicchiriccò [mailto:ilgro...@apache.org]
Sent: Monday, November 28, 2011 9:13 AM
To: users@cocoon.apache.org
Subject: Re: Cocoon Forms [absolute beginner]

On 27/11/2011 02:57, nowbert3 wrote:

Hi! As mentioned in the subject, Cocoon project is something new to
me. While
still exploring, I must admit I'm beginning to really like it. The
question
is simple and perhaps a little stupid, but here goes - are there any
developed tools/editors (possibly wysiwyg) that allow simple users,
with no
xml (java) knowledge create/generate a form (actually form model,
template
etc.) directly from the web - working as some kind of cms in a more
tidy
way.

Hi,
unfortunately there is nothing about what you say above. I know that
there has been something in that direction in the past, but nothing
progressed enough to be considered usable.

Which version are you running? 2.1 or 2.2?
Anyway, if you are stepping for the first time into Cocoon fields, 
I'd

rather suggest you to start looking at version 3.0 [1]; despite its
alpha status, it's quite mature.
Cocoon 3.0 pushes a minimal approach: so for example you would deal
with proper web frameworks (like as Wicket [2], for example, for 
which a

cocoon-wicket integration module is available), leaving the XML
processing stuff to Cocoon pipelines.

If you are interested, there are some samples about Cocoon-Wicket
integration [3] and Cocoon-Hippo CMS integration [4].

Regards.

[1] https://cocoon.apache.org/3.0/
[2] http://wicket.apache.org/
[3]
http://blog.tirasa.net/blogs/index.php/ilgrosso/build-rich-xml-enabled-applications 



[4]
http://blog.tirasa.net/blogs/index.php/ilgrosso/cocoon-3-and-hippo-cms 






--
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


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



Re: Cocoon Forms [absolute beginner]

2011-11-29 Thread Andre Juffer

On 11/29/2011 11:15 AM, Francesco Chicchiriccò wrote:

On 29/11/2011 10:09, Andre Juffer wrote:




Well, I think I rather know that code ;-) - you should be able to find 
my name in [2] as well.


Oops...

In  that case, you only would need to learn Dojo 1.6 (almost 1.7) and 
they have good documentation material available.





Anyway, I am looking forward to see something about this topic.

Regards.

[2] https://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/parent/pom.xml 



--
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


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



Re: Cocoon Forms [absolute beginner]

2011-11-28 Thread Andre Juffer

On 11/28/2011 10:29 AM, Robby Pelssers wrote:

I agree. Although flowscript's continuations can be useful they do tend to claim 
lots of resources and as a cocoon beginner it might make more sense to jump onto 
the C3 wagon from the start. I think it offers a easier learning path although 
from (advanced --  writing custom components) documentation point of view 
there is still some progress to be made.  Cocoon's proposition is not so much 
about building advanced forms rather than being a state-of-the-art framework for 
XML processing. And with C3 you can easily integrate C3 into any Java framework 
you already are familiar with.


A combination you may want to have a look at is using Dojo toolkit ( 
http://dojotoolkit.org/ ) on the client and cocoon's REST implementation 
on the server. From a performance point of view this is very efficient. 
Dojo does not require any knowledge of XML. It favors JSON 
(www.joson.org) instead.




Robby

-Original Message-
From: Francesco Chicchiriccò [mailto:ilgro...@apache.org]
Sent: Monday, November 28, 2011 9:13 AM
To: users@cocoon.apache.org
Subject: Re: Cocoon Forms [absolute beginner]

On 27/11/2011 02:57, nowbert3 wrote:

Hi! As mentioned in the subject, Cocoon project is something new to me. While
still exploring, I must admit I'm beginning to really like it. The question
is simple and perhaps a little stupid, but here goes - are there any
developed tools/editors (possibly wysiwyg) that allow simple users, with no
xml (java) knowledge create/generate a form (actually form model, template
etc.) directly from the web - working as some kind of cms in a more tidy
way.

Hi,
unfortunately there is nothing about what you say above. I know that
there has been something in that direction in the past, but nothing
progressed enough to be considered usable.

Which version are you running? 2.1 or 2.2?
Anyway, if you are stepping for the first time into Cocoon fields, I'd
rather suggest you to start looking at version 3.0 [1]; despite its
alpha status, it's quite mature.
Cocoon 3.0 pushes a minimal approach: so for example you would deal
with proper web frameworks (like as Wicket [2], for example, for which a
cocoon-wicket integration module is available), leaving the XML
processing stuff to Cocoon pipelines.

If you are interested, there are some samples about Cocoon-Wicket
integration [3] and Cocoon-Hippo CMS integration [4].

Regards.

[1] https://cocoon.apache.org/3.0/
[2] http://wicket.apache.org/
[3]
http://blog.tirasa.net/blogs/index.php/ilgrosso/build-rich-xml-enabled-applications
[4] http://blog.tirasa.net/blogs/index.php/ilgrosso/cocoon-3-and-hippo-cms




--
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


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



Re: Cocoon Forms [absolute beginner]

2011-11-28 Thread Andre Juffer

On 11/28/2011 05:51 PM, Francesco Chicchiriccò wrote:


A combination you may want to have a look at is using Dojo toolkit (
http://dojotoolkit.org/ ) on the client and cocoon's REST
implementation on the server. From a performance point of view this is
very efficient. Dojo does not require any knowledge of XML. It favors
JSON (www.joson.org) instead.


Hey, this looks very interesting: do you have any running (simple)
example about this? Are you planning to write something about this?


I am working on several applications, but they are not yet public. But 
it is all fairly simple. I would start with reading on cocoon to 
understand how to receive and handle REST-like requests. The cocoon 3 
website is very clear (at least to me). These requests can be generated 
with dojo [1].


[1] http://dojotoolkit.org/documentation/tutorials/1.6/ajax/



Thanks.


-Original Message-
From: Francesco Chicchiriccò [mailto:ilgro...@apache.org]
Sent: Monday, November 28, 2011 9:13 AM
To: users@cocoon.apache.org
Subject: Re: Cocoon Forms [absolute beginner]

On 27/11/2011 02:57, nowbert3 wrote:

Hi! As mentioned in the subject, Cocoon project is something new to
me. While
still exploring, I must admit I'm beginning to really like it. The
question
is simple and perhaps a little stupid, but here goes - are there any
developed tools/editors (possibly wysiwyg) that allow simple users,
with no
xml (java) knowledge create/generate a form (actually form model,
template
etc.) directly from the web - working as some kind of cms in a more
tidy
way.

Hi,
unfortunately there is nothing about what you say above. I know that
there has been something in that direction in the past, but nothing
progressed enough to be considered usable.

Which version are you running? 2.1 or 2.2?
Anyway, if you are stepping for the first time into Cocoon fields, I'd
rather suggest you to start looking at version 3.0 [1]; despite its
alpha status, it's quite mature.
Cocoon 3.0 pushes a minimal approach: so for example you would deal
with proper web frameworks (like as Wicket [2], for example, for which a
cocoon-wicket integration module is available), leaving the XML
processing stuff to Cocoon pipelines.

If you are interested, there are some samples about Cocoon-Wicket
integration [3] and Cocoon-Hippo CMS integration [4].

Regards.

[1] https://cocoon.apache.org/3.0/
[2] http://wicket.apache.org/
[3]
http://blog.tirasa.net/blogs/index.php/ilgrosso/build-rich-xml-enabled-applications

[4]
http://blog.tirasa.net/blogs/index.php/ilgrosso/cocoon-3-and-hippo-cms



--
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
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



[ cocoon3 ] map parameters

2011-11-07 Thread Andre Juffer

Hi,

I have the following pipeline in a sitemap of some block. This pipeline 
is called by other blocks, that have components in place to upload 
images. They subsequently connect to the image block to store it in an 
image database.


The pipeline uses a self made Generator, that requires two parameters 
('creatorId' and 'filename').


map:match pattern=create/image/creator/*
  map:generate type=new-image
map:parameter name=creatorId value={map:1} /
map:parameter name=filename
   value= {jexl:cocoon.request.filename} /
  /map:generate
  map:serialize type=xml/
/map:match

Other blocks call this pipeline with a request like

http://localhost:/img/create/image/creator/3276800?filename=/tmp/3276800-tribc-eap-areal-view.jpg

The value of 'creatorId' is always null, although it should have been 
'3276800'. The value of 'filename' is OK.


Looking through the sitemap of the sample application, I did not find a 
case like the one above:


map:parameter name=creatorId value={map:1} /

My question: Is it possible to create parameter values from the request 
itself (that is, other than using request parameters)?


I can of course modify the request such that the creatorId is also 
regular request parameter, but I would like to have an answer to this 
question.


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
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



Re: [ cocoon3 ] map parameters

2011-11-07 Thread Andre Juffer

Hi Francesco,

yes, that's right, I saw that file. It is the one I was referring to, as 
a matter of fact.


Line 188 is

map:generate src=sax-pipeline/{map:1}.xml /

I have similar lines in my pipeline.

The difference is that I now have:

map:match pattern=create/image/creator/*
  map:generate type=new-image
map:parameter name=creatorId value={map:1} /
...

Thus, I am trying to pass a parameter to the Generator. When checking 
the parameter in the Generator, it is always null. In fact, there are 
many parameters available to the Generator (not set by me) and the 
'creatorId' is the only one that is null.


The request that I was using


http://localhost:/img/create/image/creator/3276800?filename=/tmp/3276800-tribc-eap-areal-view.jpg

should however give a value of 3276800 for creatorId.

Thanks,
Andre


On 11/07/2011 01:25 PM, Francesco Chicchiriccò wrote:

On 07/11/2011 11:57, Andre Juffer wrote:

Hi,

I have the following pipeline in a sitemap of some block. This
pipeline is called by other blocks, that have components in place to
upload images. They subsequently connect to the image block to store
it in an image database.

The pipeline uses a self made Generator, that requires two parameters
('creatorId' and 'filename').

map:match pattern=create/image/creator/*
map:generate type=new-image
map:parameter name=creatorId value={map:1} /
map:parameter name=filename
value= {jexl:cocoon.request.filename} /
/map:generate
map:serialize type=xml/
/map:match

Other blocks call this pipeline with a request like

http://localhost:/img/create/image/creator/3276800?filename=/tmp/3276800-tribc-eap-areal-view.jpg


The value of 'creatorId' is always null, although it should have been
'3276800'. The value of 'filename' is OK.

Looking through the sitemap of the sample application, I did not find
a case like the one above:

map:parameter name=creatorId value={map:1} /

My question: Is it possible to create parameter values from the
request itself (that is, other than using request parameters)?


Of course it is possible: take a look at line 188 of [1]; moreover, in
C3 you can also use named matches: take a look at line 40 for this.


I can of course modify the request such that the creatorId is also
regular request parameter, but I would like to have an answer to this
question.


[1]
http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/src/main/resources/COB-INF/sitemap.xmap





--
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
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



Re: [ cocoon3 ] map parameters

2011-11-07 Thread Andre Juffer

On 11/07/2011 01:43 PM, Francesco Chicchiriccò wrote:

On 07/11/2011 12:35, Andre Juffer wrote:

What happens if you use one of standard generators - like the XML
generator in the first example? I mean:

map:match pattern=create/image/creator/*
map:generate src=sax-pipeline/{map:1}.xml /

You should now get an exception for something missing: is it
sax-pipeline/3276800.xml or sax-pipeline/null.xml?



This is exactly the error I get. I tried:

map:generate src={map:1}.xml /

The exception I get

Caused by: java.io.FileNotFoundException: 
/home/juffer/TriBC/projects/cocoon3-webapp/tribc-img/src/main/resources/COB-INF/3276800.xml 
(No such file or directory)


--
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
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



Re: [ cocoon3 ] map parameters

2011-11-07 Thread Andre Juffer

On 11/07/2011 02:03 PM, Francesco Chicchiriccò wrote:

Il 07/11/2011 12:48, Andre Juffer ha scritto:

On 11/07/2011 01:43 PM, Francesco Chicchiriccò wrote:

On 07/11/2011 12:35, Andre Juffer wrote:

What happens if you use one of standard generators - like the XML
generator in the first example? I mean:

map:match pattern=create/image/creator/*
map:generate src=sax-pipeline/{map:1}.xml /

You should now get an exception for something missing: is it
sax-pipeline/3276800.xml or sax-pipeline/null.xml?



This is exactly the error I get. I tried:

map:generate src={map:1}.xml /

The exception I get

Caused by: java.io.FileNotFoundException:
/home/juffer/TriBC/projects/cocoon3-webapp/tribc-img/src/main/resources/COB-INF/3276800.xml
(No such file or directory)


Ok, this means that {map:1} is handled correctly by the sitemap, since
it is passed to XML generator.

See attached a patch for cocoon-sample that modifies the current sample
for StringTemplateGenerator by passing an additional parameter from URL
match: once applied the patch and launched mvn jetty:run under
cocoon-sample, you will be able to access URLs like as

http://localhost:/string-template/generator/anUrlParameter

getting an XML document that shows, among usual things, anUrlParameter
or whatever value you pass after generator/.

I am giving this example because StringTemplateGenerator is the first
generator coming into my mind that supports parameter passing.

I suspect there should be something wrong with your generator, then;
take a look at StringTemplateGenerator's sources [1] for reference.


OK, thanks. I have a look at your suggestions.

Please have a look the generator code that I have send in an earlier 
email. I did test the Generator by having the creatorId included as a 
regular request parameter (like 'filename'). I did work as expected.


Best regards,
André




Cheers.

[1]
http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java





-
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/
StruBioCat   | WWW: www.strubiocat.oulu.fi
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



Re: [ cocoon3 ] map parameters

2011-11-07 Thread Andre Juffer

On 11/07/2011 02:21 PM, Robby Pelssers wrote:

Hi Andre,

Are you sure these @Path annotations are correct?

In your sitemap you specify the pattern create/image/creator/*


Hi Robby,

I think you are looking at the wrong email. The code you are referring 
to is from a different email posted last week concerning an ImageResource.


The whole image thing works as follows:

1. Block A provides for a form to upload images. The form may contain 
other fields as well (this is application/block specific and not of any 
concern to the image database in block B).
2. Upon submission, block A processes the form (this is the 
ImageResource). It attaches the 'creatorId' and some other info and 
moves the image to a temporal folder (stored in 'filename'). Tested and 
works fine.
3. Block A calls block B (the image database) with 'creatorId' and 
'filename' as parameters.
4. Block B uses a NewImageGenerator to store the image in a database. 
Assigns an ID to it as well. This all is accomplished by calling a 
ImageFacade. Tested and works fine.

5. Returns XML representation to block A.
6. Block A returns XML or JSON information or whatever is required to 
the client, including a URL for use in e.g. a img src=... /.

7. Client displays image.

The above works very fine, apart from the creatorId issue when calling 
block B by block A (step 3 above). But I have resolved this now by 
including 'creatorId' as a regular request parameter instead. By doing 
so, the image is properly stored in the database, and the client sees 
the uploaded image. This confirms that the above works as expected.


Earlier, for testing purposes, I was calling block B directly (so, 
skipping step 1 and 2) to test the database image insertion in block B 
and to tests steps 3 to 5 by using a request like:


http://localhost:/img/create/image/creator/3276800?filename=/tmp/3276800-tribc-eap-areal-view.jpg

In the original implementation (as explained in my first email in this 
matter), I noticed that the creatorId inside the Generator was always 
zero if -NOT- including it as a regular request parameter, as I do now.




Below is the code for the Generator (removed some portions for clarity). 
I based it on 
org.apache.cocoon.servlet.component.RequestParametersGenerator, which is 
in the cocoon-servlet module.


code
package com.tribc.img.cocoon.servlet.component;

import com.tribc.images.interfaces.facade.ImageFacade;
import com.tribc.images.interfaces.facade.dto.ImageDTO;

import org.apache.cocoon.pipeline.component.Starter;
import org.apache.cocoon.sax.AbstractSAXProducer;
import org.apache.cocoon.sax.SAXConsumer;
import org.apache.cocoon.servlet.util.HttpContextHelper;
import org.apache.cocoon.sitemap.InvocationException;
import org.xml.sax.helpers.AttributesImpl;
import org.apache.commons.lang.Validate;

import javax.servlet.http.HttpServletRequest;

import java.util.Map;
import java.util.HashMap;

/**
 * Creates new images.
 * @author Andr#233; Juffer, Triacle Biocomputing
 */
public class NewImageGenerator extends AbstractSAXProducer implements 
Starter {


  private ImageFacade imageFacade;
  private MapString, Object parameters;

  public NewImageGenerator()
  {
this.imageFacade = null;
this.parameters = new HashMapString, Object();
  }

  public void setImageFacade(ImageFacade imageFacade)
  {
this.imageFacade = imageFacade;
  }

  @Override
  public void setup(MapString, Object parameters) {
  super.setup(parameters);
  this.parameters = parameters;
  }

  @Override
  public void execute()
  {
try
{
  String filename = (String) this.parameters.get(filename);
  Validate.notNull(filename, filename must not be null.);
  Validate.notEmpty(filename, filename must not be empty);

  String creatorId = (String) this.parameters.get(creatorId);
  Validate.notNull(creatorId, creatorId must not be null.);
  Validate.notEmpty(creatorId, creatorId must not be empty.);

  ImageDTO dto = this.imageFacade.newImage(filename, creatorId);

  SAXConsumer saxConsumer = this.getSAXConsumer();

  saxConsumer.startDocument();
 // Create XML response here using the returned dto.
 // Ommitted for clarity.
  saxConsumer.endDocument();
}
catch (Exception exception) {
  throw new InvocationException(exception.getMessage(), exception);
}
  }
}

/code

I have defined a bean like:

bean name=generator:new-image
  class=com.tribc.img.cocoon.servlet.component.NewImageGenerator
  scope=prototype
property name=imageFacade ref=tribc-images-imageFacade /
/bean


--
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
Triacle Biocomputing | WWW: www.triacle-bc.com


Re: [ cocoon3 ] map parameters

2011-11-07 Thread Andre Juffer

OK! This had an effect. Now the creatorId is NOT anymore null.

I firstly had just the void setup(..) method changed. No effect. Then 
I also included the void setConfiguration(..) method and the 
combination did it.


I am not sure what exactly is differently now. I guess the 
parameters.addAll(..) is essential. as two sets of parameters are passed 
on to generators?


Thanks!

On 11/07/2011 03:04 PM, Francesco Chicchiriccò wrote:

On 07/11/2011 13:55, Andre Juffer wrote:

[...]

@Override
public void setup(MapString, Object parameters) {
super.setup(parameters);
this.parameters = parameters;
}


Try instead (as in StringTemplateGenerator, for instance):

@Override
public void setup(final MapString, Object parameters) {
if (parameters != null  !parameters.isEmpty()) {
this.parameters.putAll(parameters);
}
}

/**
* {@inheritDoc}
*
* @see
org.apache.cocoon.pipeline.component.AbstractSAXProducer#setConfiguration(java.util.Map)

*/
@Override
public void setConfiguration(
final MapString, ? extends Object parameters) {

this.url = (URL) parameters.get(source);
setup((MapString, Object) parameters);
}

Cheers.




--
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
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



Re: [cocoon3] @Context Request request

2011-11-04 Thread Andre Juffer

Hi All,

I have followed another track to be able to an upload image file that 
are processed by a REST resource. It does not rely upon the @Context 
Request request. The Filter I have tried before (while actually working 
correctly) did cause particular issues that I was not able to correct.


Below is a copy of a simple REST ImageResource that is capable of 
extracting a single image and storing it in a given location. There is 
no need to modify anything in web.xml (as with the Filer).


Here is the code:

code

import org.apache.cocoon.configuration.Settings;
import org.apache.cocoon.rest.jaxrs.response.URLResponseBuilder;

import javax.ws.rs.*;
import javax.ws.rs.core.*;
import com.sun.jersey.multipart.*;

import java.util.*;
import java.io.*;

/**
 *
 * @author Andr#233; Juffer, Triacle Biocomputing
 */
@Path(/image)
public class ImageResource {

private String tempFolder;

public ImageResource()
{
this.tempFolder = null;
}

public void setTempFolder(String tempFolder)
{
this.tempFolder = tempFolder;
}

/**
 * Uploads a single image.
 * @param parts Requests parts.
 * @return
 */
@POST
@Path(/creator/{id})
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({application/xml, application/json})
public Response newImage(@PathParam(id) String creatorId,
 final FormDataMultiPart parts)
{
// Find part with image.
InputStream inputStream = null;
String filename = null;
IteratorBodyPart iterator = parts.getBodyParts().iterator();
while ( iterator.hasNext()  inputStream == null ) {
BodyPart bodyPart = iterator.next();
if ( this.isImage(bodyPart) ) {
inputStream = this.getInputStream(bodyPart);
filename = this.getFilename(bodyPart);
}
}

// NOTE: Other parts representing other form fields may be
// extracted as well. One can even extract more than one
// file.

// Do something with image. E.g. move to some folder.
String destFilename = tempFolder + / + filename;
MoveFile.moveToFolder(inputStream, destFilename);

// Point to e.g. a pipeline in your sitemap.
String url = ;

// Create response.
MapString, Object map = new HashMapString, Object();
return URLResponseBuilder.newInstance(url, map).build();
}

private String getFilename(BodyPart bodyPart)
{
return bodyPart.getContentDisposition().getFileName();
}

private boolean isImage(BodyPart bodyPart)
{
return bodyPart.getMediaType().getType().indexOf(image) != -1;
}

private InputStream getInputStream(BodyPart bodyPart)
{
return ((BodyPartEntity)bodyPart.getEntity()).getInputStream();
}
}

/code

You need to include in your pom.xml the following dependency:

dependency
  groupIdcom.sun.jersey.contribs/groupId
  artifactIdjersey-multipart/artifactId
  version1.8/version
/dependency

Feel free to use this code for your own purposes.

Best regards,

--
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
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



[cocoon3] @Context Request request

2011-11-02 Thread Andre Juffer
I was able to resolve one or two problems. The commons fileupload FAQ 
gave a hint [1]. Thus, I looked for a solution that relies on a Filter 
and came across [2]. This Filter creates a HttpServletRequestWrapper 
(implements HttpServletRequest) that parses the request whenever dealing 
with a file upload using commons fileupload. This works very nice. I was 
supposed to see two FileItems [3] (which I never got up to this point) 
and this is now exactly what I get. Thus, the request is parsed properly 
and everything (including the image file) is available.


However, the filter continues with

aChain.doFilter(wrapper, aResponse);

and this eventually results in an exception (listing below just the 
cocoon part):


com.sun.jersey.api.container.ContainerException: 
javax.mail.MessagingException: Missing start boundary
at 
com.sun.jersey.server.impl.model.method.dispatch.MultipartFormDispatchProvider.processForm(MultipartFormDispatchProvider.java:91)


at 
org.apache.cocoon.rest.jaxrs.container.CocoonJAXRSServlet.service(CocoonJAXRSServlet.java:60)


at 
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:481)
at 
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:455)
at 
org.apache.cocoon.servletservice.spring.ServletFactoryBean$ServiceInterceptor.invoke(ServletFactoryBean.java:245)

...
com.tribc.servlet.FileUploadFilter.doFilter(FileUploadFilter.java:70) 
(This is the aChain.doFilter(wrapper, aResponse);

...

Therefore, the request now never reaches the ImageResource.

I cannot really understand the exception. The 
javax.mail.MessagingException is puzzling. I have to assume that in [2] 
something is not entirely correct, as the exception only occurs whenever 
the filter is employed. I do not see it. As said, the parsing appears to 
work just fine. Hopefully one of you has a clue.


Thanks,
André



[1] http://commons.apache.org/fileupload/faq.html#empty-parse
[2] http://www.javapractices.com/topic/TopicAction.do?Id=221
[3] 
http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileItem.html


--
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
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



Re: [cocoon3] @Context Request request

2011-10-31 Thread Andre Juffer

Steven,

thanks for the reply.

The purpose of the request is to upload an image file. With commons 
fileupload this is straightforward, but it requires direct access to 
HttpServletRequest. I did understand that HttpServletRequest is an 
interface of course.


With commons fileupload, one would do something like

FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
ListFileItem items = upload.parseRequest(request);

Here, 'request' must be (an implementation of) HttpServletRequest. One 
of 'items' would contain the image.


If I use

public Response uploadImage(@Context Request request)

the type of 'request' is com.sun.jersey.spi.container.ContainerRequest, 
which will not work with 'upload.parseRequest(request)' above. The 
ContainerRequest does not implement HttpServletRequest. Following your 
email, one should see for 'request' a HttpServletRequest? I would agree 
with this, given the statement at the jersey website When deploying a 
JAX-RS application using servlet then ServletConfig, ServletContext, 
HttpServletRequest and HttpServletResponse are available using @Context..


With

public Response uploadImage(@Context HttpServletRequest request)

the type of request is some proxy (this is the name of an implementing 
class, something like $Proxy38).


In any case, i -did- use public Response uploadImage(@Context 
HttpServletRequest request) and noticed that the request is empty (that 
is, the ListFileItem  above is empty). That is, no image file is 
available, although it was sent correctly (checked with Firebug).


So, my conclusion was that something is not working correctly and that's 
why I was wondering about the type of request. The POST request on the 
client was something like


http://localhost:/eap/rest/image

with jetty as the servlet engine. I cannot be sure what happens in 
between sending the request and the handling by 
'ImageResource.uploadImage(..)'.



One thing, though (just occurred to me while preparing this email): I 
did use


ListFileItem items = upload.parseRequest(request);

which possibly should be

List items = upload.parseRequest(request);

(so no generics). The version of fileupload I use is 1.2.1 (if I 
correctly remember), but I will look into this this evening.


Thanks,
Andre



On 10/31/2011 11:44 AM, Steven Dolg wrote:

Am 30.10.2011 18:35, schrieb Andre Juffer:

Hi,

for processing a multipart/form-data request holding image data, I 
intend to use the commons imageupload [1]. In order to do so, I need 
to get access to the javax.servlet.http.HttpServletRequest object 
inside a REST resource. The @Context annotation injects information 
about the request, see e.g. [2] and also [3], but the request object 
should implement the javax.ws.rs.core.Request interface (I think).


How can I get to the HttpServletRequest inside a REST resource. Is 
there a way to convert Request to 
javax.servlet.http.HttpServletRequest? According to [4],When 
deploying a JAX-RS application using servlet then ServletConfig, 
ServletContext, HttpServletRequest and HttpServletResponse are 
available using @Context. But how?


Right now, I assume

@POST
public Response uploadImage(@Context HttpServletRequest request) {
.
}

but I do not believe this is actually correct.

The actual type is com.sun.jersey.spi.container.ContainerRequest 
(implements Request), according to request.getClass().getName().


There is nothing in the request itself, while I see with Firebug that 
the image file is sent to the server in the proper way.


Hi André,

the code fragment you posted appears to be correct and conform with 
Jersey - the JAX-RS implementation used by Cocoon 3.


If you receive a value in the parameter request, then it will be of 
type HttpServletRequest. The JVM won't allow anything else.
Of course you receive an actual implementation, since 
HttpServletRequest is only an interface.


So the question is:
What do you want to do with the request and why do you believe it is 
not working correctly?


Cheers,
Steven



Thanks,
André


[1] http://commons.apache.org/fileupload/index.html
[2] http://cocoon.apache.org/3.0/reference/html/webapps.html
[3] 
http://jsr311.java.net/nonav/releases/1.1/javax/ws/rs/core/Context.html

[4] http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e524





-
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


-
To unsubscribe, e-mail

Re: [cocoon3] @Context Request request

2011-10-31 Thread Andre Juffer

Steven,

I have a number of REST resources all working just fine. It is just this 
image upload thing that is not working correctly. I can add to my 
previous email that I am using dojo 1.6.1 on the client to create the 
POST request.


And, yes, jetty is a common servlet engine and should not cause any 
particular problem. I did read somewhere that during uploading files, 
each file may be temporally stored in some location on the server (the 
actual location is controlled by the web server and/or servlet engine) 
before control is passed on to, in my case, the ImageResource.


Thanks for your help,
André

On 10/31/2011 12:40 PM, Steven Dolg wrote:

Am 31.10.2011 11:29, schrieb Andre Juffer:

Steven,

thanks for the reply.

The purpose of the request is to upload an image file. With commons 
fileupload this is straightforward, but it requires direct access to 
HttpServletRequest. I did understand that HttpServletRequest is an 
interface of course.


With commons fileupload, one would do something like

FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
ListFileItem items = upload.parseRequest(request);

Here, 'request' must be (an implementation of) HttpServletRequest. 
One of 'items' would contain the image.


If I use

public Response uploadImage(@Context Request request)

the type of 'request' is 
com.sun.jersey.spi.container.ContainerRequest, which will not work 
with 'upload.parseRequest(request)' above. The ContainerRequest does 
not implement HttpServletRequest. Following your email, one should 
see for 'request' a HttpServletRequest? I would agree with this, 
given the statement at the jersey website When deploying a JAX-RS 
application using servlet then ServletConfig, ServletContext, 
HttpServletRequest and HttpServletResponse are available using 
@Context..


With

public Response uploadImage(@Context HttpServletRequest request)

the type of request is some proxy (this is the name of an 
implementing class, something like $Proxy38).


In any case, i -did- use public Response uploadImage(@Context 
HttpServletRequest request) and noticed that the request is empty 
(that is, the ListFileItem  above is empty). That is, no image file 
is available, although it was sent correctly (checked with Firebug).


So, my conclusion was that something is not working correctly and 
that's why I was wondering about the type of request. The POST 
request on the client was something like


http://localhost:/eap/rest/image

with jetty as the servlet engine. I cannot be sure what happens in 
between sending the request and the handling by 
'ImageResource.uploadImage(..)'.


I'm sorry, but I'm not familiar with commons-fileupload and not very 
familiar with Jersey.

All I can say is that your problem is (probably) not within Cocoon.

Using some rather uncommon Servlet-Container is a good source for 
obscure problems, but Jetty is very common and should work fine.


At this time I can only advise you to check the documentation for 
commons-fileupload an maybe try to get it working with a very simple 
servlet without any Cocoon, Jersey and any other framework at all.





One thing, though (just occurred to me while preparing this email): I 
did use


ListFileItem items = upload.parseRequest(request);

which possibly should be

List items = upload.parseRequest(request);

(so no generics). The version of fileupload I use is 1.2.1 (if I 
correctly remember), but I will look into this this evening.


Generics cannot have an effect on this.
At worst you would receive a ClassCastException at runtime, but it 
cannot alter the result in any way.





Thanks,
Andre



-
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


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



Re: [cocoon3] @Context Request request

2011-10-31 Thread Andre Juffer

On 10/31/2011 01:17 PM, Steven Dolg wrote:

Am 31.10.2011 12:00, schrieb Andre Juffer:

Steven,

I have a number of REST resources all working just fine. It is just 
this image upload thing that is not working correctly. I can add to 
my previous email that I am using dojo 1.6.1 on the client to create 
the POST request.


Should have worded that more carefully. :/
My advice was not to abandon Cocoon / Jersey completely.

I just feel that it helps tremendously to reduce the complexity of the 
solution, when you can't figure out why something's not working as 
expected.
Reducing the number of parts (in this case frameworks) of your 
solution is usually the easiest way to eliminate complexity.


Once you get the simple solution to work you either already know why 
it didn't work in the first place or you can go back to adding your 
target technologies one by one and see which introduces the problem.



I got your point. I will try this:

http://docs.codehaus.org/display/JETTY/File+Upload+in+jetty6

(no cocoon, no jersey)

and adapt it to work with commons fileupload.





And, yes, jetty is a common servlet engine and should not cause any 
particular problem. I did read somewhere that during uploading files, 
each file may be temporally stored in some location on the server 
(the actual location is controlled by the web server and/or servlet 
engine) before control is passed on to, in my case, the ImageResource.


Thanks for your help,
André

On 10/31/2011 12:40 PM, Steven Dolg wrote:

Am 31.10.2011 11:29, schrieb Andre Juffer:

Steven,

thanks for the reply.

The purpose of the request is to upload an image file. With commons 
fileupload this is straightforward, but it requires direct access 
to HttpServletRequest. I did understand that HttpServletRequest is 
an interface of course.


With commons fileupload, one would do something like

FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
ListFileItem items = upload.parseRequest(request);

Here, 'request' must be (an implementation of) HttpServletRequest. 
One of 'items' would contain the image.


If I use

public Response uploadImage(@Context Request request)

the type of 'request' is 
com.sun.jersey.spi.container.ContainerRequest, which will not work 
with 'upload.parseRequest(request)' above. The ContainerRequest 
does not implement HttpServletRequest. Following your email, one 
should see for 'request' a HttpServletRequest? I would agree with 
this, given the statement at the jersey website When deploying a 
JAX-RS application using servlet then ServletConfig, 
ServletContext, HttpServletRequest and HttpServletResponse are 
available using @Context..


With

public Response uploadImage(@Context HttpServletRequest request)

the type of request is some proxy (this is the name of an 
implementing class, something like $Proxy38).


In any case, i -did- use public Response uploadImage(@Context 
HttpServletRequest request) and noticed that the request is empty 
(that is, the ListFileItem  above is empty). That is, no image 
file is available, although it was sent correctly (checked with 
Firebug).


So, my conclusion was that something is not working correctly and 
that's why I was wondering about the type of request. The POST 
request on the client was something like


http://localhost:/eap/rest/image

with jetty as the servlet engine. I cannot be sure what happens in 
between sending the request and the handling by 
'ImageResource.uploadImage(..)'.


I'm sorry, but I'm not familiar with commons-fileupload and not very 
familiar with Jersey.

All I can say is that your problem is (probably) not within Cocoon.

Using some rather uncommon Servlet-Container is a good source for 
obscure problems, but Jetty is very common and should work fine.


At this time I can only advise you to check the documentation for 
commons-fileupload an maybe try to get it working with a very simple 
servlet without any Cocoon, Jersey and any other framework at all.





One thing, though (just occurred to me while preparing this email): 
I did use


ListFileItem items = upload.parseRequest(request);

which possibly should be

List items = upload.parseRequest(request);

(so no generics). The version of fileupload I use is 1.2.1 (if I 
correctly remember), but I will look into this this evening.


Generics cannot have an effect on this.
At worst you would receive a ClassCastException at runtime, but it 
cannot alter the result in any way.





Thanks,
Andre



-
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




--
Andre H. Juffer  | Phone: +358-8-553 1161
Biocenter Oulu

Re: [cocoon3] @Context Request request

2011-10-31 Thread Andre Juffer

On 10/31/2011 01:46 PM, Thorsten Scherler wrote:

On Sun, 2011-10-30 at 19:35 +0200, Andre Juffer wrote:

Hi,

for processing a multipart/form-data request holding image data, I
intend to use the commons imageupload [1]. In order to do so, I need to
get access to the javax.servlet.http.HttpServletRequest object inside a
REST resource. The @Context annotation injects information about the
request, see e.g. [2] and also [3], but the request object should
implement the javax.ws.rs.core.Request interface (I think).

How can I get to the HttpServletRequest inside a REST resource. Is there
a way to convert Request to javax.servlet.http.HttpServletRequest?
According to [4],When deploying a JAX-RS application using servlet then
ServletConfig, ServletContext, HttpServletRequest and
HttpServletResponse are available using @Context. But how?

http://stackoverflow.com/questions/6984338/how-to-forward-from-a-jax-ws-service-to-jsp

like you have


Yes, indeed. I don't have the exception though.




Right now, I assume

@POST
public Response uploadImage(@Context HttpServletRequest request) {
.
}

but I do not believe this is actually correct.

It should.


Yes, it seems now that this should be the case.




The actual type is com.sun.jersey.spi.container.ContainerRequest
(implements Request), according to request.getClass().getName().

There is nothing in the request itself, while I see with Firebug that
the image file is sent to the server in the proper way.


Hmm
http://jersey.java.net/nonav/apidocs/1.9.1/jersey/com/sun/jersey/spi/container/ContainerRequest.html

did you try a simple cast before

upload.parseRequest(request);

?


Actually no. But this should not work, as ContainerRequest is not 
implementing HttpServletRequest, right? I have no access to my code from 
where I am right now, but I will try a simple cast this evening.


Just to be sure that this is clear. The type of 'request' is 
com.sun.jersey.spi.container.ContainerRequest -only- when I use


public Response uploadImage(@Context Request request)


NOTE: if you are familiar with commons fileupload:

http://commons.apache.org/fileupload/faq.html#empty-parse

With firebug I can confirm that the image file has been sent.




salu2


Thanks,
André


[1] http://commons.apache.org/fileupload/index.html
[2] http://cocoon.apache.org/3.0/reference/html/webapps.html
[3] http://jsr311.java.net/nonav/releases/1.1/javax/ws/rs/core/Context.html
[4] http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e524





--
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


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



Re: [cocoon3] @Context Request request

2011-10-31 Thread Andre Juffer

OK, this settles it then.

@Path(/image)
class ImageResource {

  @POST
  @Path()
  public Response uploadImage(@Context HttpServletRequest request) {
   // Do something with request
  }
}

is correct.
Thanks,
André



On 10/31/2011 03:04 PM, Thorsten Scherler wrote:

On Mon, 2011-10-31 at 14:34 +0200, Andre Juffer wrote:

On 10/31/2011 01:46 PM, Thorsten Scherler wrote:

On Sun, 2011-10-30 at 19:35 +0200, Andre Juffer wrote:

Hi,

for processing a multipart/form-data request holding image data, I
intend to use the commons imageupload [1]. In order to do so, I need to
get access to the javax.servlet.http.HttpServletRequest object inside a
REST resource. The @Context annotation injects information about the
request, see e.g. [2] and also [3], but the request object should
implement the javax.ws.rs.core.Request interface (I think).

How can I get to the HttpServletRequest inside a REST resource. Is there
a way to convert Request to javax.servlet.http.HttpServletRequest?
According to [4],When deploying a JAX-RS application using servlet then
ServletConfig, ServletContext, HttpServletRequest and
HttpServletResponse are available using @Context. But how?

http://stackoverflow.com/questions/6984338/how-to-forward-from-a-jax-ws-service-to-jsp

like you have

Yes, indeed. I don't have the exception though.


Right now, I assume

@POST
public Response uploadImage(@Context HttpServletRequest request) {
.
}

but I do not believe this is actually correct.

It should.

Yes, it seems now that this should be the case.


The actual type is com.sun.jersey.spi.container.ContainerRequest
(implements Request), according to request.getClass().getName().

There is nothing in the request itself, while I see with Firebug that
the image file is sent to the server in the proper way.


Hmm
http://jersey.java.net/nonav/apidocs/1.9.1/jersey/com/sun/jersey/spi/container/ContainerRequest.html

did you try a simple cast before

upload.parseRequest(request);

?

Actually no. But this should not work, as ContainerRequest is not
implementing HttpServletRequest, right? I have no access to my code from
where I am right now, but I will try a simple cast this evening.

Just to be sure that this is clear. The type of 'request' is
com.sun.jersey.spi.container.ContainerRequest -only- when I use

public Response uploadImage(@Context Request request)



That is correct, however you supposed to do like I wrote in my other
mail:

 @Context
 private HttpServletRequest request;

  ...
request.getRemoteAddr();

As you see you do not need a cast but simply asking for the correct
type.

@Context HttpServletRequest request in method call should work the same.

HTH

salu2




--
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


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



[cocoon3] @Context Request request

2011-10-30 Thread Andre Juffer

Hi,

for processing a multipart/form-data request holding image data, I 
intend to use the commons imageupload [1]. In order to do so, I need to 
get access to the javax.servlet.http.HttpServletRequest object inside a 
REST resource. The @Context annotation injects information about the 
request, see e.g. [2] and also [3], but the request object should 
implement the javax.ws.rs.core.Request interface (I think).


How can I get to the HttpServletRequest inside a REST resource. Is there 
a way to convert Request to javax.servlet.http.HttpServletRequest? 
According to [4],When deploying a JAX-RS application using servlet then 
ServletConfig, ServletContext, HttpServletRequest and 
HttpServletResponse are available using @Context. But how?


Right now, I assume

@POST
public Response uploadImage(@Context HttpServletRequest request) {
.
}

but I do not believe this is actually correct.

The actual type is com.sun.jersey.spi.container.ContainerRequest 
(implements Request), according to request.getClass().getName().


There is nothing in the request itself, while I see with Firebug that 
the image file is sent to the server in the proper way.


Thanks,
André


[1] http://commons.apache.org/fileupload/index.html
[2] http://cocoon.apache.org/3.0/reference/html/webapps.html
[3] http://jsr311.java.net/nonav/releases/1.1/javax/ws/rs/core/Context.html
[4] http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e524


--
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
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



[ cocoon 3] Spring configuration

2011-10-11 Thread Andre Juffer

Hi Francesco,

The Spring configuration component [1] was in fact already used by 
default when running the applications as a web application, so that that 
actually did not solve the issue.


My beans for each application are specified in a XML placed 
META-INF/cocoon/spring (globally accessible therefore) inside a block. 
As I wanted to make them know only to the block that requires them, I 
moved the definitions to COB-INF/config/spring/ (locally accessible 
beans, not accessible from any other block). This in fact follows [2]. 
Note, however, it is not at clear whether or not cocoon 3 follows the 
organization in [2].


I also created a few REST resources, the definitions of which were 
placed also in the same bean definition file in COB-INF/config/spring/ 
(local). This did not work. The CocoonJAXRSServlet defined in 
block-servlet-service.xml in META-INF/cocoon/spring (global) could not 
find these local resources. So, I moved them into the 
block-servlet-service.xml (global). However, this resulted in another 
problem. The REST resource uses Facades to communicate with the domain 
layer and the underlying databases. These facades are defined as beans 
in the bean configuration file located in COB-INF/config/spring/ 
(local). When running just the block itself, the beans defined 
block-servlet-service.xml (global beans) cannot find the locally defined 
beans in COB-INF/config/spring/. Trying to do this as actual web 
application (and using [1]), gives the same problem. So, the only way to 
solve this is to make all bean definitions global, which is not what I 
want and or require.


Running individual blocks with all beans defined as global is fine. The 
block works prefect. So, I am probably make all beans global, give them 
IDs that are truly unique.


[1] 
https://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/2.1/1304_1_1.html

[2] https://cocoon.apache.org/2.2/core-modules/core/2.2/1263_1_1.html
--
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



Re: cocoon 3: Javascript in jars

2011-10-10 Thread Andre Juffer

On 08/10/11 14:02, Francesco Chicchiriccò wrote:
I did this in another (Cocoon3-based) project: It should be enough 
to add a class like [1], then add a bean like as


!-- Using classpath: resources --
bean 
class=org.onehippo.forge.hct.cocoon.internal.ClasspathURLStreamHandlerFactory/


in one of spring's XMLs.


Yes, this looks promising. So, this would mean that the following 
would work?


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

I will try this (later today).



Hei, I am curious: did this work at the end?


Actually, looking through the code of cocoon 3, it was not clear to me 
how this would work. But I will have another look to see how this work 
for other readers.


In the mean time, I have looked for an alternative solution and found 
one from the Dojo website at


http://dojotoolkit.org/documentation/tutorials/1.6/cdn/

So, dojo itself is stored elsewhere (some CDN) and I allow the 
application to load Javascript specific to the application by defining a 
module path, so that I can do for instance


dojo.require(my.appl.main)

and a main.js is loaded from the specified module path at, say, 
dojo/js/my/appl.main.js where dojo/js is the module path relative to 
the context. So, for now my problem is solved.





Regads.


Thanks,
André




Regards.

[1] 
https://forge.onehippo.org/svn/hct/trunk/core/src/main/java/org/onehippo/forge/hct/cocoon/internal/ClasspathURLStreamHandlerFactory.java

--
Francesco Chicchiriccò

Apache Cocoon Committer and PMC Member
http://people.apache.org/~ilgrosso/



--
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


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



Re: [ cocoon 3] Spring configuration

2011-10-10 Thread Andre Juffer

On 08/10/11 14:01, Francesco Chicchiriccò wrote:

On 06/10/2011 20:38, Andre Juffer wrote:

Hi,

is there is similar different in scope as with Cocoon 2.2 with regard 
to the location of Spring configuration files? I am referring to


http://cocoon.apache.org/2.2/core-modules/core/2.2/1263_1_1.html

e.g. beans defined by some Spring configuration files in 
/META-INF/cocoon/spring/ are globally accessible, while those in 
/COB-INF/config/spring/ are local to the block.


Would the same be applicable to Cocoon 3?

I will be running three application in the same servlet container as 
three different blocks. They will share 2 other blocks. I want to be 
quite sure that I do not mix the beans from different blocks. My 
first attempt resulted in app 1 reading a database of app 2, which of 
course should not be.


I have for each blocks a few REST resources defined. Can I have them 
defined in a Spring configuration file in /COB-INF/config/spring/ 
(local) while they are referring to a 
org.apache.cocoon.servlet.XMLSitemapServlet defined in a Spring 
configuration located in /META-INF/cocoon/spring/ (global). Will this 
work properly?


Hi Andre, and sorry for late response.


Better late than never!


As you can read at [1] and linked pages, Cocoon Spring Configurator is 
a subproject not directly dependent on a particular Cocoon version. 
Namely, what reported at [1] refers to the version that Cocoon 3 is 
using (check it at [2]).


Yes, this is actually true. So, in principle this all would work as 
stated above. I am going to reorganize a bit the bean definitions this 
evening and see that I get this work.




Does this help?


Any response is helpful. Thanks for the reply,
André


Regards.

[1] 
https://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/2.0/1304_1_1.html

[2] http://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/parent/pom.xml




--
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


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



[ cocoon 3] Spring configuration

2011-10-06 Thread Andre Juffer

Hi,

is there is similar different in scope as with Cocoon 2.2 with regard to 
the location of Spring configuration files? I am referring to


http://cocoon.apache.org/2.2/core-modules/core/2.2/1263_1_1.html

e.g. beans defined by some Spring configuration files in 
/META-INF/cocoon/spring/ are globally accessible, while those in 
/COB-INF/config/spring/ are local to the block.


Would the same be applicable to Cocoon 3?

I will be running three application in the same servlet container as 
three different blocks. They will share 2 other blocks. I want to be 
quite sure that I do not mix the beans from different blocks. My first 
attempt resulted in app 1 reading a database of app 2, which of course 
should not be.


I have for each blocks a few REST resources defined. Can I have them 
defined in a Spring configuration file in /COB-INF/config/spring/ 
(local) while they are referring to a 
org.apache.cocoon.servlet.XMLSitemapServlet defined in a Spring 
configuration located in /META-INF/cocoon/spring/ (global). Will this 
work properly?


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



Re: cocoon3 : apache 2 - jetty-1.6.7

2011-09-23 Thread Andre Juffer

Hi Thorsten,

I am not sure whether or not there is a problem with the JsonSerializer. 
In the c3-based application I am working on, the first file that is 
loaded is a regular HTML file (served by apache-jetty-cocoon). This is 
where the problem actually occurs. The JsonSerializer is not being used 
at all during this initial phase. Only -after- the dojo-1.6.1 based 
application starts up, the application contacts the cocoon3-based server 
for additional content. The server always returns this particular 
content as JSON  and only then the JsonSerializer is relied upon.


Having said this, I am not entirely clear on the internal organization 
of cocoon3, so I could easily have overlooked and probably did overlook 
something. As said, modifying the site map from


map:match pattern=
 map:read src=index.html /
/map:match

to

map:match pattern=
 map:read src=index.html mime-type=text/html/
/map:match

resolves the issue completely (that is, the index.html is properly interpreted 
as text/html and the application starts and actually works fine (version 
0.0.1)). The index.html is returned by an (Encoding)(X)HTMLSerializer and not 
by my (Encoding)JsonSerializer. So, this why I concluded that the problem is 
actually not related to the JsonSerializer.


But I will go through your remarks in this email and at COCOON3-77. The 
content-type and mime-type part was actually not entirely to me where 
and how exactly they had to be set. So, you hit the right spot.


Thanks for your reply,
André



On 23/09/11 11:59, Thorsten Scherler wrote:

On Thu, 2011-09-22 at 23:05 +0300, Andre Juffer wrote:

On 09/22/2011 11:28 AM, Thorsten Scherler wrote:

On Thu, 2011-09-22 at 00:58 +0300, Andre Juffer wrote:

Note  mimeType=null  in the first case. Thus the request reaches
cocoon3, but somewhere the mimeType is set to null, or, when its
value
is requested, the mimeType returns null.

Bug? Or just my fold (I suspect the JsonSerializer [1])

To limit the range


a bit, what happens when you use html or xml

serialization?

The following two requests read a html (index.html) file containing Dojo
javascript. The response should be of type text/html in order to run the
javascript for the application to start. For both requests below, the
index.html -is- in fact returned.

These are the test results:

1)
http://localhost/app/tct

186790 [btpool0-2] INFO org.apache.cocoon.servlet.RequestProcessor -
Performing GET request at /app/tct
186819 [btpool0-2] INFO org.apache.cocoon.servlet.RequestProcessor -
Going to send GET response: mimeType=null, contentLength=1706,
statusCode=200, lastModified=1316719151000

2)
http://localhost/app/tct/index.html

287900 [btpool0-6] INFO org.apache.cocoon.servlet.RequestProcessor -
Performing GET request at /app/tct/index.html
287919 [btpool0-6] INFO org.apache.cocoon.servlet.RequestProcessor -
Going to send NOT MODIFIED response: statusCode=304,
lastModified=1316719151000


Sitemap contains:

For 1):

map:match pattern=
  map:read src=index.html /
/map:match

For 2)

map:match equals=index.html
  map:read src=index.html /
/map:match

THUS: The first response has no mime-type set (mimeType=null). The
browser (firefox) interprets the response of type text/plain (thus no
javascript will run, no startup of the application will occur). The
mime-type of the second request is text/html, as it should be.

If I now make the change in the sitemap to handle request 1):

map:match pattern=
  map:read src=index.html mime-type=text/html/
/map:match

and repeat the first request (http://localhost/app/tct), I -do- get the
proper response (that is, text/html):


135151 [btpool0-8] INFO org.apache.cocoon.servlet.RequestProcessor -
Performing GET request at /app/tct
135166 [btpool0-8] INFO org.apache.cocoon.servlet.RequestProcessor -
Going to send NOT MODIFIED response: statusCode=304,
lastModified=1316720003000
135166 [btpool0-8] INFO org.apache.cocoon.servlet.RequestProcessor -
Sitemap execution for /app/tct took 15.131032 ms.

and the application starts normally.


Thus, I would say that the mime-type of the response is not properly set
(probably null by default) or not detected for case 1), when
communicating with a web server that forwarded the original request to
the servlet container (jetty-6.1.7)? This perhaps points to a problem in
ResponseHeaderCollector.java and pipeline.getContentType()?


Actually I think the problems lies in the code you attached to
COCOON3-77 (I just made a comment there). My first try would be to try
to extend from AbstractSAXSerializer and/or implements Finisher.

The important point is
@Override
 public void setConfiguration(MapString, ? extends Object
configuration) {
 if (configuration.containsKey(mime-type)) {
 this.contentType = (String) configuration.get(mime-type);
 }
 }

 /**
  * @param contentType The type of the content produced

Re: cocoon3 : apache 2 - jetty-1.6.7

2011-09-23 Thread Andre Juffer

On 23/09/11 13:52, Thorsten Scherler wrote:


Ah ok, sorry I have not understood correctly the first time. Ok if so
then I think you found a bug since above would hit:

 @Override
 public void setConfiguration(MapString, ? extends Object
configuration) {
 this.setSource((URL) configuration.get(source));
 this.setMimeType((String) configuration.get(mime-type));
 }
in AbstractReader. Since in the first place that that value is null .


Yeah, that would make sense to me.


In the

then we do

public String getContentType() {
 if (this.mimeType != null) {
 return this.mimeType;
 }

 URLConnection connection = null;
 try {
 connection = this.source.openConnection();
 return connection.getContentType();
 } catch (IOException e) {
 throw new ProcessingException(e);
 } finally {
 URLConnectionUtils.closeQuietly(connection);
 }
 }

Meaning if this.mimeType == null and the connection fails then and only
then it should return null. Now the question is why
- either fails the connection
- or the connection.getContentType() returns null.


If I have some time over the next week or so, I will debug the 
application to see what actually happens.


I'll keep you posted,
André


salu2


But I will go through your remarks in this email and at COCOON3-77. The
content-type and mime-type part was actually not entirely to me where
and how exactly they had to be set. So, you hit the right spot.

Thanks for your reply,
André



On 23/09/11 11:59, Thorsten Scherler wrote:

On Thu, 2011-09-22 at 23:05 +0300, Andre Juffer wrote:

On 09/22/2011 11:28 AM, Thorsten Scherler wrote:

On Thu, 2011-09-22 at 00:58 +0300, Andre Juffer wrote:

Note  mimeType=null  in the first case. Thus the request reaches
cocoon3, but somewhere the mimeType is set to null, or, when its
value
is requested, the mimeType returns null.

Bug? Or just my fold (I suspect the JsonSerializer [1])

To limit the range

a bit, what happens when you use html or xml

serialization?

The following two requests read a html (index.html) file containing Dojo
javascript. The response should be of type text/html in order to run the
javascript for the application to start. For both requests below, the
index.html -is- in fact returned.

These are the test results:

1)
http://localhost/app/tct

186790 [btpool0-2] INFO org.apache.cocoon.servlet.RequestProcessor -
Performing GET request at /app/tct
186819 [btpool0-2] INFO org.apache.cocoon.servlet.RequestProcessor -
Going to send GET response: mimeType=null, contentLength=1706,
statusCode=200, lastModified=1316719151000

2)
http://localhost/app/tct/index.html

287900 [btpool0-6] INFO org.apache.cocoon.servlet.RequestProcessor -
Performing GET request at /app/tct/index.html
287919 [btpool0-6] INFO org.apache.cocoon.servlet.RequestProcessor -
Going to send NOT MODIFIED response: statusCode=304,
lastModified=1316719151000


Sitemap contains:

For 1):

 map:match pattern=
   map:read src=index.html /
 /map:match

For 2)

 map:match equals=index.html
   map:read src=index.html /
 /map:match

THUS: The first response has no mime-type set (mimeType=null). The
browser (firefox) interprets the response of type text/plain (thus no
javascript will run, no startup of the application will occur). The
mime-type of the second request is text/html, as it should be.

If I now make the change in the sitemap to handle request 1):

 map:match pattern=
   map:read src=index.html mime-type=text/html/
 /map:match

and repeat the first request (http://localhost/app/tct), I -do- get the
proper response (that is, text/html):


135151 [btpool0-8] INFO org.apache.cocoon.servlet.RequestProcessor -
Performing GET request at /app/tct
135166 [btpool0-8] INFO org.apache.cocoon.servlet.RequestProcessor -
Going to send NOT MODIFIED response: statusCode=304,
lastModified=1316720003000
135166 [btpool0-8] INFO org.apache.cocoon.servlet.RequestProcessor -
Sitemap execution for /app/tct took 15.131032 ms.

and the application starts normally.


Thus, I would say that the mime-type of the response is not properly set
(probably null by default) or not detected for case 1), when
communicating with a web server that forwarded the original request to
the servlet container (jetty-6.1.7)? This perhaps points to a problem in
ResponseHeaderCollector.java and pipeline.getContentType()?


Actually I think the problems lies in the code you attached to
COCOON3-77 (I just made a comment there). My first try would be to try
to extend from AbstractSAXSerializer and/or implements Finisher.

The important point is
@Override
  public void setConfiguration(MapString, ? extends Object
configuration) {
  if (configuration.containsKey(mime-type)) {
  this.contentType = (String) configuration.get(mime-type);
  }
  }

  /**
   * @param

cocoon3 : apache 2 - jetty-1.6.7

2011-09-21 Thread Andre Juffer

Hi,

not sure whether this is a bug or not. I have deployed an cocoon3 based 
application (termed 'tct'). Everything works fine. I have only one 
final problem to solve.


To get it working with Apache 2, I usually use

  ProxyPass /tct http://localhost:/app3/tct
  ProxyPassReverse /tct http://localhost:/app3/tct

to forward the request to the servlet engine.

Without exception this has worked extremely well with Cocoon 2 based 
applications.


I do exactly the same thing now with cocoon 3.

With
http://foo.bar.org/tct

218748 [btpool0-498] INFO org.apache.cocoon.servlet.RequestProcessor - 
Going to send GET response: mimeType=null, contentLength=1706, 
statusCode=200, lastModified=1316640662000


With
http://foo.bar.org:/app3/tct

324989 [btpool0-4] INFO org.apache.cocoon.servlet.RequestProcessor - 
Going to send GET response: mimeType=application/json; charset=UTF-8, 
contentLength=5263, statusCode=200, lastModified=-1


Note  mimeType=null  in the first case. Thus the request reaches 
cocoon3, but somewhere the mimeType is set to null, or, when its value 
is requested, the mimeType returns null.


Bug? Or just my fold (I suspect the JsonSerializer [1])

Thanks,

[1] http://www.mail-archive.com/users@cocoon.apache.org/msg46270.html

--
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



Cocoon3: string-template; collections

2011-09-20 Thread Andre Juffer

Hi,

I am dealing with the following. I created a simple REST resource, like 
(without setters):


@Path(/test)
public class TestResource {

@GET
@Path(/{id})
public Response getTest(@PathParam(id) String id)
{
TestDTO testDTO = this.testFacade.find(id);
MapString, Object map = new HashMapString, Object();
map.put(test, testDTO);
return 
URLResponseBuilder.newInstance(servlet:tribc-tct:/test.json, map).build();

}
}

The TestFacade returns a DTO (data transfer object) and this DTO exposes 
a number of getters. The application must be able to return both XML and 
JSON. So, I place the DTO in a map and 'call' the sitemap for generated 
the response (here as JSON):


map:match pattern=*.json
  map:generate type=string-template src=xml/{map:1}.xml /
  map:transform src=xsl/xml2json.xsl /
  map:transform type=logasxml/
  map:transform type=log/
  map:serialize type=json /  !-- This serializer is my own --
/map:match

The test.xml looks like:

test
testId$test.testId$/testId
name$test.name$/name
!-- and more ...-
/test

You can see that the DTO that was stored in the map is used in the 
test.xml to create an XML representation of the DTO. The above works 
fine (see StringTemplate [1]). The XML is subsequently transformed to JSON.


My problem is now how to use string-template when dealing with a 
collection. That is, the TestFacade returns a collection of DTOs 
(CollectonTestDTO), for which I need to make an XML (or JSON) 
representation, like:


tests
  test.../test
  test.../test
/tests

My question: How to iterate through a collection of objects with 
string-template to create the above, if the collection is stored in a 
map. The StringTemplate pages are not very easy to read and I did not 
really find a clue how to handle this particular problem. In cocoon 2.2 
one could use jx:forEach ..., which was extremely convenient. I was 
hoping that there is a simular way with string-template.


Thanks for any help,

--
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



Re: help needed for migrating Cocoon2.2 to Spring 3

2011-09-15 Thread Andre Juffer
Never done this myself, but I would download all source of the stable 
C2.2. I would then modify all the Spring configuration files, however, 
not the bean declarations, but only schema declarations, namespaces, 
etc. Finally, change all Spring dependencies in all relevant pom.xml 
(your cocoon applications, including those in the dependencies) to 
depend on Spring 3. At this point I would not change anything else.


If you succeed with this, and your application actually works, you can 
start using more recent packages for FOP, etc. I would do update each 
package one by one. First update the 'simple' ones (log4j, etc). After 
each change, verify that your application works.


These are rather general and probably obvious steps, I guess.

Good luck, I would bet my money on cocoon3. From what I have seen, and 
for what I intend to use it for (REST-like applications), cocoon3 is 
pretty ready to roll.


Best,
André

On 15/09/11 10:08, Robby Pelssers wrote:


Hi all,

I've seen plenty of people asking for coming up with a new release 
Cocoon2.3 where cocoon would ship with:


- Spring 3
- Dojo 1.x
- EhCache 2.3.x
- FOP 1.0

In our particular case we would already be satisfied with being able 
to switch to Spring 3. But so far no single successful upgrade path 
has been described on the mailinglist.  It also looks as no effort is 
being put in Cocon2.2 anymore.  I just want to get some confirmation 
on this.


We might be able to hold of making this switch for a small period of 
time but as a precaution I want to understand if it is wiser bet my 
money on Cocoon3 (which does not even have a stable version yet) or 
wait for a new version of Cocoon2.2 which might never see daylight.


Ps. If anyone could already give the steps to take to do it ourselves 
we would be very thankfull.


Kind regards,

Robby Pelssers




--
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



cocoon 3: Javascript in jars

2011-09-14 Thread Andre Juffer

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?


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



Re: cocoon 3: Javascript in jars

2011-09-14 Thread Andre Juffer

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? 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).


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.


Thanks,
André



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

Hi Andre,

2011/9/14 Andre Juffer ajuf...@cc.oulu.fi mailto: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

tel:%2B358-8-553%201161
Biocenter Oulu and   | Fax: +358-8-553-1141
tel:%2B358-8-553-1141
Department of Biochemistry   | Email: andre.juf...@oulu.fi
mailto: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
http://www.strubiocat.oulu.fi
NordProt | WWW: www.nordprot.org
http://www.nordprot.org
Triacle Biocomputing | WWW: www.triacle-bc.com
http://www.triacle-bc.com

-
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





--
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: cocoon 3: Javascript in jars

2011-09-14 Thread Andre Juffer

On 14/09/11 14:35, Javier Puerto wrote:



2011/9/14 Andre Juffer andre.juf...@oulu.fi 
mailto: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


OK, understood.



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.


There may be another way. It is possibly called differently? I tried 
classpath://..., but didn't work either. E.g. Spring uses this 
protocol as well to load configuration located in jars. Very convenient.




Thanks,
André


Salu2.





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

Hi Andre,

2011/9/14 Andre Juffer ajuf...@cc.oulu.fi
mailto: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

tel:%2B358-8-553%201161
Biocenter Oulu and   | Fax: +358-8-553-1141
tel:%2B358-8-553-1141
Department of Biochemistry   | Email: andre.juf...@oulu.fi
mailto: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
http://www.strubiocat.oulu.fi
NordProt | WWW: www.nordprot.org
http://www.nordprot.org
Triacle Biocomputing | WWW: www.triacle-bc.com
http://www.triacle-bc.com

-
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





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

Re: cocoon 3: Javascript in jars

2011-09-14 Thread Andre Juffer

On 14/09/11 15:13, Francesco Chicchiriccò wrote:

On 14/09/2011 13:58, Andre Juffer wrote:

On 14/09/11 14:35, Javier Puerto wrote:

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


There may be another way. It is possibly called differently? I tried 
classpath://..., but didn't work either. E.g. Spring uses this 
protocol as well to load configuration located in jars. Very convenient.


I did this in another (Cocoon3-based) project: It should be enough to 
add a class like [1], then add a bean like as


!-- Using classpath: resources --
bean 
class=org.onehippo.forge.hct.cocoon.internal.ClasspathURLStreamHandlerFactory/


in one of spring's XMLs.


Yes, this looks promising. So, this would mean that the following would 
work?


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

I will try this (later today).

Thanks,
André




Regards.

[1] 
https://forge.onehippo.org/svn/hct/trunk/core/src/main/java/org/onehippo/forge/hct/cocoon/internal/ClasspathURLStreamHandlerFactory.java

--
Francesco Chicchiriccò

Apache Cocoon Committer and PMC Member
http://people.apache.org/~ilgrosso/



--
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: Cocoon3, JSON, Spring

2011-09-14 Thread Andre Juffer

On 14/09/11 17:01, Thorsten Scherler wrote:

On Sun, 2011-09-11 at 23:16 +0300, Andre Juffer wrote:

Also, my comment about the FopSerializer deriving from a XMLSerializer
is in fact incorrect, so just ignore that one. I got that apparently
confused with something else (I looked at too much code apparently...).

There are however more than one XMLSerializers in use for cocoon3.

Yes, since we support SAX and StAX so we need two different
XMLSerializer since on is triggered by SAX events and the other by StAX.

BTW please open an issue in the cocoon3 jira project and add the patches
so a committer can apply them.


OK. Thanks.


TIA

salu2



--
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


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



Cocoon 3: REST

2011-09-13 Thread Andre Juffer

Hi,

It appears that there are basically two ways of implementing a REST 
service with cocoon3. There is the RESTController way and there is the 
JAX-RS way. I have tried the latter. If a resource (e.g PersonResource) 
is requested, I create a response that uses the string-template 
generator to produce an initial XML with person data (like name, etc), 
followed by a transformer that converts it to JSON file (the JSON is 
basically wrapped inside a single element), followed by a JSONSerializer 
(which validates the JSON text) to generate the actual response that is 
send back to the client (as application/json). This works just 
perfectly. See a previous email [1] with regard to the JSonSerializer 
(any comments?).


I am bit wondering why there are two ways of doing REST. The 
RESTController looks very much the same as the JAX-RS based resource. 
With the controller, I would call the same pipeline (using 
URLResponseBuilder) as explained above. The RESTController looks 
slightly different, but otherwise does the same thing.


So, what exactly was the reason to have both a RESTController and 
JAX-RS-way of approach? Is there a preferred way. Should I assume that 
the RESTController would become the preferred way of implementing REST?


[1] http://www.mail-archive.com/users@cocoon.apache.org/msg46270.html

--
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



Re: Cocoon3, JSON, Spring

2011-09-11 Thread Andre Juffer

Hi Thorsten,

I did do some work on a TextSerializer and a JsonSerializer. I got it 
all working now.


I looked at the EncodingXHTMLSerializer as a starting point. I should 
note that I basically know nothing about the internal organization of 
cocoon 3, and this makes it really hard for an outsider to contribute, 
as it is rather unclear where to start. Sorry to say but the 
documentation in the various AIPs is really terrible. The organization 
of the classes explained below may be incorrect.


I made a EncodingTextSerializer-TextSerializer-XMLSerializer (the 
arrow means 'extend'). Both TextSerializer and XMLSerializer are in the 
package org.apache.cocoon.components.serializers.util. (Note: The 
XMLSerializer was already available, it is not mine). The 
EncodingTextSerializer is part of 
org.apache.cocoon.optional.servlet.components.sax.serializers
The TextSerializer is based upon one I found in the cocoon 2 base code, 
but had to be augmented to implement the ContentHandler and other 
interfaces.


Similarly, I made EncodingJsonSerializer-JsonSerializer-TextSerializer.

The JsonSerializer checks whether the JSON text is actually valid JSON 
(using org.json.JSONObject, see http://www.json.org/), and throws a 
SAXException if this is not the case.


The EncodingJsonSerializer is in 
org.apache.cocoon.optional.servlet.components.sax.serializers, while the 
JsonSerializer is in org.apache.cocoon.components.serializers.util.


Both encoding classes implement SAXPipelineComponent, Finisher, 
SAXConsumer, CachingPipelineComponent so that both encoding serializers 
can be used in a pipeline.


(NOTE: there appears to be 2-3 different XMLSerializers in use for 
cocoon 3? E.g. The FopSerializer derives from another XMLSerializer. It 
should be quite possible to use the same XMLSerializer for all serializers.)


Using an encoding serializer requires an alternative encoder for the 
TextSerializer, so I made a TextEncoder-XMLEncoder for use by the 
TextSerializer. Both TextEncoder and XMLEncoder are in 
org.apache.cocoon.components.serializers.encoding (the XMLEncoder 
already exists, it is not mine). The TextEncoder does not encode 
anything. It just returns the original character. There is no separate 
JsonEncoder.


Basically, this all works with the simple test files I made. It is easy 
to test this outside of cocoon, by creating an XMLReader and setting the 
ContentHandler as being any of the above serializers and parse some XML 
representing text or JSON (both must be enclosed by a single element).


I also incorporated this into cocoon 3 and made some simple pipelines to 
see if the two encoding serializers work as they should. For this, I 
created two beans defined as serializer:text and serializer:json. 
Basically everything seems to work just fine.


(I use a Java-based RESTClient at http://code.google.com/p/rest-client/ 
to see the response by cocoon 3. Very nice tool.)


I have attached the various classes to this email. Any comment by you 
and others are certainly welcome. If you think that attached code is 
actually useful for cocoon 3, I would be pleased if somebody would 
commit the code.


One final comment, IMHO the packages 
org.apache.cocoon.components.serializers.util and 
org.apache.cocoon.components.serializers.encoding should be transferred 
to cocoon 3 and probably should become part of cocoon-optional. The 
spring configuration in these packages are still based on Spring 2, 
while cocoon 3 uses Spring 3.


Thanks,
André



On 09/02/2011 02:31 PM, Andre Juffer wrote:

On 02/09/11 13:45, Thorsten Scherler wrote:

On Fri, 2011-09-02 at 09:58 +0300, Andre Juffer wrote:

On 09/02/2011 02:46 AM, Thorsten Scherler wrote:

Hi Andre,

sorry for top posting but I am responding from my mobile device.

Regarding 1) the org.apache.cocoon.serialization.TextSerializer
migration into c3 is ASAIK not yet done. However that should be
pretty straight forward to implement.

Yes, I was already thinking that I could do this.

Contributions are always welcome. ;)

If you or somebody else will do the migration please open an issue in
https://issues.apache.org/jira/browse/COCOON3 and attach the diff. We
will apply it ASAP.


OK, I do my best to get it done.





Actually I did lately work with the RESTController of c3 since the
JAX-RS integration was not needed for my use cases. If you choose
the c3 REST way you can use the TextResponse [1] to return your json
objects to the client. In the same package you will as well find a
BinaryResponse [2] which you can use to return binary data like
images from your rest services.

The TextResponse is a good alternative, and I will certainly look into
it. It is apparently not yet part of the current alpha Cocoon
3.0.0-alpha-3 that I downloaded from the cocoon website.

No you would need the HEAD or the latest beta snapshot.


I just commited an example [3] of an asyncron processing with REST
you may want to look into. It is based on jquery on the client side
but you

Re: Cocoon3, JSON, Spring

2011-09-11 Thread Andre Juffer
I forgot to add the Spring 3 bean configuration for the serializers. 
Please see the attachment.



On 09/11/2011 04:03 PM, Andre Juffer wrote:

Hi Thorsten,

I did do some work on a TextSerializer and a JsonSerializer. I got it
all working now.

I looked at the EncodingXHTMLSerializer as a starting point. I should
note that I basically know nothing about the internal organization of
cocoon 3, and this makes it really hard for an outsider to contribute,
as it is rather unclear where to start. Sorry to say but the
documentation in the various AIPs is really terrible. The organization
of the classes explained below may be incorrect.

I made a EncodingTextSerializer-TextSerializer-XMLSerializer (the
arrow means 'extend'). Both TextSerializer and XMLSerializer are in the
package org.apache.cocoon.components.serializers.util. (Note: The
XMLSerializer was already available, it is not mine). The
EncodingTextSerializer is part of
org.apache.cocoon.optional.servlet.components.sax.serializers
The TextSerializer is based upon one I found in the cocoon 2 base code,
but had to be augmented to implement the ContentHandler and other
interfaces.

Similarly, I made EncodingJsonSerializer-JsonSerializer-TextSerializer.

The JsonSerializer checks whether the JSON text is actually valid JSON
(using org.json.JSONObject, see http://www.json.org/), and throws a
SAXException if this is not the case.

The EncodingJsonSerializer is in
org.apache.cocoon.optional.servlet.components.sax.serializers, while the
JsonSerializer is in org.apache.cocoon.components.serializers.util.

Both encoding classes implement SAXPipelineComponent, Finisher,
SAXConsumer, CachingPipelineComponent so that both encoding serializers
can be used in a pipeline.

(NOTE: there appears to be 2-3 different XMLSerializers in use for
cocoon 3? E.g. The FopSerializer derives from another XMLSerializer. It
should be quite possible to use the same XMLSerializer for all
serializers.)

Using an encoding serializer requires an alternative encoder for the
TextSerializer, so I made a TextEncoder-XMLEncoder for use by the
TextSerializer. Both TextEncoder and XMLEncoder are in
org.apache.cocoon.components.serializers.encoding (the XMLEncoder
already exists, it is not mine). The TextEncoder does not encode
anything. It just returns the original character. There is no separate
JsonEncoder.

Basically, this all works with the simple test files I made. It is easy
to test this outside of cocoon, by creating an XMLReader and setting the
ContentHandler as being any of the above serializers and parse some XML
representing text or JSON (both must be enclosed by a single element).

I also incorporated this into cocoon 3 and made some simple pipelines to
see if the two encoding serializers work as they should. For this, I
created two beans defined as serializer:text and serializer:json.
Basically everything seems to work just fine.

(I use a Java-based RESTClient at http://code.google.com/p/rest-client/
to see the response by cocoon 3. Very nice tool.)

I have attached the various classes to this email. Any comment by you
and others are certainly welcome. If you think that attached code is
actually useful for cocoon 3, I would be pleased if somebody would
commit the code.

One final comment, IMHO the packages
org.apache.cocoon.components.serializers.util and
org.apache.cocoon.components.serializers.encoding should be transferred
to cocoon 3 and probably should become part of cocoon-optional. The
spring configuration in these packages are still based on Spring 2,
while cocoon 3 uses Spring 3.

Thanks,
André



On 09/02/2011 02:31 PM, Andre Juffer wrote:

On 02/09/11 13:45, Thorsten Scherler wrote:

On Fri, 2011-09-02 at 09:58 +0300, Andre Juffer wrote:

On 09/02/2011 02:46 AM, Thorsten Scherler wrote:

Hi Andre,

sorry for top posting but I am responding from my mobile device.

Regarding 1) the org.apache.cocoon.serialization.TextSerializer
migration into c3 is ASAIK not yet done. However that should be
pretty straight forward to implement.

Yes, I was already thinking that I could do this.

Contributions are always welcome. ;)

If you or somebody else will do the migration please open an issue in
https://issues.apache.org/jira/browse/COCOON3 and attach the diff. We
will apply it ASAP.


OK, I do my best to get it done.





Actually I did lately work with the RESTController of c3 since the
JAX-RS integration was not needed for my use cases. If you choose
the c3 REST way you can use the TextResponse [1] to return your json
objects to the client. In the same package you will as well find a
BinaryResponse [2] which you can use to return binary data like
images from your rest services.

The TextResponse is a good alternative, and I will certainly look into
it. It is apparently not yet part of the current alpha Cocoon
3.0.0-alpha-3 that I downloaded from the cocoon website.

No you would need the HEAD or the latest beta snapshot.


I just commited an example [3] of an asyncron processing

Re: Cocoon3, JSON, Spring

2011-09-11 Thread Andre Juffer
Also, my comment about the FopSerializer deriving from a XMLSerializer 
is in fact incorrect, so just ignore that one. I got that apparently 
confused with something else (I looked at too much code apparently...).


There are however more than one XMLSerializers in use for cocoon3. The 
XMLSerializer that I have used is from cocoon 2, which is the one that 
is also employed for the cocoon3' (X)EncodingHTMLSerializer and 
EncodingXMLSerializer. So, there are 3 XMLSerializer in use.


On 09/11/2011 04:14 PM, Andre Juffer wrote:

I forgot to add the Spring 3 bean configuration for the serializers.
Please see the attachment.


On 09/11/2011 04:03 PM, Andre Juffer wrote:

Hi Thorsten,

I did do some work on a TextSerializer and a JsonSerializer. I got it
all working now.

I looked at the EncodingXHTMLSerializer as a starting point. I should
note that I basically know nothing about the internal organization of
cocoon 3, and this makes it really hard for an outsider to contribute,
as it is rather unclear where to start. Sorry to say but the
documentation in the various AIPs is really terrible. The organization
of the classes explained below may be incorrect.

I made a EncodingTextSerializer-TextSerializer-XMLSerializer (the
arrow means 'extend'). Both TextSerializer and XMLSerializer are in the
package org.apache.cocoon.components.serializers.util. (Note: The
XMLSerializer was already available, it is not mine). The
EncodingTextSerializer is part of
org.apache.cocoon.optional.servlet.components.sax.serializers
The TextSerializer is based upon one I found in the cocoon 2 base code,
but had to be augmented to implement the ContentHandler and other
interfaces.

Similarly, I made EncodingJsonSerializer-JsonSerializer-TextSerializer.

The JsonSerializer checks whether the JSON text is actually valid JSON
(using org.json.JSONObject, see http://www.json.org/), and throws a
SAXException if this is not the case.

The EncodingJsonSerializer is in
org.apache.cocoon.optional.servlet.components.sax.serializers, while the
JsonSerializer is in org.apache.cocoon.components.serializers.util.

Both encoding classes implement SAXPipelineComponent, Finisher,
SAXConsumer, CachingPipelineComponent so that both encoding serializers
can be used in a pipeline.

(NOTE: there appears to be 2-3 different XMLSerializers in use for
cocoon 3? E.g. The FopSerializer derives from another XMLSerializer. It
should be quite possible to use the same XMLSerializer for all
serializers.)

Using an encoding serializer requires an alternative encoder for the
TextSerializer, so I made a TextEncoder-XMLEncoder for use by the
TextSerializer. Both TextEncoder and XMLEncoder are in
org.apache.cocoon.components.serializers.encoding (the XMLEncoder
already exists, it is not mine). The TextEncoder does not encode
anything. It just returns the original character. There is no separate
JsonEncoder.

Basically, this all works with the simple test files I made. It is easy
to test this outside of cocoon, by creating an XMLReader and setting the
ContentHandler as being any of the above serializers and parse some XML
representing text or JSON (both must be enclosed by a single element).

I also incorporated this into cocoon 3 and made some simple pipelines to
see if the two encoding serializers work as they should. For this, I
created two beans defined as serializer:text and serializer:json.
Basically everything seems to work just fine.

(I use a Java-based RESTClient at http://code.google.com/p/rest-client/
to see the response by cocoon 3. Very nice tool.)

I have attached the various classes to this email. Any comment by you
and others are certainly welcome. If you think that attached code is
actually useful for cocoon 3, I would be pleased if somebody would
commit the code.

One final comment, IMHO the packages
org.apache.cocoon.components.serializers.util and
org.apache.cocoon.components.serializers.encoding should be transferred
to cocoon 3 and probably should become part of cocoon-optional. The
spring configuration in these packages are still based on Spring 2,
while cocoon 3 uses Spring 3.

Thanks,
André



On 09/02/2011 02:31 PM, Andre Juffer wrote:

On 02/09/11 13:45, Thorsten Scherler wrote:

On Fri, 2011-09-02 at 09:58 +0300, Andre Juffer wrote:

On 09/02/2011 02:46 AM, Thorsten Scherler wrote:

Hi Andre,

sorry for top posting but I am responding from my mobile device.

Regarding 1) the org.apache.cocoon.serialization.TextSerializer
migration into c3 is ASAIK not yet done. However that should be
pretty straight forward to implement.

Yes, I was already thinking that I could do this.

Contributions are always welcome. ;)

If you or somebody else will do the migration please open an issue in
https://issues.apache.org/jira/browse/COCOON3 and attach the diff. We
will apply it ASAP.


OK, I do my best to get it done.





Actually I did lately work with the RESTController of c3 since the
JAX-RS integration was not needed for my use cases. If you choose
the c3

Re: Cocoon3, JSON, Spring

2011-09-02 Thread Andre Juffer

On 09/02/2011 02:46 AM, Thorsten Scherler wrote:

Hi Andre,

sorry for top posting but I am responding from my mobile device.

Regarding 1) the org.apache.cocoon.serialization.TextSerializer migration into 
c3 is ASAIK not yet done. However that should be pretty straight forward to 
implement.


Yes, I was already thinking that I could do this.


Actually I did lately work with the RESTController of c3 since the JAX-RS 
integration was not needed for my use cases. If you choose the c3 REST way you 
can use the TextResponse [1]  to return your json objects to the client. In the 
same package you will as well find a BinaryResponse [2] which you can use to 
return binary data like images from your rest services.


The TextResponse is a good alternative, and I will certainly look into 
it. It is apparently not yet part of the current alpha Cocoon 
3.0.0-alpha-3 that I downloaded from the cocoon website.


I just commited an example [3] of an asyncron processing with REST you may want to look 
into. It is based on jquery on the client side but you will get the idea. If you look at 
[4] you will see the basic background. The block provides a workig example when starting 
with mvn install jetty:run and browse to localhost:/,


Great!



Regarding the bean lookup, why not using autowiring in your components (more 
when you use the REST part)? See [5].


Yes, that would do it.

Thanks for your valuable response.
André



HTH

[1] 
http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java
[2] 
http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/BinaryResponse.java
[3] http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest-optional/
[4] https://issues.apache.org/jira/browse/COCOON3-75
[5] 
http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/controller/DemoRESTController.java?view=markup

Thorsten Scherlerthorsten.at.apache.org
codeBusters S.L. - web based systemsconsulting, training and solutions
http://www.codebusters.es

Andre Jufferajuf...@cc.oulu.fi  wrote:


Hi All,

I have two questions:

(1)
I want to be to be able to return JSON to the client, typically a
browser. The client is responsible to properly present the response to
the user, typically with the Dojotoolkit. As I would like to move to
cocoon3, I was looking for a JsonSerializer or a simple TextSerializer.

With cocoon 2.2, one can simply use the TextSerializer to return JSON,
by defining

map:serializer name=json mime-type=application/json; charset=UTF-8
 src=org.apache.cocoon.serialization.TextSerializer
   encodingUTF-8/encoding
/map:serializer

Cocoon 3 apparently is restricted to only return XML/HTML [1], as far as
I can see. I did not find in the API any mentioning of other types of
serializers, besides XMLSerializer and FopSerializer.

If so, this would be a limitation. Especially for designing RIAs [2]
(like Twitter), it would be very useful to be able to return JSON.

So, is there a particular way to return JSON or Text.


(2)
With flowscript in cocoon 2.2, it was very easy to instantiate a Java
bean defined in some appropriate Spring bean configuration file, like

var someFacade = cocoon.getComponent(someFacade);
someFacade.doSomething(...);

Is there a recommended way in Cocoon 3 to instantiate beans. One could do

ApplicationContext context =
   new ClassPathXmlApplicationContext( new String[]
{beans-spring.cfg.xml);
SomeFacade facade = (SomeFacade)context.getBean(someFacade);
facade.doSomething(...);

within a JAX-RS resource [3].

So, is this way to do instantiate beans?

Thanks,
Andre


[1] http://cocoon.apache.org/3.0/features.html
[2] http://en.wikipedia.org/wiki/Rich_Internet_application
[3] http://cocoon.apache.org/3.0/referenc/html/webapps.html#webapps.rest

--
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/
StruBioCat   | WWW: www.strubiocat.oulu.fi
NordProt | WWW: www.nordprot.org
Triacle Biocomputing | WWW: www.triacle-bc.com


Re: Cocoon3, JSON, Spring

2011-09-02 Thread Andre Juffer

On 02/09/11 13:45, Thorsten Scherler wrote:

On Fri, 2011-09-02 at 09:58 +0300, Andre Juffer wrote:

On 09/02/2011 02:46 AM, Thorsten Scherler wrote:

Hi Andre,

sorry for top posting but I am responding from my mobile device.

Regarding 1) the org.apache.cocoon.serialization.TextSerializer migration into 
c3 is ASAIK not yet done. However that should be pretty straight forward to 
implement.

Yes, I was already thinking that I could do this.

Contributions are always welcome. ;)

If you or somebody else will do the migration please open an issue in
https://issues.apache.org/jira/browse/COCOON3 and attach the diff. We
will apply it ASAP.


OK, I do my best to get it done.





Actually I did lately work with the RESTController of c3 since the JAX-RS 
integration was not needed for my use cases. If you choose the c3 REST way you 
can use the TextResponse [1]  to return your json objects to the client. In the 
same package you will as well find a BinaryResponse [2] which you can use to 
return binary data like images from your rest services.

The TextResponse is a good alternative, and I will certainly look into
it. It is apparently not yet part of the current alpha Cocoon
3.0.0-alpha-3 that I downloaded from the cocoon website.

No you would need the HEAD or the latest beta snapshot.


I just commited an example [3] of an asyncron processing with REST you may want to look 
into. It is based on jquery on the client side but you will get the idea. If you look at 
[4] you will see the basic background. The block provides a workig example when starting 
with mvn install jetty:run and browse to localhost:/,

Great!

Actually I am still thinking on implementing comet
http://en.wikipedia.org/wiki/Comet_(programming) Actually long polling
should not to be too complicate to be implemented with our REST
framework (hopefully I will find some play time for implementing
that). ;)

However html5 will open some new approaches to the comet technique where
Server-sent events and websockets come into play, but I think there we
need to make some changes to our controller.

Somebody had worked with streaming message in cocoon yet?


Regarding the bean lookup, why not using autowiring in your components (more 
when you use the REST part)? See [5].

Yes, that would do it.

Thanks for your valuable response.

you are welcome. I am glad if it helps you.

salu2


André


HTH

[1] 
http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/TextResponse.java
[2] 
http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest/src/main/java/org/apache/cocoon/rest/controller/response/BinaryResponse.java
[3] http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-rest-optional/
[4] https://issues.apache.org/jira/browse/COCOON3-75
[5] 
http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/controller/DemoRESTController.java?view=markup

Thorsten Scherlerthorsten.at.apache.org
codeBusters S.L. - web based systemsconsulting, training and solutions
http://www.codebusters.es

Andre Jufferajuf...@cc.oulu.fi   wrote:


Hi All,

I have two questions:

(1)
I want to be to be able to return JSON to the client, typically a
browser. The client is responsible to properly present the response to
the user, typically with the Dojotoolkit. As I would like to move to
cocoon3, I was looking for a JsonSerializer or a simple TextSerializer.

With cocoon 2.2, one can simply use the TextSerializer to return JSON,
by defining

map:serializer name=json mime-type=application/json; charset=UTF-8
  src=org.apache.cocoon.serialization.TextSerializer
encodingUTF-8/encoding
/map:serializer

Cocoon 3 apparently is restricted to only return XML/HTML [1], as far as
I can see. I did not find in the API any mentioning of other types of
serializers, besides XMLSerializer and FopSerializer.

If so, this would be a limitation. Especially for designing RIAs [2]
(like Twitter), it would be very useful to be able to return JSON.

So, is there a particular way to return JSON or Text.


(2)
With flowscript in cocoon 2.2, it was very easy to instantiate a Java
bean defined in some appropriate Spring bean configuration file, like

var someFacade = cocoon.getComponent(someFacade);
someFacade.doSomething(...);

Is there a recommended way in Cocoon 3 to instantiate beans. One could do

ApplicationContext context =
new ClassPathXmlApplicationContext( new String[]
{beans-spring.cfg.xml);
SomeFacade facade = (SomeFacade)context.getBean(someFacade);
facade.doSomething(...);

within a JAX-RS resource [3].

So, is this way to do instantiate beans?

Thanks,
Andre


[1] http://cocoon.apache.org/3.0/features.html
[2] http://en.wikipedia.org/wiki/Rich_Internet_application
[3] http://cocoon.apache.org/3.0/referenc/html/webapps.html#webapps.rest

--
Andre H. Juffer  | Phone: +358-8-553 1161
Biocenter Oulu and   | Fax: +358-8-553-1141

Cocoon3, JSON, Spring

2011-09-01 Thread Andre Juffer

Hi All,

I have two questions:

(1)
I want to be to be able to return JSON to the client, typically a 
browser. The client is responsible to properly present the response to 
the user, typically with the Dojotoolkit. As I would like to move to 
cocoon3, I was looking for a JsonSerializer or a simple TextSerializer.


With cocoon 2.2, one can simply use the TextSerializer to return JSON, 
by defining


map:serializer name=json mime-type=application/json; charset=UTF-8
src=org.apache.cocoon.serialization.TextSerializer
  encodingUTF-8/encoding
/map:serializer

Cocoon 3 apparently is restricted to only return XML/HTML [1], as far as 
I can see. I did not find in the API any mentioning of other types of 
serializers, besides XMLSerializer and FopSerializer.


If so, this would be a limitation. Especially for designing RIAs [2] 
(like Twitter), it would be very useful to be able to return JSON.


So, is there a particular way to return JSON or Text.


(2)
With flowscript in cocoon 2.2, it was very easy to instantiate a Java 
bean defined in some appropriate Spring bean configuration file, like


var someFacade = cocoon.getComponent(someFacade);
someFacade.doSomething(...);

Is there a recommended way in Cocoon 3 to instantiate beans. One could do

ApplicationContext context =
  new ClassPathXmlApplicationContext( new String[] 
{beans-spring.cfg.xml);

SomeFacade facade = (SomeFacade)context.getBean(someFacade);
facade.doSomething(...);

within a JAX-RS resource [3].

So, is this way to do instantiate beans?

Thanks,
Andre


[1] http://cocoon.apache.org/3.0/features.html
[2] http://en.wikipedia.org/wiki/Rich_Internet_application
[3] http://cocoon.apache.org/3.0/referenc/html/webapps.html#webapps.rest

--
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



Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-15 Thread Andre Juffer
Ok, thanks. It is a bit counterintuitive. One would not expect that to 
be possible, but it works.


On 15/08/11 08:23, Thomas Markus wrote:

Hi,

i missed the private

i tried direct access and it works fine:

var U = Packages.com.foo bar.UseFul;
U.someMethod('text1', 'stringb');

Packages.com.foo.bar.UseFul.someMethod('text1', 'stringb');


public class UseFul {

private UseFul() {}

public static void someMethod(String a, String b) {
System.out.println(a= + a +   b= + b);
}

}


I'm using C2.2

regards
Thomas


Am 14.08.2011 20:20, schrieb Andre Juffer:

On 08/14/2011 03:04 PM, Thomas Markus wrote:

Hi,

or create an instance without spring:

var bean = new com.foo.bar.Useful();
bean.someMethod(arg1, arg2);


Actually, this would (should) not work as the constructor of Useful 
is private. It may be that this would not matter in flow, that is, 
one can call private constructors (did not try). In Spring this is 
possible. 


-
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


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



Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-14 Thread Andre Juffer

On 08/14/2011 03:04 PM, Thomas Markus wrote:

Hi,

or create an instance without spring:

var bean = new com.foo.bar.Useful();
bean.someMethod(arg1, arg2);


Actually, this would (should) not work as the constructor of Useful is 
private. It may be that this would not matter in flow, that is, one can 
call private constructors (did not try). In Spring this is possible.


regards
Thomas

Am 12.08.2011 15:34, schrieb Andre Juffer:

To answer my own question. I created a new entry in the application's
Spring configuration file,

bean id=com.foo.bar.Useful class=com.foo.bar.Useful /

In script, I used

var useful = cocoon.getComponent(com.foo.bar.Useful);
useful.someMethod(arg1, arg2);

This does not require any modification to the source code of the class
(that is, the private constructor remains private). It is bit
cheating, but alas, such is life.

On 08/12/2011 02:53 PM, Andre Juffer wrote:

Hi,

I am dealing with the following. An extremely useful Java class provides
a static method for completing a particular task, like

class Useful {
private Useful() {}

public static void someMethod(String arg1, String arg2)
{
...
}

}

In flow, I do something like

var arg1 = test1;
var arg2 = test2;
Packages.com.foo.bar.Useful.someMethod(arg1, arg2);

The error I get is

Java constructor for com.foo.bar.Useful.someMethod with arguments
java.lang.String,java.lang.String not found.

My question is now. How can I call a static method on a Java class, if
at all, in Flowscript. One solution is to make the constructor of the
class public (certainly not my preference).

Thanks,







-
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/
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



C2.2: Accessing static method on Java object with Flowscript

2011-08-12 Thread Andre Juffer

Hi,

I am dealing with the following. An extremely useful Java class provides 
a static method for completing a particular task, like


class Useful {
  private Useful() {}

  public static void someMethod(String arg1, String arg2)
  {
  ...
  }

}

In flow, I do something like

var arg1 = test1;
var arg2 = test2;
Packages.com.foo.bar.Useful.someMethod(arg1, arg2);

The error I get is

Java constructor for com.foo.bar.Useful.someMethod with arguments 
java.lang.String,java.lang.String not found.


My question is now. How can I call a static method on a Java class, if 
at all, in Flowscript. One solution is to make the constructor of the 
class public (certainly not my preference).


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
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



Re: C2.2: Accessing static method on Java object with Flowscript

2011-08-12 Thread Andre Juffer
To answer my own question. I created a new entry in the application's 
Spring configuration file,


bean id=com.foo.bar.Useful class=com.foo.bar.Useful /

In script, I used

var useful = cocoon.getComponent(com.foo.bar.Useful);
useful.someMethod(arg1, arg2);

This does not require any modification to the source code of the class 
(that is, the private constructor remains private). It is bit cheating, 
but alas, such is life.


On 08/12/2011 02:53 PM, Andre Juffer wrote:

Hi,

I am dealing with the following. An extremely useful Java class provides
a static method for completing a particular task, like

class Useful {
private Useful() {}

public static void someMethod(String arg1, String arg2)
{
...
}

}

In flow, I do something like

var arg1 = test1;
var arg2 = test2;
Packages.com.foo.bar.Useful.someMethod(arg1, arg2);

The error I get is

Java constructor for com.foo.bar.Useful.someMethod with arguments
java.lang.String,java.lang.String not found.

My question is now. How can I call a static method on a Java class, if
at all, in Flowscript. One solution is to make the constructor of the
class public (certainly not my preference).

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



Re: [C3] Cocoon3 beta-1-SNAPSHOTs available

2011-07-01 Thread Andre Juffer

Hi Francesco,

thanks for the information. I did look at previous versions already. If 
most (preferable all) of the functionality of C2.2 is preserved in C3, 
that a smooth transition of an existing application to C3 is feasible, 
after which one could replacing 'older' portion by 'newer' portions in 
due course.


Best regards,
Andre



On 07/01/2011 10:19 AM, Francesco Chicchiriccò wrote:

On 30/06/2011 18:55, Andre Juffer wrote:

Simo,

how much of Cocoon 2.2's functionality is still available in Cocoon 3.
Using sitemaps in the 2.2 way is actually rather convenient in a
number of cases. I assume that this all is still possible with cocoon 3?


Hi Andre,
the good old way to pipelines is still there in Cocoon 3, even though
it is - at least at the moment - provided with less components
(generators / transformers / serializers) that 2.1 and 2.2.

To have an idea about Cocoon 3 features, I suggest you to take a quick
look at the sources of C3 sample block [1] and C3 sample web application
[2]: if you are familiar with 2.2, you should get easily into the code.

Moreover, consider that archetypes are also available, so you can start
your own block with:

mvn archetype:generate \
-DarchetypeGroupId=org.apache.cocoon.archetype-block \
-DarchetypeArtifactId=cocoon-archetype-block \
-DarchetypeRepository=https://repository.apache.org/content/repositories/snapshots
\
-DarchetypeVersion=3.0.0-beta-1-SNAPSHOT

launch it with

mvn package jetty:run

and access it at http://localhost:/

Finally, C3 provides a native integration with Wicket in which you can
use either the new (java) and old (XML) approach: look at this blog
entry [3] for more details.

Cheers.

[1] https://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample/
[2]
https://svn.apache.org/repos/asf/cocoon/cocoon3/trunk/cocoon-sample-webapp/
[3]
http://chicchiricco.blogspot.com/2011/06/build-rich-xml-enabled-applications.html



On 06/30/2011 06:52 PM, Simone Tripodi wrote:

Hi all guys,
just to let you know that Cocoon3 beta-1-SNAPSHOTs artifacts are
available on ASF snapshot repository, to start playing with them you
just need to add the ASF snapshot repository[1] in your pom.xml.
Enjoy and have fun, feedbacks are always appreciated!!!
Have a nice day,
Simo

[1] https://repository.apache.org/content/groups/snapshots/



--
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



Re: [C3] Cocoon3 beta-1-SNAPSHOTs available

2011-06-30 Thread Andre Juffer

Simo,

how much of Cocoon 2.2's functionality is still available in Cocoon 3. 
Using sitemaps in the 2.2 way is actually rather convenient in a number 
of cases. I assume that this all is still possible with cocoon 3?


thanks,
André

On 06/30/2011 06:52 PM, Simone Tripodi wrote:

Hi all guys,
just to let you know that Cocoon3 beta-1-SNAPSHOTs artifacts are
available on ASF snapshot repository, to start playing with them you
just need to add the ASF snapshot repository[1] in your pom.xml.
Enjoy and have fun, feedbacks are always appreciated!!!
Have a nice day,
Simo

[1] https://repository.apache.org/content/groups/snapshots/

http://people.apache.org/~simonetripodi/
http://www.99soft.org/

-
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/
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



Re: best way to show login page when session expires? (Javascript/Java based Cocoon app.)

2011-05-19 Thread Andre Juffer

On 19/05/11 13:38, Paul Joseph wrote:

HI Thorsten,

Thank you much for your two suggestions.  I will proceed with your 
second course as it is very easy to do that given the way the app is 
written.


Just like to add that the Auth approach basically works in the same way. 
An action is available that will test whether or not a session is 
expired. Everything is already written, and there is not much that you 
need to do yourself (besides modifying the sitemap).




best.
Paul

On 5/19/2011 6:20 AM, Thorsten Scherler wrote:

On Wed, 2011-05-18 at 10:45 -0400, Paul Joseph wrote:

Hi there,

I have a Cocoon app that has numerous pages...I use Javascript
(flowscript) to do the display and Java to do the business logic.

In the Java layer, I have code to detect when the session expires and
this works nicely and so I am able to maintain a count of currently
logged in users.

Here is my request:  A customer asked that when their session expires,
that they be shown the login page automatically.

Now I know when the session expires, but how do I show the Login page
from within Java code?  They could be anywhere in the app so I 
presume I

should directly have the Java code somehow display the Login page?

Pointers much appreciated.

I reckon all pages are going through an action which test, whether the
user is logged in, correct? If not how to you test whether the user is
logged in and has the authority to see the page?

The simplest I guess is to write your own action extending e.g.
http://cocoon.apache.org/2.1/userdocs/optional/session-action.html where
you test for the session.

You can use something like the following in your sitemap:
map:act type=session
!-- session exists go on with generating USER page --
/map:act
!-- session failed show login page--

Another route is to test it in your existing flow script and redirect
from within that flow to the login page.

if (YourJavaClass.validateSession(session)){
  // session exists go on with generating USER page
}else{
  // session failed show login page
}

However that depends on your usecase which makes more sense.

salu2


-
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


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



Re: best way to show login page when session expires? (Javascript/Java based Cocoon app.)

2011-05-18 Thread Andre Juffer

Paul,

you could use Auth:

http://cocoon.apache.org/2.2/blocks/auth/1.0/1236_1_1.html

I have used this with 2.2 and does seem to work fine.

One can test in flowscript whether or not a request is send while the 
session was expired/closed. Testing whether or not the session expired 
does not belong in the domain/business layer (IMHO). The test in 
flowscript is done before the request is forwarded to the business 
layer. If the session is expired, you simply redirect the request to a 
login page, so it never reaches the business layer.


best regards,
Andre

On 05/18/2011 05:45 PM, Paul Joseph wrote:

Hi there,

I have a Cocoon app that has numerous pages...I use Javascript
(flowscript) to do the display and Java to do the business logic.

In the Java layer, I have code to detect when the session expires and
this works nicely and so I am able to maintain a count of currently
logged in users.

Here is my request: A customer asked that when their session expires,
that they be shown the login page automatically.

Now I know when the session expires, but how do I show the Login page
from within Java code? They could be anywhere in the app so I presume I
should directly have the Java code somehow display the Login page?

Pointers much appreciated.

Paul

-
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/
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



Re: best way to show login page when session expires? (Javascript/Java based Cocoon app.)

2011-05-18 Thread Andre Juffer

On 05/18/2011 07:18 PM, Paul Joseph wrote:

I think I should use this: http://wiki.apache.org/cocoon/ErrorHandling


Not sure, never used it.



On 5/18/2011 11:22 AM, Andre Juffer wrote:

Paul,

you could use Auth:

http://cocoon.apache.org/2.2/blocks/auth/1.0/1236_1_1.html

I have used this with 2.2 and does seem to work fine.

One can test in flowscript whether or not a request is send while the
session was expired/closed. Testing whether or not the session expired
does not belong in the domain/business layer (IMHO). The test in
flowscript is done before the request is forwarded to the business
layer. If the session is expired, you simply redirect the request to a
login page, so it never reaches the business layer.

best regards,
Andre

On 05/18/2011 05:45 PM, Paul Joseph wrote:

Hi there,

I have a Cocoon app that has numerous pages...I use Javascript
(flowscript) to do the display and Java to do the business logic.

In the Java layer, I have code to detect when the session expires and
this works nicely and so I am able to maintain a count of currently
logged in users.

Here is my request: A customer asked that when their session expires,
that they be shown the login page automatically.

Now I know when the session expires, but how do I show the Login page
from within Java code? They could be anywhere in the app so I presume I
should directly have the Java code somehow display the Login page?

Pointers much appreciated.

Paul

-
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




--
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



Re: Cocoon 2.2 and Mysql 5.0

2011-05-12 Thread Andre Juffer
Is possibly related to a firewall rule. The database is located on 
another server?


On 12/05/11 17:21, Grégory Roche wrote:


 Hi,

after the mail, I'm trying to do a test with a database Mysql 5.0 and 
a block of Cocoon 2.2. At this moment, it's a catastrophe, my browser 
return :


http://locahost:/test/sql-page

Hello This is my first Cocoon2 page filled with SQL data!  Failed to 
obtain connection from datasource 'dbMySQL5'. Made 5 attempts with 
5000ms interval


Mysql server is ok, and I have create my database with phpMyAdmin.

For my Cocoon, I have :

-- in the file META-INF/cocoon/spring/datasource.xml :

bean 
name=org.apache.avalon.excalibur.datasource.DataSourceComponent/dbMySQL5

class=org.apache.cocoon.databases.bridge.spring.avalon.SpringToAvalonDataSourceWrapper

property name=wrappedBean
bean 
class=org.springframework.jdbc.datasource.DriverManagerDataSource 

property name=driverClassName value=com.mysql.jdbc.Driver/
property name=url 
value=jdbc:mysql://188.165.XX.XX:3306/db?autoReconnect=true/

property name=username value=XXX/
property name=password value=XXX/
/bean
/property
/bean

-- In my sitemap.xmap, I have my SQLTransformer and the pipeline for 
my sql-page.xml :


map:transformer logger=sitemap.transformer.sql
  name=sql src=org.apache.cocoon.transformation.SQLTransformer/

map:match pattern=*
map:generate src=xdocs/{1}.xml /
map:transform type=sql
map:parameter name=use-connection value=dbMySQL5 /
/map:transform
map:transform src=stylesheets/sql2html.xsl /
map:transform type=servletLinkRewriter /
map:serialize type=html /
/map:match

-- My file sql-page.xml is very simple, it contains just one request SQL :

page
titleHello/title

content
paraThis is my first Cocoon2 page filled with SQL data!/para

sql:execute-query xmlns:sql=http://apache.org/cocoon/SQL/2.0;
sql:query
select id, name, description from department
/sql:query
/sql:execute-query
/content
/page

Have you an idea ? Thanks.

Grégory Roche

www.polymorphisme.com
webmas...@polymorphisme.org
fixe : +33 (0)5.24.07.64.02
port : +33 (0)6.89.54.14.84




--
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: Cocoon 2.2 and sendmail

2011-05-09 Thread Andre Juffer
One way to find out what is happening is to remove (comment out) the 
map:transform type=sendmail/ and have a look at the generated XML 
e.g. in your browser with:


http://foo.bar.com/sendmail?name=rocheemail=webmas...@polymorphisme.org

There may be just a simple error in the generated XML that sendmail 
receives.


On 09/05/11 11:27, Andy Stevens wrote:


What mail server host are you sending the mail through? Perhaps it's 
set up to prevent relaying and your message is being rejected because 
of the address(es) involved?


Andy
--
http://pseudoq.sourceforge.net/

On 9 May 2011 09:19, Grégory Roche webmas...@polymorphisme.org 
mailto:webmas...@polymorphisme.org wrote:



 So,

 I have change my pipeline ! I add the transformer for the emails :

 map:match pattern=sendmail
 map:generate src=xdocs/sendmail.xml/
 map:transform src=stylesheets/sendmail.xsl
 map:parameter name=name value={request-param:name}/
 map:parameter name=email value={request-param:email}/
 map:parameter name=id value={session:id}/
 /map:transform
 map:transform type=sendmail/
 map:serialize type=xml/
 /map:match

 That it's good :)

 But then I send an email, I have the reponce :

 :result xmlns=http://apache.org/cocoon/transformation/sendmail; 
:failure to=webmas...@polymorphisme.org 
mailto:webmas...@polymorphisme.orgInvalid address/:failure 
/:result


 And my adresse email webmas...@polymorphisme.org 
mailto:webmas...@polymorphisme.org is valide.


 I don't know what is the problem ! Thanks.

 G R

 www.polymorphisme.com http://www.polymorphisme.com
 webmas...@polymorphisme.org mailto:webmas...@polymorphisme.org
 fixe : +33 (0)5.24.07.64.02
 port : +33 (0)6.89.54.14.84Andy Stevens 
insomniacpeng...@googlemail.com 
mailto:insomniacpeng...@googlemail.com a écrit :


 2011/5/9 Grégory Roche webmas...@polymorphisme.org 
mailto:webmas...@polymorphisme.org:

 I'm trying send email with Cocoon 2.2.

 ...
 and in my sitemap.xmap, I have my tramsformer sendmail :

 map:transformer name=sendmail
 src=org.apache.cocoon.mail.transformation.SendMailTransformer/

 and a pipeline for my test :

 map:match pattern=sendmail
 map:generate src=xdocs/sendmail.xml/
 map:transform src=stylesheets/sendmail.xsl
 map:parameter name=name
 value={request-param:name}/
 map:parameter name=email value={request-param:email}/
 map:parameter name=id value={session:id}/
 /map:transform
 map:serialize type=xml/
 /map:match

 I'm sure that my params are good :)

 But then I send an email, I have nothing in my email box !!!

 Maybe I'm missing something here, but you don't appear to have called
 the sendmail transformer - the pipeline you quoted only has a
 generator, xslt transformation and xml serialiser...?


 Andy
 --
 http://pseudoq.sourceforge.net/




--
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: Cocoon 2.2 and sendmail

2011-05-09 Thread Andre Juffer
The generated XML seems fine. Possible, the Invalid address message is a 
response from smtp.polymorphisme.org. It may be that the email address 
itself is OK, but the protocol for accepting emails is wrong. Port 25 
suggests that you assume no connection security and no authentication 
either. That is correct? If you send it from a machine outside the 
domain polymorphisme.org, it may be that your email is simply not 
accepted by the SMTP. If so, you would need to use the local sendmail 
(on unix/Linux boxes at least).



On 09/05/11 11:59, Grégory Roche wrote:


 Ok,

now, I have a minimal pipeline :

map:match pattern=sendmail
map:generate src=xdocs/sendmail.xml/
map:transform type=sendmail/
map:serialize type=xml/
/map:match

and my file sendmail.xml (an exemple is on the page 
http://cocoon.apache.org/2.2/blocks/mail/1.0/1099_1_1.html) :


?xml version=1.0 encoding=UTF-8?

document xmlns:email=http://apache.org/cocoon/transformation/sendmail;
email:sendmail
email:smtphostsmtp.polymorphisme.org/email:smtphost
email:smtpport25/email:smtpport
email:fromwebmas...@polymorphisme.org/email:from
email:towebmas...@polymorphisme.org/email:to
email:subjectsubject/email:subject
email:bodybody/email:body
/email:sendmail
/document

And with my navigator I open URL : http://localhost:/admin/sendmail

but he returns :

?xml version=1.0 encoding=UTF-8?

documentxmlns:email=http://apache.org/cocoon/transformation/sendmail;

email:result

email:failureto=webmas...@polymorphisme.orgInvalid 
address/email:failure


/email:result

/document

It's more funny, but I don't understand why I can't to receve my 
email, my email adress is valid !


Thank for you help.

Grégory Roche

www.polymorphisme.com
webmas...@polymorphisme.org
fixe : +33 (0)5.24.07.64.02
port : +33 (0)6.89.54.14.84

Andre Juffer andre.juf...@oulu.fi a écrit :

 One way to find out what is happening is to remove (comment out) the
 map:transform type=sendmail/ and have a look at the generated XML
 e.g. in your browser with:

 
http://foo.bar.com/sendmail?name=rocheemail=webmas...@polymorphisme.org 
http://foo.bar.com/sendmail?name=rocheemail=webmas...@polymorphisme.org


 There may be just a simple error in the generated XML that sendmail 
receives.


 On 09/05/11 11:27, Andy Stevens wrote:

 What mail server host are you sending the mail through? Perhaps it's
 set up to prevent relaying and your message is being rejected
 because of the address(es) involved?

 Andy
 --
 http://pseudoq.sourceforge.net/

 On 9 May 2011 09:19, Grégory Roche webmas...@polymorphisme.org
 mailto:webmas...@polymorphisme.org wrote:


 So,

 I have change my pipeline ! I add the transformer for the emails :

 map:match pattern=sendmail
 map:generate src=xdocs/sendmail.xml/
 map:transform src=stylesheets/sendmail.xsl
 map:parameter name=name value={request-param:name}/
 map:parameter name=email value={request-param:email}/
 map:parameter name=id value={session:id}/
 /map:transform
 map:transform type=sendmail/
 map:serialize type=xml/
 /map:match

 That it's good :)

 But then I send an email, I have the reponce :

 :result xmlns=http://apache.org/cocoon/transformation/sendmail;
 :failure to=webmas...@polymorphisme.org
 mailto:webmas...@polymorphisme.orgInvalid address/:failure
 /:result

 And my adresse email webmas...@polymorphisme.org
 mailto:webmas...@polymorphisme.org is valide.

 I don't know what is the problem ! Thanks.

 G R

 www.polymorphisme.com http://www.polymorphisme.com
 webmas...@polymorphisme.org mailto:webmas...@polymorphisme.org
 fixe : +33 (0)5.24.07.64.02
 port : +33 (0)6.89.54.14.84Andy Stevens
 insomniacpeng...@googlemail.com
 mailto:insomniacpeng...@googlemail.com a écrit :

 2011/5/9 Grégory Roche webmas...@polymorphisme.org
 mailto:webmas...@polymorphisme.org:
 I'm trying send email with Cocoon 2.2.

 ...
 and in my sitemap.xmap, I have my tramsformer sendmail :

 map:transformer name=sendmail
 src=org.apache.cocoon.mail.transformation.SendMailTransformer/

 and a pipeline for my test :

 map:match pattern=sendmail
 map:generate src=xdocs/sendmail.xml/
 map:transform src=stylesheets/sendmail.xsl
 map:parameter name=name
 value={request-param:name}/
 map:parameter name=email value={request-param:email}/
 map:parameter name=id value={session:id}/
 /map:transform
 map:serialize type=xml/
 /map:match

 I'm sure that my params are good :)

 But then I send an email, I have nothing in my email box !!!

 Maybe I'm missing something here, but you don't appear to have called
 the sendmail transformer - the pipeline you quoted only has a
 generator, xslt transformation and xml serialiser...?


 Andy
 --
 http://pseudoq.sourceforge.net/



 --
 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

Re: sitemap

2011-03-10 Thread Andre Juffer

On 10/03/11 11:31, Jos Snellings wrote:

To reply again (with the some delay ...):
No, the old

{request:serverName}

does not work anymore in 3. The new syntax is:
servlet:redirect-to 
uri=http://{jexl:cocoon.request.serverName}/herein/thesaurus/editor/workspace/


Same with the other request attributes. This is not documented, nor to 
be found in the examples. Hence this mail.

Not too difficult to guess, though!

Any plans to release cocoon 3? Is cocoon-3 like the never ending Bob 
Dylan tour?


I also would like to hear about cocoon-3. In addition, will it offer the 
same functionality as cocoon-2.2, or is it going to be completely 
different again? I understand it will emphasize REST approaches, but 
possibly at the expense of others things? What about an update of 
cocoon-2.2 to support the more recent packages (like Spring 3, etc).




Best regards,
Jos


On 01/20/2011 06:22 PM, Laurent Medioni wrote:

Hello,
The old
uri={request:scheme}://{request:serverName}:{request:serverPort}{reques
t:contextPath}/secure/loginpage
Using org.apache.cocoon.components.modules.input.RequestModule does not
work anymore in 3 ?
Laurent

-Original Message-
From: Jos Snellings [mailto:jos.snelli...@pandora.be]
Sent: jeudi 20 janvier 2011 14:07
To: users@cocoon.apache.org
Subject: sitemap

Hello,

Cocoon 3:
Is there an expression for the servername in the sitemap?
I am looking for:

map:handle-errors
map:select value={jexl:cocoon.exception.class.name}
map:when contains=NoMatchingPipelineException
map:generate src=error-handling/404.xml /
map:serialize type=xhtml status-code=404 /
/map:when
map:when ends-with=AnonymousAccessException
servlet:redirect-to
uri=https://{server}/myapplication/secure/loginpage; /
/map:when

Thanks!
Jos

-
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





-
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


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



Re: Maven repo problems? cocoon-validation-impl not found

2011-03-08 Thread Andre Juffer
Sorry, I am out of ideas. I think you could try to port your application 
to Cocoon 2.2 instead.


On 03/07/2011 12:11 PM, Myles Byrne wrote:

Moi Andre,

Yes, it's counter intuitive! I think the underlying cause is that i've
tried to build our 2.2 Cocoon app minimally, without doing a full local
Cocoon build .. and the Validation blocks we need aren't in 2.2.

Here is the current state of the problem, from Cocoon-users thread
http://www.mail-archive.com/users@cocoon.apache.org/msg46032.html:

I built Cocoon 2.1.11 in ~/.m2/repository as you suggested, and checked
that my settings.xml points to this repo. Now i'm having (what must be
total noob) trouble getting Maven to find the Validation blocks in the
local repo.

I've tried dozens of variations of the following POM dependencies:

dependency
groupIdcocoon/groupId
artifactIdcocoon-validation/artifactId
version2.1.11/version
/dependency
dependency
groupIdorg.apache.cocoon/groupId
artifactIdcocoon-validation-impl/artifactId
version1.0.0-SNAPSHOT/version
/dependency


.. but still get a build fail:

Could not resolve dependencies for project
com.mycompany:lsdb:jar:1.0.0: Could not find artifact
org.apache.cocoon:cocoon-validation-impl:jar:1.0.0-SNAPSHOT


The worst part is with your earlier help, it was working for a few days.
Then the builds started failing again. So if nothing in Maven central
has changed, that means my earlier attempts to install the Validation
block locally (in the Cocoon app, not in the Maven repo) worked.

Now i'm looking for a way to tell Maven to get the -impl block from:

  ~/.m2/repository/cocoon-2.1.11/src/blocks/validation/

.. I've tried a number of things but can't find the key. Any clues?

Cheers,
- Myles
Helsinki


On Thu, Mar 3, 2011 at 5:44 PM, Andre Juffer andre.juf...@oulu.fi
mailto:andre.juf...@oulu.fi wrote:

This I cannot understand. If everything compiled fine earlier, and
the required package was already downloaded to your repository,
Maven should not check again a remote repository, because it already
has everything, right? It is possible that your local repository has
been corrupted in one way or another, say, some files accidentally
were removed?



On 03/03/11 15:11, Myles Byrne wrote:

Thanks again, Andre!

Yes, i compiled everything when it worked, and as you said the
package is in the local repo. I've been trying to point Cocoon to
that local version, and also seem to be getting the correct
download from the central repo (repo2), but it can't find the POM:


[DEBUG] Using connector WagonRepositoryConnector with priority
0 for http://repo2.maven.org/maven2
Downloading:

http://repo2.maven.org/maven2/org/apache/cocoon/cocoon-validation-impl/1.0.0/cocoon-validation-impl-1.0.0.pom
[DEBUG] Reading resolution tracking file

/home/mbyrne/lsdb1/lsf/~/.m2/repository/org/apache/cocoon/cocoon-validation-impl/1.0.0/cocoon-validation-impl-1.0.0.pom.lastUpdated
[DEBUG] Writing resolution tracking file

/home/mbyrne/lsdb1/lsf/~/.m2/repository/org/apache/cocoon/cocoon-validation-impl/1.0.0/cocoon-validation-impl-1.0.0.pom.lastUpdated
[WARNING] The POM for
org.apache.cocoon:cocoon-validation-impl:jar:1.0.0 is missing,
no dependency information available


.. and then fails:

[ERROR] Failed to execute goal on project lsf: Could not
resolve dependencies for project com.mycompany:lsf:jar:1.0.0:
Could not find artifact
org.apache.cocoon:cocoon-validation-impl:jar:1.0.0 in repo2
(http://repo2.maven.org/maven2) - [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed
to execute goal on project lsf: Could not resolve dependencies
for project com.mycompany:lsf:jar:1.0.0: Could not find
artifact org.apache.cocoon:cocoon-validation-impl:jar:1.0.0 in
repo2 (http://repo2.maven.org/maven2)


To solve this, i've tried placing a POM i found for the validation
block in the local repo, but this hasn't worked.
I also have tried different mirror settings in ~/.m2/settings.xml,
and forcing repositories in the POM.

I'm stumped. It kills me that the validation-impl was working and
is in my local repo, but won't build. I feel like there's
something basic about getting Maven to find a dependecy i'm
missing. On the other hand, i see others have had to search for
the (schema) Validation block as well.

Any more hints?

(Note: i posted a related question in the
'ValidationReportTransformer in 2.2' thread)

Cheers and thanks again,
- Myles Byrne
FIMM.fi
Helsinki





On Mon, Feb 28, 2011 at 12:55 PM, Andre Juffer
andre.juf...@oulu.fi mailto:andre.juf...@oulu.fi wrote:

On 28/02/11 12:01, Myles Byrne wrote:

Hi all,

This dependency was available last week

Re: Maven repo problems? cocoon-validation-impl not found

2011-03-03 Thread Andre Juffer
This I cannot understand. If everything compiled fine earlier, and the 
required package was already downloaded to your repository, Maven should 
not check again a remote repository, because it already has everything, 
right? It is possible that your local repository has been corrupted in 
one way or another, say, some files accidentally were removed?



On 03/03/11 15:11, Myles Byrne wrote:

Thanks again, Andre!

Yes, i compiled everything when it worked, and as you said the package 
is in the local repo. I've been trying to point Cocoon to that local 
version, and also seem to be getting the correct download from the 
central repo (repo2), but it can't find the POM:



[DEBUG] Using connector WagonRepositoryConnector with priority 0
for http://repo2.maven.org/maven2
Downloading:

http://repo2.maven.org/maven2/org/apache/cocoon/cocoon-validation-impl/1.0.0/cocoon-validation-impl-1.0.0.pom
[DEBUG] Reading resolution tracking file

/home/mbyrne/lsdb1/lsf/~/.m2/repository/org/apache/cocoon/cocoon-validation-impl/1.0.0/cocoon-validation-impl-1.0.0.pom.lastUpdated
[DEBUG] Writing resolution tracking file

/home/mbyrne/lsdb1/lsf/~/.m2/repository/org/apache/cocoon/cocoon-validation-impl/1.0.0/cocoon-validation-impl-1.0.0.pom.lastUpdated
[WARNING] The POM for
org.apache.cocoon:cocoon-validation-impl:jar:1.0.0 is missing, no
dependency information available


.. and then fails:

[ERROR] Failed to execute goal on project lsf: Could not resolve
dependencies for project com.mycompany:lsf:jar:1.0.0: Could not
find artifact org.apache.cocoon:cocoon-validation-impl:jar:1.0.0
in repo2 (http://repo2.maven.org/maven2) - [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal on project lsf: Could not resolve dependencies for
project com.mycompany:lsf:jar:1.0.0: Could not find artifact
org.apache.cocoon:cocoon-validation-impl:jar:1.0.0 in repo2
(http://repo2.maven.org/maven2)


To solve this, i've tried placing a POM i found for the validation 
block in the local repo, but this hasn't worked.
I also have tried different mirror settings in ~/.m2/settings.xml, and 
forcing repositories in the POM.


I'm stumped. It kills me that the validation-impl was working and is 
in my local repo, but won't build. I feel like there's something basic 
about getting Maven to find a dependecy i'm missing. On the other 
hand, i see others have had to search for the (schema) Validation 
block as well.


Any more hints?

(Note: i posted a related question in the 'ValidationReportTransformer 
in 2.2' thread)


Cheers and thanks again,
- Myles Byrne
FIMM.fi
Helsinki





On Mon, Feb 28, 2011 at 12:55 PM, Andre Juffer andre.juf...@oulu.fi 
mailto:andre.juf...@oulu.fi wrote:


On 28/02/11 12:01, Myles Byrne wrote:

Hi all,

This dependency was available last week:

dependency
groupIdorg.apache.cocoon/groupId
artifactIdcocoon-validation-impl/artifactId
version1.0.0-SNAPSHOT/version
/dependency


Just wondering. Because you already compiled everything before
(last week I assume), this particular package should be in your
local repository (if you use Linux, check ~/.m2/repository), so
that the error should in fact not occur (unless you never compiled
your application ever with this particular dependency).




.. Now it aint:

Caused by:
org.sonatype.aether.transfer.ArtifactNotFoundException: Could
not find artifact
org.apache.cocoon:cocoon-validation-impl:jar:1.0.0-SNAPSHOT

All our other dependencies are still loading, and the Validation
package seems to still be available here:

http://repo2.maven.org/maven2/cocoon/cocoon-validation/2.1.11/


and here:


http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-validation/cocoon-validation-impl/


I've been trying to figure out how to point Cocoon to one of
these. Any clues? Or should i escalate to MVNCENTRAL?


I believe you need to modify the settings.xml in your .m2 folder,
if Maven is not searching http://repo2.maven.org/maven2/
http://repo2.maven.org/maven2/cocoon/cocoon-validation/2.1.11/
for packages. Double check with the Maven website for the details.


Thanks,
- Myles Byrne
FIMM.fi
Helsinki






-- 
Andre H. Juffer  | Phone:+358-8-553 1161  tel:%2B358-8-553%201161

Biocenter Oulu and   | Fax:+358-8-553-1141  tel:%2B358-8-553-1141
Department of Biochemistry   | Email:andre.juf...@oulu.fi  
mailto:andre.juf...@oulu.fi
University of Oulu, Finland  | WWW:www.biochem.oulu.fi/Biocomputing/  
http://www.biochem.oulu.fi/Biocomputing/
StrucBioCat  | WWW:www.strucbiocat.oulu.fi  
http://www.strucbiocat.oulu.fi
Triacle Biocomputing | WWW:www.triacle-bc.com  
http://www.triacle-bc.com
 






--
Andre H. Juffer  | Phone: +358-8-553 1161

Re: Maven repo problems? cocoon-validation-impl not found

2011-02-28 Thread Andre Juffer

On 28/02/11 12:01, Myles Byrne wrote:

Hi all,

This dependency was available last week:

dependency
groupIdorg.apache.cocoon/groupId
artifactIdcocoon-validation-impl/artifactId
version1.0.0-SNAPSHOT/version
/dependency


Just wondering. Because you already compiled everything before (last 
week I assume), this particular package should be in your local 
repository (if you use Linux, check ~/.m2/repository), so that the error 
should in fact not occur (unless you never compiled your application 
ever with this particular dependency).




.. Now it aint:

Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException:
Could not find artifact
org.apache.cocoon:cocoon-validation-impl:jar:1.0.0-SNAPSHOT

All our other dependencies are still loading, and the Validation 
package seems to still be available here:


http://repo2.maven.org/maven2/cocoon/cocoon-validation/2.1.11/


and here:


http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-validation/cocoon-validation-impl/


I've been trying to figure out how to point Cocoon to one of these. 
Any clues? Or should i escalate to MVNCENTRAL?


I believe you need to modify the settings.xml in your .m2 folder, if 
Maven is not searching http://repo2.maven.org/maven2/ 
http://repo2.maven.org/maven2/cocoon/cocoon-validation/2.1.11/ for 
packages. Double check with the Maven website for the details.


Thanks,
- Myles Byrne
FIMM.fi
Helsinki






--
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: again with 'works in jetty, not in tomcat' for simple URI matching in 2.2

2011-02-10 Thread Andre Juffer

On 02/09/2011 04:00 PM, Myles Byrne wrote:

Thanks, Andre! It would be a godsend to route around this problem.

But I haven't been able to get param passing to work as you suggest.
Following from your example, this sitemap match:

map:pipeline
map:match pattern=something
map:match type=request-parameter pattern=url /
map:generate src={1}/
  

.. would require this matcher setup in components, no?

map:matcher name=request-parameter
src=org.apache.cocoon.matching.RequestParameterMatcher/


I actually had nothing like that in the sitemap. It just worked. But I 
should note that I was using this with a version older than cocoon 2.2. 
You are using cocoon 2.2, right?


Your url value is pointing to a remote server, other than the one you 
are running cocoon? I guess, the code above did get the value of url, 
but its value is misinterpreted  by cocoon, as it tries to find 
something of the local disk instead. The map:generate src={1} / 
could be causing this. If url's value does actually refer to a local 
resource, it is looking in the wrong place, as the url's value may be 
interpreted as being relative to the root of your block, while you may 
had a different location in mind.




I haven't been able to get this to work .. the trace says:

javax.servlet.ServletException:
org.apache.cocoon.ResourceNotFoundException: Resource not found.
...
Caused by: org.apache.excalibur.source.SourceNotFoundException:
file:///home/... /./src/main/resources/COB-INF/ doesn't exist.

.. This seems better than the outright fail of the default URI matcher,
but i'm having a hard time fixing this, too. Any pointer to get the
param passing as you suggest?

Cheers,
- Myles
FIMM.fi


On Tue, Feb 8, 2011 at 8:35 PM, Andre Juffer ajuf...@sun3.oulu.fi
mailto:ajuf...@sun3.oulu.fi wrote:

On 02/08/2011 04:32 PM, Myles Byrne wrote:

Hi all,

Coming right off the current basic archetype with samples,
simply adding
a basic URL matcher:

map:match pattern=url=**
map:generate src={1}/


You could rewrite this as

map:pipeline
map:match pattern=something
map:match type=request-parameter pattern=url /
map:generate src={1}/
  

This should work fine with a request like:

www.foo.com/something?url=value http://www.foo.com/something?url=value




etc ..

.. works fine in Jetty, but in Tomcat throws:

Javax.servlet.ServletException:
org.apache.cocoon.ProcessingException:
Sitemap: error invoking matcher  (the rest of the trace is below)

.. where the error specifies the end of the match line above.

I thought this looked like a UTF8 issue, so have followed the
directions
for this in both Cocoon and Tomcat. Since this hasn't fixed the
problem
yet, i have to ask the experts: UTF-8 issue? Anything else that can
differ so fundamentally between Jetty and Tomcat?

Cheers,
- Myles Byrne
fimm.fi http://fimm.fi http://fimm.fi


---


avax.servlet.ServletException:
org.apache.cocoon.ProcessingException: Sitemap: error invoking
matcher
atmap:match  -

file:///opt/apps/apache-tomcat-6.0.18/work/Catalina/localhost/lsdbweb-1.0.0/blocks/lsdb/sitemap.xmap:56:32

  
org.apache.cocoon.servlet.RequestProcessor.service(RequestProcessor.java:230)

  
org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:84)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

  
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:468)

  
org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:443)

  
org.apache.cocoon.servletservice.spring.ServletFactoryBean$ServiceInterceptor.invoke(ServletFactoryBean.java:264)

  
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

  
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy3.service(Unknown Source)

  
org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:106)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

  
org.apache.cocoon.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:131)

*root cause*

org.apache.cocoon.ProcessingException: Sitemap: error invoking
matcher
atmap:match  -

file:///opt/apps/apache-tomcat-6.0.18/work/Catalina/localhost/lsdbweb-1.0.0/blocks/lsdb/sitemap.xmap:56:32

  
org.apache.cocoon.ProcessingException.throwLocated(ProcessingException.java:111)

  
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:90

Re: Trouble deploying a *.war file to Tomcat from Cocoon 2.2

2011-01-27 Thread Andre Juffer

Try:

http://localhost:8080/webapp/name-of-default-block-here/something

something should be matched in your sitemap of 
name-of-default-block-here.


e.g.
http://localhost:8080/webapp/ui/login



On 01/27/2011 11:06 PM, Patrick Etienne wrote:

Cocoon  Tomcat Users,

I'm writing (cross-list) concerning a test case for producing a small
cocoon application for tomcat. I've been a user of Cocoon for quite some
time, but have had a little trouble adjusting to the new
spring/maven-based 2.2 version. My quest at the moment is just to create
the default cocoon block as well as a webapp block in order to yield a
war file to be uploaded to tomcat. So far I've followed the instructions
from Your first Cocoon application using Maven 2
http://cocoon.apache.org/2.2/1159_1_1.html and Deploying a Cocoon
application http://cocoon.apache.org/2.2/1362_1_1.html. Rather than
creating a two (option 2) blocks, a webapp block, and a parent block,
I've just created a regular block and a webapp block and attempted to
upload the resulting *.war file to Tomcat and deploy the war there. The
application seems to load alright (based off of information listed in
the tomcat manager, and catalina.out logs), but browsing to the actual
URL seems to show that I've not completed the process properly in some way.

The result is:
HTTP Status 404 - No block for /


*type* Status report

*message* _No block for /_

*description* _The requested resource (No block for /) is not available._




  Apache Tomcat/6.0.18


Catalina.out only shows:
Loading catalog:
file:/usr/local/apache-tomcat-6.0.18/work/Catalina/localhost/mobileApp-1.0.0/cocoon_xml_resolver_entities/catalog
In reference to the mobileApp application that I'm attempting to load.

Again, I have experience with both Cocoon  2.2 and Tomcat in general,
but am having trouble understanding what needs to be done in order to
run a Cocoon 2.2 application in Tomcat (rather than Jetty). By the way,
I'm able to get everything to come up as expected from Jetty.

Any tips, hints, suggestions, or resources would be greatly appreciated!

  - Patrick E.

--
Patrick K. Etienne
Systems Analyst
Georgia Institute of Technology
Library  Information Center
(404) 385-8121





--
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



Re: Adding my Java code to flowscript

2011-01-25 Thread Andre Juffer
As far as I am concerned, the best solution is keep your Java 
development separated from Cocoon. If you Java has no knowledge about or 
dependency on cocoon, it is much simpler and in my mind also much better 
to place your Java classes in a separated Jar file and make your 
cocoon-based application dependent on your Java classes. If you use 
maven then this is very straightforward to accomplish in cocoon 2.2. The 
additional advantage is that your can very easy test your Java code 
without ever running cocoon (e.g. with Netbeans).


To allow my cocoon-based application (or any other application for that 
matter) to work with my Java code, I typically define a few suitable 
Facades that are instantiated in Flow using a simple Factory method or 
with Spring (I prefer the latter approach):


factory:

var facade = Packages.test.SomeFacade.newInstance();  // static method.

or, as Robby pointed out,

importClass(Packages.test.SomeFacade);
var facade = SomeFacade.newInstance();

Spring:

var facade = cocoon.getComponent(test.SomeFacade);   // 
test.SomeFacade is the bean ID that was defined for the facade


   // in a Spring configuration file.

Best regards,
André



On 25/01/11 08:17, Robby Pelssers wrote:

importClass(Packages.java.util.ArrayList);

function search() {
 var list = new ArrayList();
 ...
}

Kind regards,
Robby Pelssers


-Oorspronkelijk bericht-
Van: Des Magner [mailto:d...@icandriveatractor.com]
Verzonden: zo 23-1-2011 1:25
Aan: users@cocoon.apache.org
Onderwerp: Adding my Java code to flowscript

Hi

I am trying to add some custom code to be called from my flowscript but
with no success. I followed the instructions in the user documentation
to the letter (http://cocoon.apache.org/2.1/userdocs/flow/java.html). I
have added my source directory entry to the component-instance in the
format file:/path/to/my/source but it doesn't seem to want to pick up
the code. Say I have the following code in my flowscript:

var resource = new Packages.Test();

with the file Test.java placed in my source dir as specified above, I
consistently get the following error:

org.mozilla.javascript.EvaluatorException: file:///js, line ..:
Not a Java class: [JavaPackage Test]

I can get around it by placing the compiled class in the
cocoon/WEB-INF/classes directory but this is not a very elegant solution.

Any help would be greatly appreciated.
Thanks
Des

-
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



--
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



Re: Adding my Java code to flowscript

2011-01-25 Thread Andre Juffer

On 01/25/2011 06:57 PM, Des Magner wrote:

Hi André

That is more or less what I was trying to achieve, ie. write Java code that
can be used in my flowscript but for this Java code to be completely
independent of cocoon. From reading the documentation I was given
to understand that this code could be compiled on the fly which would
of course speed up development time (See the documentation link I referenced
in the original post). I have never had any problem using standard Java
classes, such as ArrayList, etc. in flowscript, the problem is accessing
classes that I have written. So as far as I can see there are three options
outlined below, the third one being the only one I have been able to
successfully achieve.

Option 1: Have your code compiled on the fly, specifiying in cocoon.xconf a
classpath as to where it should look for source code. I cannot get this to
work and this was why I posted the message in the first place. In more
detail this is what I do:

Add the following to cocoon.xconf:

flow-interpreters default=javascript logger=flow
   component-instance
class=org.apache.cocoon.components.flow.javascript.fom.
FOM_JavaScriptInterpreter
name=javascript

load-on-startupresource://org/apache/cocoon/components/flow/
javascript/fom/fom_system.js/load-on-startup
 reload-scriptstrue/reload-scripts
 check-time4000/check-time
 classpathfile:/path/to/my/java/src/classpath
   /component-instance
/flow-interpreters

Javascript in my flowscript:

var resource = new Packages.mypackage.xyz.MyClass();

Throws the following exception:

org.mozilla.javascript.EcmaError: TypeError:
[JavaPackage mypackage.xyx.MyClass] is not a function,
it is org.mozilla.javascript.NativeJavaPackage.


Option 2: Complile my code to the my application's WEB-INF/classes
directory (or alternatively place it in a jar file in the application's
WEB-INF/lib directory. This I also tried but to no avail.

Option 3: Place the compiled classes in the cocoon's own classes folder.
When I do this I can indeed access my Java classes from flowscript.
But this for me is the least desireable solution as it requires me to
mix my own class files with cocoons class files which I don't consider
elegant nor correct. And also, cocoon would need to be restarted
everytime I make a modication to my Java classes.


I have only experience with option 3, I cannot say so much about the 
other options. If you use cocoon 2.2, the dependency goes in the 
pom.xml. With earlier versions, one can write an ant script to ensure 
that the jar file (say test.jar) is deposited in WEB-INF/lib. This all 
certainly works very well and, to me (not to you apparently), is the 
simplest and easiest way.


It is correct that you would need to restart cocoon after a modification 
to your classes. On the other hand, if you have designed your classes 
well, and tested well, you can bring this down to a minimum. For a new 
project, I never start with cocoon, but work on a proper design and 
implementation of the domain and rules, and, if needed, basic 
infrastructure (database, etc) as well. When start to use cocoon, I am 
rather certain that every already works well (classes in the jar, that is).


BTW which version of cocoon are you using?

I also wonder about your design. You say you are required to mix your 
classes with cocoon classes. Why is that necessary? I may have 
misunderstood you.




Regards
Des


-
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/
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



Re: [HELP]No pipeline matched request: ejournals/pdf/endoscopy/doi/10.1055/s-0030-1255941

2010-12-27 Thread Andre Juffer

On 12/26/2010 11:17 PM, uwe will wrote:

Please give me help for this problem – I can not read my online papers!


Please give us some more information. This is an issue with the sitemap, 
so show us the portion of the sitemap that is suppose to deliver your 
online papers.




Thanks U Will

Description:org.apache.cocoon.ResourceNotFoundException: No pipeline
matched request: ejournals/pdf/endoscopy/doi/10.1055/s-0030-1255941

*Unfortunately the URL is not available.**
Please check your spelling. If you have clicked on a link inform your
webmaster.
No pipeline matched request:
ejournals/pdf/endoscopy/doi/10.1055/s-0030-1255941*




--
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



Re: cocoon on ubuntu 10.4 server

2010-11-30 Thread Andre Juffer

On 30/11/10 13:42, Szabo, Patrick (LNG-VIE) wrote:

Hi,

I'm new to linux and cocoon so plz excuse me if my questions are dumb.
We are currently running cocoon, tomcat on an old debian (etchy) server
and i was told to port all that to a more actual version of linux.

I've installed Ubuntu 10.4 Server and with it Tomcat6 (there was an
option during the setup of ubuntu)

Then i wanted to install cocoon and i found this tutorial:

http://www.quinndombrowski.com/blog/2010/10/11/installing-cocoon-on-ubun
tu-10-04-or-10-10/

I followed it.

Problems start here:

mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org

At first i chose archetype: 3, groupID: cocoon, artifactID: cocoon,
value for version: 1.0.0 and value for package: cocoon. (didn't really
know what to enter)

When i do mvn jetty:run i get an error:
   


Did you see the official guide at

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

Choose archetype 1 instead of 3. The third one has a different purpose.


[ERROR] BUILD ERROR
[INFO]

[INFO] Webapp source directory /cocoon/target/cocoon-1.0.0 does not
exist
[INFO]


After that i wanted to try mvn archetype:generate
-DarchetypeCatalog=http://cocoon.apache.org
again and choose 2 instead of 3 (like the tutorial says) but i got an
error saying Webapp source directory does not exist.

What am i supposed to ?!

Can anyohne help me ?!

Is there a way to uninstall all the stuff again and start over ?!

Thx in advance !

Kind regards.





. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
  XSLT-Entwickler
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146






-
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/
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



Re: AW: cocoon on ubuntu 10.4 server

2010-11-30 Thread Andre Juffer
The same page I was referring to earlier also explains this well. Just 
produce a WAR file and deploy that to your servlet engine.


On 30/11/10 16:19, Szabo, Patrick (LNG-VIE) wrote:

Thank you, that worked better.
I only now realize that this isnt the same thing we've installed on our other 
Server.

On our other Server Cocoon is somehow integrated into Tomcat and is startet 
with startup.sh and not jetty or maven.
Also wie use XEP to prouce PDFs.

Does anyone know what i need to do!?

Kind regards


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
  XSLT-Entwickler
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146


-Ursprüngliche Nachricht-

Von: Andre Juffer [mailto:andre.juf...@oulu.fi]
Gesendet: Dienstag, 30. November 2010 13:31
An: users@cocoon.apache.org
Betreff: Re: cocoon on ubuntu 10.4 server

On 30/11/10 13:42, Szabo, Patrick (LNG-VIE) wrote:
   

Hi,

I'm new to linux and cocoon so plz excuse me if my questions are dumb.
We are currently running cocoon, tomcat on an old debian (etchy) server
and i was told to port all that to a more actual version of linux.

I've installed Ubuntu 10.4 Server and with it Tomcat6 (there was an
option during the setup of ubuntu)

Then i wanted to install cocoon and i found this tutorial:

http://www.quinndombrowski.com/blog/2010/10/11/installing-cocoon-on-ubun
tu-10-04-or-10-10/

I followed it.

Problems start here:

mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org

At first i chose archetype: 3, groupID: cocoon, artifactID: cocoon,
value for version: 1.0.0 and value for package: cocoon. (didn't really
know what to enter)

When i do mvn jetty:run i get an error:

 

Did you see the official guide at

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

Choose archetype 1 instead of 3. The third one has a different purpose.

   

[ERROR] BUILD ERROR
[INFO]

[INFO] Webapp source directory /cocoon/target/cocoon-1.0.0 does not
exist
[INFO]


After that i wanted to try mvn archetype:generate
-DarchetypeCatalog=http://cocoon.apache.org
again and choose 2 instead of 3 (like the tutorial says) but i got an
error saying Webapp source directory does not exist.

What am i supposed to ?!

Can anyohne help me ?!

Is there a way to uninstall all the stuff again and start over ?!

Thx in advance !

Kind regards.





. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
   XSLT-Entwickler
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146






-
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/
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



Re: Cocoon 2.2 block+sitemap question

2010-11-03 Thread Andre Juffer
I have to admit that your design is somewhat odd. Apparently you have a 
particular block in your webapp that is only to be used by your company 
but not by your clients.


There is no obvious solution. You could create a Makefile for running 
make or a shell script on *nix boxes. It would copy the relevant blocks 
of your webapp into a separate folder, then automatically replaces the 
relevant portions of your block a sitemap into something else that does 
not rely on block b, and, finally, run maven to create the war for your 
clients. You can do this each time you want to deploy a stripped webapp 
to your clients. This would be a fully automated solution.


If you deploy your webapp to your own server that is also accessible by 
your clients, you could consider to make a small modification in the 
block-a sitemap. Before serving the document, first call a flowscript 
function that decides whether or not block b in fact should called. If 
not, then continue with a pipeline in block a that servers the document 
from block-a-resources/document.xml, otherwise continue with a pipeline 
that calls block b. The flowscript could check whether or not the 
request is from within the company or from outside (e.g. by IP addresses).


Best regards,
Andre


On 11/03/2010 02:29 PM, Fawzib Rojas wrote:

I have a webapp (war) that we use at our company it has a few blocks
(let say block-a to block-d), I want to install that war at our clients
but they should not have block-b. The simplest option would be just
remove that block and serve a simple document if its not found. The
other option is have 2 projects one for us one for clients which seems
extra work since the only difference is:

a) block-b not included
b) change a matcher in block-a sitemap from this:

map:pipeline
   map:match pattern=document
 map:generate src=servlet:block-b:/document /
 map:serialize type=xml /
   /map:match
/map:pipeline

to this:

map:pipeline

   map:match pattern=document
 map:generate type=file src=block-a-resources/document.xml /
 map:serialize type=xml/
   /map:match
/map:pipeline


On 11/2/2010 11:17 AM, Robby Pelssers wrote:

I have a more urgent question to you...

why would you want to sometimes not include block-b???  I think your design 
should be reconsidered drastically because this makes no sense to me... so i'll 
await your reponse for a good reason ;-)

Robby


-Oorspronkelijk bericht-
Van: Fawzib Rojas [mailto:f_ro...@spectron-msim.com]
Verzonden: di 2-11-2010 14:43
Aan:users@cocoon.apache.org
Onderwerp: Cocoon 2.2 block+sitemap question

I have 2 blocks (block-a and block-b) and I want to serve an xml from
block-b in block-a so i did the following:

block-a/block-servlet-service.xml:
servlet:context mount-path=/block-a
context-path=blockcontext:/block-a/
servlet:connections
entry key=block-b value-ref=com.my-company.block-b.service/
/servlet:connections
/servlet:context

block-a/sitemap.xml:
map:pipeline
map:match pattern=document
map:generate src=servlet:block-b:/document /
map:serialize type=xml /
/map:match
/map:pipeline

That way i can read the my document using /block-a/document.  In certain
instances block-b wont be included in the war so I want the
/block-a/document to go to a default document in block-a so I thought of
adding an error handler, something like this:

map:pipeline
map:match pattern=document
map:generate src=servlet:block-b:/document /
map:serialize type=xml /
/map:match
map:handle-errors
map:select type=exception
map:when test=error
map:generate type=file src=block-a-resources/document.xml /
map:serialize type=xml/
/map:when
/map:select
/map:handle-errors
/map:pipeline

Since the connection in the block-a/block-servlet-service.xml cannot be
made the war is not loaded so this method wont work. Is there another
way to do this?

-
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





--
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



Re: switch Cocoon 2.2 spring dependencies from 2.5.1 to 2.5.6

2010-10-31 Thread Andre Juffer

On 10/30/2010 08:34 PM, Charles Yates wrote:

Yes, we use spring-3.0.4 and cocoon-2.2 but in a non-standard way. We
use our own bean definitions for cocoon components rather than the ones
built into the cocoon jars, and have subclassed a number of cocoon
classes. The methodology used in getting it to work was to just change
the dependency then fix what was broken until nothing was. Sorry I can't
be more specific than that. The result is here:
http://lane.stanford.edu/index.html


OK, thanks. Your site looks good. It shows that cocoon 2.2 with Spring 3 
in principle should work.





On 10/30/10 2:44 AM, Andre Juffer wrote:

Has anybody tried to use Spring 3 with cocoon?

On 10/29/2010 02:05 PM, Jasha Joachimsthal wrote:

Spring 2.5.6 has vulnerability issues, see [1]. It's adviced to upgrade
to 2.5.6.SEC02.


[1] http://www.springsource.com/security/cve-2010-1622

Jasha Joachimsthal

j.joachimst...@onehippo.com mailto:j.joachimst...@onehippo.com -
ja...@apache.org mailto:ja...@apache.org

Hippo
Europe • Amsterdam Oosteinde 11 • 1017 WT Amsterdam • +31 (0)20
522 4466
USA • San Francisco 185 H Street Suite B • Petaluma CA 94952-5100 •
+1 (707) 773 4646
Canada • Montréal 5369 Boulevard St-Laurent #430 • Montréal QC
H2T 1S5 • +1 (514) 316 8966
www.onehippo.com http://www.onehippo.com/ • www.onehippo.org
http://www.onehippo.org/ • i...@onehippo.com
mailto:i...@onehippo.com


On 29 October 2010 07:41, Barbara Slupik
barbara_slu...@wro.vectranet.pl
mailto:barbara_slu...@wro.vectranet.pl wrote:

Hello

The error was caused by the wrong version for ehcache. It works fine
with ehcache-1.2.4.

I defined spring-2.5.6 dependencies in my application:

dependency
groupIdorg.springframework/groupId
artifactIdspring-web/artifactId
version2.5.6/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-orm/artifactId
version2.5.6/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-jdbc/artifactId
version2.5.6/version
/dependency

instead of changing cocoon poms. It works fine.

Barbara


On 19 Oct, 2010, at 11:09 am, Barbara Slupik wrote:

Hello

I am trying to do it but no success so far. I changed spring
dependencies in cocoon-6.pom dependencyManagement section but
get error when starting my block in jetty. What else do I need
to change?

Error:
2010-10-19 09:39:10.268:/:INFO: Initializing Spring root
WebApplicationContext
2010-10-19 09:39:11.448::WARN: failed
org.mortbay.jetty.plugin.jetty6pluginwebappcont...@c4edc7{/,/Developer/Expertys/cocoon-2.2/admin/target/rcl/webapp}

java.lang.AbstractMethodError:
org.apache.cocoon.tools.rcl.springreloader.SynchronizedConfigureableWebApplicationContext.setConfigLocation(Ljava/lang/String;)V

at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:253)


Barbara

On 8 Apr, 2010, at 11:31 am, Thomas Markus wrote:

Hi,

set your version in dependecyManagement section

cocoon2.2 with spring 2.5.6 works fine here (since 2 weeks)

regards
Thomas

Am 07.04.2010 17:04, schrieb Robby Pelssers:

Hi all,

Just wondering if anyone tried to switch to a newer
version of spring while using Cocoon2.2. It currently
has a dependency on several spring-xxx.jar version 2.5.1.

I need to integrate spring-ws within my cocoon
application and this is giving me headaches (probably)
due to dependency conflicts.

So can anyone explain how to make the switch (on Cocoon
side) from using spring 2.5.1 to spring 2.5.6?

And how big is the risk that Cocoon will not work anymore?


Any help is very much appreciated.

Kind regards,
Robby Pelssers



-
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



-
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



-
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








-
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/
StruBioCat   | WWW: www.strubiocat.oulu.fi
NordProt | WWW: www.nordprot.org
Triacle Biocomputing

Re: switch Cocoon 2.2 spring dependencies from 2.5.1 to 2.5.6

2010-10-30 Thread Andre Juffer

Has anybody tried to use Spring 3 with cocoon?

On 10/29/2010 02:05 PM, Jasha Joachimsthal wrote:

Spring 2.5.6 has vulnerability issues, see [1]. It's adviced to upgrade
to 2.5.6.SEC02.


[1] http://www.springsource.com/security/cve-2010-1622

Jasha Joachimsthal

j.joachimst...@onehippo.com mailto:j.joachimst...@onehippo.com -
ja...@apache.org mailto:ja...@apache.org

Hippo
Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31 (0)20
522 4466
USA  • San Francisco  185 H Street Suite B  •  Petaluma CA 94952-5100 •
  +1 (707) 773 4646
Canada•   Montréal  5369 Boulevard St-Laurent #430  •  Montréal QC
H2T 1S5  •  +1 (514) 316 8966
www.onehippo.com http://www.onehippo.com/  • www.onehippo.org
http://www.onehippo.org/  • i...@onehippo.com mailto:i...@onehippo.com


On 29 October 2010 07:41, Barbara Slupik
barbara_slu...@wro.vectranet.pl
mailto:barbara_slu...@wro.vectranet.pl wrote:

Hello

The error was caused by the wrong version for ehcache. It works fine
with ehcache-1.2.4.

I defined spring-2.5.6 dependencies in my application:

dependency
groupIdorg.springframework/groupId
artifactIdspring-web/artifactId
version2.5.6/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-orm/artifactId
version2.5.6/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-jdbc/artifactId
version2.5.6/version
/dependency

instead of changing cocoon poms. It works fine.

Barbara


On 19 Oct, 2010, at 11:09 am, Barbara Slupik wrote:

Hello

I am trying to do it but no success so far. I changed spring
dependencies in cocoon-6.pom dependencyManagement  section but
get error when starting my block in jetty. What else do I need
to change?

Error:
2010-10-19 09:39:10.268:/:INFO:  Initializing Spring root
WebApplicationContext
2010-10-19 09:39:11.448::WARN:  failed

org.mortbay.jetty.plugin.jetty6pluginwebappcont...@c4edc7{/,/Developer/Expertys/cocoon-2.2/admin/target/rcl/webapp}
java.lang.AbstractMethodError:

org.apache.cocoon.tools.rcl.springreloader.SynchronizedConfigureableWebApplicationContext.setConfigLocation(Ljava/lang/String;)V
at

org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:253)

Barbara

On 8 Apr, 2010, at 11:31 am, Thomas Markus wrote:

Hi,

set your version in dependecyManagement section

cocoon2.2 with spring 2.5.6 works fine here (since 2 weeks)

regards
Thomas

Am 07.04.2010 17:04, schrieb Robby Pelssers:

Hi all,

Just wondering if anyone tried to switch to a newer
version of spring while using Cocoon2.2.  It currently
has a dependency on several spring-xxx.jar version 2.5.1.

I need to integrate spring-ws within my cocoon
application and this is giving me headaches (probably)
due to dependency conflicts.

So can anyone explain how to make the switch (on Cocoon
side) from using spring 2.5.1 to spring 2.5.6?

And how big is the risk that Cocoon will not work anymore?


Any help is very much appreciated.

Kind regards,
Robby Pelssers




-
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



-
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



-
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





--
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 

Re: 2.2 Bean heritance

2010-10-15 Thread Andre Juffer

 I am not sure if I understand your question.

You have two beans 'Main' and 'Specific', each to be configured by 
Spring. Specific depends on Main. For you Java lasses, you something like


public class Specific()
{
...
}

public class Main() {
...
private Specific specific;

public void setMain(Specific specific)
{
 this.specific = specific;
}
}

and your bean configuration looks like

bean id=com.foo.bar.Main class=com.foo.bar.MainImpl
/bean

bean id=com.foo.bar.Specific class=com.foo.bar.SpecificImpl
property name=main ref=com.foo.bar.Main /
/bean

Is you question whether or not you would need to include your bean 
configuration as local to a particular block or global to all blocks? My 
answer would be 'local' if these beans are required for particular 
blocks only. Otherwise take one of the blocks and include your beans as 
'global' and they will be the same to all blocks in your webapp.



On 10/15/2010 01:38 AM, florent andré wrote:

Hi all,

Newbie to 2.2 and not a star in spring, so maybe this question is non
sense.

The case :

- I have a module Main where is defined an input-module (AnInput) in a
bean way

- I have a module Specific that depend on the Main and would like to
use AnInput is his sitemap.

I have to redeclare the input-module in the Specific module ? Or there
is a way to use the main one ?

I would prefer the second one is possible.

Thanks for your lights.

++


-
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/
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



Re: 2.2 Bean heritance

2010-10-15 Thread Andre Juffer

 I forgot to include the following link:

http://cocoon.apache.org/2.2/core-modules/core/2.2/1263_1_1.html


On 10/15/2010 01:38 AM, florent andré wrote:

Hi all,

Newbie to 2.2 and not a star in spring, so maybe this question is non
sense.

The case :

- I have a module Main where is defined an input-module (AnInput) in a
bean way

- I have a module Specific that depend on the Main and would like to
use AnInput is his sitemap.

I have to redeclare the input-module in the Specific module ? Or there
is a way to use the main one ?

I would prefer the second one is possible.

Thanks for your lights.

++


-
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/
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



Re: problem encoding using SendMailTransformer

2010-10-08 Thread Andre Juffer

On 10/08/2010 02:36 PM, mvalencia wrote:

map:parameter name=cuerpo value={request-param:id_cuerpo} /
can be the problematic part, since you take the value from the request.

I can remember we applied the tips
http://cocoon.apache.org/2.2/1366_1_1.html once in one of the apps.
AFAIR there should be the  SetCharacterEncodingFilter in your code base.


Yes, SetCharacterEncodingFilter is a filter defined on web.xml of Cocoon
Application:
filter
 filter-nameSetCharacterEncoding/filter-name
 filter-class
   es.sadesi.filter.SetCharacterEncodingFilter/filter-class
 init-param
   param-nameencoding/param-name
   param-valueUTF-8/param-value
 /init-param
   /filter
..
filter-mapping
 filter-nameSetCharacterEncoding/filter-name
 servlet-nameDispatcherServlet/servlet-name
   /filter-mapping
.

I have test put encoding on HTML FORM, so with the parameter:
accept-charset=UTF-8 on FORM tag, but it isn't work. It seems encoding
lose when data go to block conector since Cocoon application, but I not
sure.
   


You could check whether the browser when it display the form to the user 
actually uses the correct encoding (UTF-8).


--
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



Re: Spring Bean Demo and RCL operational?

2010-10-04 Thread Andre Juffer

On 10/04/2010 08:36 PM, Will Heger wrote:

I tried this on a couple of other machines, windows etc. same problem.


Was there anything in logs files? Or if you run jetty from within a 
block, there could be possible error/warning messages.


If you follow exactly what has been explained on the cocoon website,

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

then there should be no problem at all.

Concerning RCL, I know that everything will be reloaded (like XML 
documents, flowscript, etc), but I am not sure about Java. I tend to 
take Java into Netbeans and tests everything there before I allow cocoon 
to call upon it.




On Mon, Oct 4, 2010 at 4:51 AM, Will Heger will.he...@gmail.com
mailto:will.he...@gmail.com wrote:

Hi,

After creating a fresh cocoon from the archetype:
mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org

Using option 2, the block with a sample, I have two problems:

* The Spring Demo Bean does not produces '#message' instead of the
bean output.
* RCL will not recompile after altering java files

Is anyone experiencing a similar issue?

Java = sun/oracle 1.6.0_21
Ubuntu 10.04

Thanks,
-Will





--
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



Re: form encoding issues

2010-09-29 Thread Andre Juffer

On 09/29/2010 12:43 PM, Ron Van den Branden wrote:

 Hi again,

Thank you very much for the quick help; meanwhile I think I found an 
answer in a post on cocoon-dev: 
http://markmail.org/message/nm6bnvqztbee4s5o. There is stated that 
apparently (and counter-intuitively, IMO), 'request parameters are 
always decoded using ISO-8859-1 ',  and that consequently 
'container_encoding should always be ISO-8859-1 (unless you have a 
broken servlet container), and form_encoding should be the same one as 
on your serializer.'.


Actually, Tomcat does, but Jetty does not (by default, UTF8). According 
to specification, servlet engine are suppose to decode using ISO-8859-1 
by default.




And lo: changing the  (over-eager?) container-encoding parameter in 
web.xml back to the default:

init-param
param-namecontainer-encoding/param-name
param-valueISO-8859-1/param-value
/init-param


Do I understand this correctly: you have encoded everything in UTF8, but 
to able to read your input fields (UTF8) you need to decode their value 
with ISO-8859-1 on the server?


I have had cases where the browser was encoding in ISO-8859-1 despite 
the presence of Content-type set to text/html; charset=UTF-8 (it 
simply ignored the HTTP header value).




...seems to do the trick!
(phew!)

(note: I found this info also at 
http://wiki.apache.org/cocoon/RequestParameterEncoding#A3._Decoding_incoming_requests:_Servlet_Container) 



Thanks anyway,

Ron

-
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/
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



Re: Cocoon 2.2 PUT HTTP request

2010-09-22 Thread Andre Juffer

On 09/22/2010 01:27 AM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/21/2010 4:26 PM, Andre Juffer wrote:

I got it working now. It is really in the details.

I always relied upon a PUT request like

http://localhost:/equipment

expecting to see the request method set to PUT. In fact, it was always GET.

If, however, one employs

http://localhost:/equipment/
---^

(Notice the forward slash at the end!)


Wow! So, your server was issuing a redirect to the client?
That usually
only happens when you have something else going on.Is /equipment the
context path of your webapp? If so, I think you have to have /something/
after the /equipment, otherwise it's a request for no resource at all.


The 'equipment' is in fact one of the blocks of my cocoon 2.2 based web 
application. I have currently three blocks, ui, equipment, and eap, the 
latter produces the war file (eap.war) that is to be placed in the 
webapps directory of some servlet engine.


With cocoon, one can also immediately test your application by going 
into one of the blocks (usually the eap) block and enter


mvn jetty:run

instead of copying the eap.war to the webapps directory of the servlet 
engine. One needs to point your browser to


http://localhost:/ui/start

(so without the 'eap' in the path)

and posting equipment would require a POST request using

http://localhost:/equipment/

while updating with PUT would require

http://localhost:/equipment/12345

Note that the latter can also be used in a GET request. In addition, a 
GET request like


http://localhost:/equipment/

results in a list of equipment (with or without the forward slash).


For the equipment block, equipment is than the context path. The 
equipment block's sitemap contains


map:match pattern=*
  map:call function=equipmentHandler /
/map:match

meaning that -all- requests results in a call to equipmentHandler.

The path within the equipment block does not contain anymore 
'equipment'. The issue with the extra forward slash at the end is 
probably a cocoon thing, and because I have map:match pattern=* in 
the sitemap, I guess. Previous applications I have made with cocoon did 
not use the map:match pattern=* so this never occurred. I had things 
like


map:match pattern=manage/*

and I was checking for a 'task' request parameter like in

http://localhost:/equipment/manage?task=update?id=12345

to decide what to do. I never was thinking in terms of REST. The whole 
problem of not having the request parameters never occurred, simply 
because the request parameters where always included in the path as above.


Now, using dojo.xhrPost() or dojo.xhrPut() on the client (Dojo Toolkit) 
, the actual request send to the server is assembled differently, and in 
the case of a POST or PUT request, the request parameters are not 
anymore encoded into the path. Therefore I ran into problems with PUT 
and POST. In all my previous emails, I used the PUT request as an 
example, but I could have used POST as well.


I should note however, in context of REST, a PUT request for creating 
(so not updating) a resource like


http://localhost:/equipment/

does indeed not make sense, as no identification of the resource is 
provided. Creating resources is done with POST if the server can decide 
on the path to (or ID of) the resource. If the client can decide on the 
resource path (or ID), a PUT is appropriate.





Try confirming (say, with LiveHttpHeaders) that the PUT is being
redirected by the server.


This is what I see with LiveHttpHeaders:

 http://localhost:/equipment/

POST /equipment/ HTTP/1.1
Host: localhost:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) 
Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://localhost:/ui/start
Content-Length: 94
Cookie: JSESSIONID=hr0mt4clb1k4; 
webfx-tree-cookie-persistence=wfxt-4+wfxt-6; 
PPA_ID=9qtajhe4ckjkj3mr200ck8jbo3

Pragma: no-cache
Cache-Control: no-cache
name=hallotask=thallocategory=testingmanufacturer=testingdescription=halloownerId=3375104

HTTP/1.1 200 OK
X-Cocoon-Version: 2.2.0
Content-Type: application/json; charset=UTF-8
Content-Length: 320
Server: Jetty(6.1.7)

So, no redirect, as far as I can see. I did not think that was happening.





Requests parameters are not
available, at least not with Jetty 1.6.7 (and I would assume the same is
true for tomcat 6 and 7, did not check).


I've got an enhancement request in for TC 7, and I'm working on a patch.
I have it working -- I'm just working on the unit tests and
documentation, now.


So, this leaves us with the issue with PUT

Re: Cocoon 2.2 PUT HTTP request

2010-09-22 Thread Andre Juffer

On 09/22/2010 06:44 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/22/2010 3:36 AM, Andre Juffer wrote:

Try confirming (say, with LiveHttpHeaders) that the PUT is being
redirected by the server.


This is what I see with LiveHttpHeaders:

  http://localhost:/equipment/

POST /equipment/ HTTP/1.1


No, I meant try to PUT to http://localhost:/equipment (no trailing
slash) and see if the server redirects you. Also, it would be nice to to
know what kind of redirect is being issued. If a 303 response is being
generated, then the client is supposed to use a GET method for the
followup request. Other response codes have other meanings.


OK, sorry about that. Here is the output and I think you are right. It 
actually generates 302 instead of of a 303 response, but the effect is 
probably the same (according to Wikipedia). The second request is not 
mine and is actually a GET request. Note that cocoon 2.2 is about two 
years old and has not been updated since then. I hope cocoon 3 goes main 
stream soon now.


http://localhost:/equipment

PUT /equipment HTTP/1.1
Host: localhost:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) 
Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://localhost:/ui/start
Content-Length: 94
Cookie: JSESSIONID=hr0mt4clb1k4; 
webfx-tree-cookie-persistence=wfxt-4+wfxt-6; 
PPA_ID=9qtajhe4ckjkj3mr200ck8jbo3

name=testertask=testercategory=testermanufacturer=testerdescription=testerownerId=3375104

HTTP/1.1 302 Found
X-Cocoon-Version: 2.2.0
Location: http://localhost:/equipment/
Content-Length: 0
Server: Jetty(6.1.7)

--
http://localhost:/equipment/

GET /equipment/ HTTP/1.1
Host: localhost:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.10) 
Gecko/20100915 Ubuntu/10.04 (lucid) Firefox/3.6.10

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://localhost:/ui/start
Cookie: JSESSIONID=hr0mt4clb1k4; 
webfx-tree-cookie-persistence=wfxt-4+wfxt-6; 
PPA_ID=9qtajhe4ckjkj3mr200ck8jbo3


HTTP/1.1 200 OK
X-Cocoon-Version: 2.2.0
Content-Type: application/json; charset=UTF-8
Content-Length: 1838
Server: Jetty(6.1.7)
--

Under 'generator' I find (note the redirect)

#request# PUT http://localhost:/equipment
PUT /equipment
name=testertask=testercategory=testermanufacturer=testerdescription=testerownerId=3375104 


#request# GET http://localhost:/equipment/
#redirect# GET /equipment/






[W]ith cocoon one can create very easily various
resource representation using XSLT, without the need the hardcode this
into Java. Cocoon 3 (there is an alpha version) is better prepared for
REST.


Excellent. Good luck.


Thanks. And thanks again for your feedback. That was extremely helpful. 
I sincerely hope that you are able to get the request for a new feature 
related to PUT requests in the next version of Tomcat! Many users will 
be very about that (including me).


André



- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyaJEAACgkQ9CaO5/Lv0PBapgCeJuwk/PWW1x+mBKa8gA7x8k6J
paUAnita0RxYiQkAVPogO19b/E+tmCzX
=TbU7
-END PGP SIGNATURE-

-
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/
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



Re: RESTful applications

2010-09-21 Thread Andre Juffer

On 09/20/2010 11:38 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/20/2010 3:06 PM, Andre Juffer wrote:
   

The source of my problem is therefore clear.
 

Absolutely.
   


I've checked Tomcat 7.0.2. Same issue, as expected.

With jetty 7.1.6, I'll get an exception:

2010-09-20 22:32:49.362:WARN::Failed startup of context 
webappcont...@55eb1db2@55eb1db2/eap,[file:/tmp/Jetty_0_0_0_0_8080_eap.war__eap__hlptaf/webinf/, 
jar:f

ile:/home/juffer/jetty-distribution-7.1.6.v20100715/webapps/eap.war!/],/home/juffer/jetty-distribution-7.1.6.v20100715/webapps/eap.war
org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 'org.apache.cocoon.Processor': Initialization of bean 
failed; nested e
xception is org.springframework.beans.factory.BeanCreationException: 
Unable to initialize Avalon component with role 
org.apache.cocoon.Processor; nested exce
ption is 
org.apache.avalon.framework.configuration.ConfigurationException: Cannot 
resolve context://sitemap.xmap


This is probably just a configuration issue as jetty 6 works fine with 
my application. So, I cannot confirm that jetty 7 actually parses a PUT 
request for making parameters available through getParameter(). Jetty 6 
does not seem to do this either as I get exactly the same result as with 
Tomcat 6 and 7. But all of this could as well be caused by cocoon internals.



   

PUT and POST have somewhat different meanings to RESTful applications
and I intend to stick to that. On the tomcat list, it was indeed also
suggested to change a PUT request into a POST request using a Filter. I
prefer to keep things compatible with standards and specifications.
 

So, does that mean that you'd be more amenable to switching from PUT to
POST, or are you interested in getting PUT to work in one way or another?
   
Note that adding a Filter to make PUT work for you doesn't violate any

standards at all: it implements behavior your application requires. The
only thing you could say is that is does something /other/ than what the
servlet specification requires. Also note that parsing PUT bodies does
not violate the servlet spec: it's simply not required by it, and
therefore Tomcat doesn't implement it.



Based upon this thread and the others you've probably read, I've filed
   



an enhancement request against Tomcat:

https://issues.apache.org/bugzilla/show_bug.cgi?id=49964

Feel free to comment on this bug if you'd like.
   

Great!

I would not like to convert a PUT into a POST request. This would 
obscure the meaning of and differences between PUT and POST in context 
of RESTful applications. My opinion is that in the case of a PUT 
request, the servlet should simply pars the request and make the 
parameters available through the getParameters() family. As you said, 
this does not violate any specification. Therefore, I am in full support 
of this feature request (no sure whether you should call this a bug).


For now, I will assume a POST instead of a PUT request and decide inside 
equipmentHandler() what to do. This keeps maintenance of the code 
simple. I will make some modifications this evening to see how this is 
going. But if the request method is still GET, then this would not solve 
anything.
   

[The DefaultServlet has a] readonly parameter in web.xml to change this 
behavior,
but indeed this would not have any impact since the request is handled
by my cocoon2.2-based servlet.
 

Exactly: DefaultServlet was written to implement PUT as specified in the
HTTP specification, and knows nothing about your REST stuff.

   

All Tomcat versions should behave this way, as the servlet specification
has been (relatively) consistent across the versions covered by Tomcat
implementations.
   

Yes, I got to the same conclusion, again from the Tomcat list. That list
was in fact extremely helpful to understand what is going on.
 

Good. We try to be helpful :)
   


Thanks!
   

I use the sitemap that was generated during block creation with Maven,
as documented on the cocoon website.

[snip]

The pipeline that handles the request is really extremely simple:

map:match pattern=*
   map:call function=equipmentHandler
 map:parameter name=method value={request:method} /
   /map:call
/map:match
 

Hmm... I've never worked with functions as you have above, but I
definitely use the request matcher. Here's what I have in one of my
pipelines, and it definitely works when nested insidemap:transform:
   


You don't have to. My function is communicating among other with a 
database to get things done. But in certain cases, one can also 
accomplish this with XSLT stylesheets. Javascript (or actually 
Flowscrip) is very convenient to handle client requests and making the 
right call to the domain layer.



  map:parameter name=requestScheme value={request:scheme} /
  map:parameter name=requestServerName value={request:serverName} /
  map:parameter name=requestServerPort value

Re: RESTful applications

2010-09-21 Thread Andre Juffer

Christopher,

On 09/20/2010 11:38 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
   


[The DefaultServlet has a] readonly parameter in web.xml to change this 
behavior,
but indeed this would not have any impact since the request is handled
by my cocoon2.2-based servlet.
 

Exactly: DefaultServlet was written to implement PUT as specified in the
HTTP specification, and knows nothing about your REST stuff.
   


I found this (for Tomcat 5)

http://webcache.googleusercontent.com/search?q=cache:lJ-4J6f0GPQJ:old.nabble.com/How-to-configure-Toncat-to-accept-HTTP-PUT-requests--td18652489.html+%22HTTP+PUT%22+Tomcathl=enstrip=1

Seems to indicate that one can apply this to the individual wepapps as 
well. I thought that the readOnly configuration parameter could be 
employed only for the default webapp (DefaultServlet).


--
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



Cocoon 2.2 PUT HTTP request

2010-09-21 Thread Andre Juffer

Dear All,

in a previous thread, I was trying to understand why I could not see the 
request parameters of a HTTP PUT request using the 
cocoon.request.getParameter(...) family of methods in flowscript. 
Conclusion: For a PUT request, according to specification, the servlet 
engine is -not- required to parse the request for making the parameters 
available through request.getParameter(..) and consequently also 
cocoon.request.getParameter(...) will not return a value (just 
'null'). [1]


One remedy is assume POST requests (client side) instead for the time 
being, despite differences in the meaning of POST and PUT with regard to 
RESTful applications.


There is still one other issue to be solved. In the case of a PUT 
request (or any other HTTP request for that matter), my understanding is 
that I should be able to identify the request HTTP method in flowscript 
by cocoon.request.getMethod() or in a pipeline using map:parameter 
name=method value={request:method} /. I find in either case that 
this parameter's value is always GET, whatever the original request 
method received by the servlet engine was. It seems that the original 
request method value is simply lost somewhere, -before- the request is 
being handled in the sitemap.


I now seek answers to the following:

1. Can one of you confirm (or not) that this is indeed the case. That 
is, cocoon interferes with the original request and makes it a (or 
creates a new) GET request. It is certain that the servlet engine 
receives the PUT request in good order. It is also certain that the 
servlet engine is not changing the original request. It simply passes it 
on the cocoon-based webapp.


2. If item 1 above is in fact true (and I really hope this is not the 
case), what would be solution to overcome this issue. I could image 
making a filter that adds an extra parameter or attribute 
'request-method' or something to the request that retains the original 
HTTP method and query for its value in the sitemap or in flowscript.  I 
have to hope that cocoon retains this extra parameter or attribute when 
it receives the request.


I would very much appreciate any response in this matter. I could not 
find answers on the cocoon email lists or in the documentation, 
unfortunately.



[1] 
http://mail-archives.apache.org/mod_mbox/cocoon-users/201009.mbox/browser


--
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



Re: Cocoon 2.2 PUT HTTP request

2010-09-21 Thread Andre Juffer

Thanks for your response.

I am going to try this and see if this works. The RequestMethodSelector 
is also available in Cocoon 2.2. I just did not expect that one must use 
it to identify the request method in the sitemap, given that the request 
object is available as cocoon.request in flow as well.



On 09/21/2010 04:40 PM, florent andré wrote:

Hi Andre,

Thanks for your day to day research feedback.

In Lenya (widely use of cocoon), we have this :
map:select type=request-method
!-- many client editors like to PUT changes --
map:when test=PUT
map:mount uri-prefix= 
src={fallback:lenya/modules/webdav/sitemap.xmap} check-reload=true 
reload-method=synchron/

/map:when
/map:select

So the request-method selector seems to detect PUT.

The selector is implemented here : 
cocoon_2_1_x/src/java/org/apache/cocoon/selection/RequestMethodSelector.java 



With this code :
String method = ObjectModelHelper.getRequest(objectModel).getMethod();

Note that is cocoon 2.1, but normaly no big changes with 2.2.

Maybe selector and input don't have the same implementation ?

Just some piece of informations I have. I'm not enough inform about 
how cocoon deal with request for helping more.

HTH

++


On 09/21/2010 03:10 PM, Andre Juffer wrote:

Dear All,

in a previous thread, I was trying to understand why I could not see the
request parameters of a HTTP PUT request using the
cocoon.request.getParameter(...) family of methods in flowscript.
Conclusion: For a PUT request, according to specification, the servlet
engine is -not- required to parse the request for making the parameters
available through request.getParameter(..) and consequently also
cocoon.request.getParameter(...) will not return a value (just
'null'). [1]

One remedy is assume POST requests (client side) instead for the time
being, despite differences in the meaning of POST and PUT with regard to
RESTful applications.

There is still one other issue to be solved. In the case of a PUT
request (or any other HTTP request for that matter), my understanding is
that I should be able to identify the request HTTP method in flowscript
by cocoon.request.getMethod() or in a pipeline using map:parameter
name=method value={request:method} /. I find in either case that
this parameter's value is always GET, whatever the original request
method received by the servlet engine was. It seems that the original
request method value is simply lost somewhere, -before- the request is
being handled in the sitemap.

I now seek answers to the following:

1. Can one of you confirm (or not) that this is indeed the case. That
is, cocoon interferes with the original request and makes it a (or
creates a new) GET request. It is certain that the servlet engine
receives the PUT request in good order. It is also certain that the
servlet engine is not changing the original request. It simply passes it
on the cocoon-based webapp.

2. If item 1 above is in fact true (and I really hope this is not the
case), what would be solution to overcome this issue. I could image
making a filter that adds an extra parameter or attribute
'request-method' or something to the request that retains the original
HTTP method and query for its value in the sitemap or in flowscript. I
have to hope that cocoon retains this extra parameter or attribute when
it receives the request.

I would very much appreciate any response in this matter. I could not
find answers on the cocoon email lists or in the documentation,
unfortunately.


[1]
http://mail-archives.apache.org/mod_mbox/cocoon-users/201009.mbox/browser 





-
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/
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



Re: Cocoon 2.2 PUT HTTP request

2010-09-21 Thread Andre Juffer

On 09/21/2010 07:38 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

(Is everyone on the list named Andre? :)


No, there is Robbie as well!



On 9/21/2010 9:10 AM, Andre Juffer wrote:

There is still one other issue to be solved. In the case of a PUT
request (or any other HTTP request for that matter), my understanding is
that I should be able to identify the request HTTP method in flowscript
by cocoon.request.getMethod() or in a pipeline usingmap:parameter
name=method value={request:method} /. I find in either case that
this parameter's value is always GET, whatever the original request
method received by the servlet engine was. It seems that the original
request method value is simply lost somewhere, -before- the request is
being handled in the sitemap.


I'll check to see what I can get from {request:method} in my sitemap.
Other {request:*} methods seem to be working okay, though. I am also
using Cocoon 2.1, but at (the other) Andre points out, the differences
shouldn't be great in these areas.

I'm still interested in how Cocoon passes parameters to functions. In
the code you posted before, it didn't seem like you were actually trying
to access that parameter. If you use {request:method} in your pipeline,
I suspect it will give you the right method as long as you read the
/parameter/ instead of trying to use cocoon.request.getMethod() as it
appeared you were doing.


That's right. Both approaches are fine. I tend to use the 
cocoon.request.get* because it is available anyways within flowscript 
functions.




I find the Cocoon documentation very difficult to navigate. Can you
point me to the documentation for calling javascript functions? All I
could find was this:
http://cocoon.apache.org/2.2/core-modules/core/2.2/844_1_1.html


Yeah, it is not that well organized. Have a look at:

http://cocoon.apache.org/2.2/blocks/flowscript/1.0/1241_1_1.html



- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyY36MACgkQ9CaO5/Lv0PALAgCgtih3jh2Z4nqm+RuRafLbGOEe
qCAAoLofwTo+Tah8/kyZlF2sA2B504Wh
=B+Zg
-END PGP SIGNATURE-

-
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/
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



Re: RESTful applications

2010-09-21 Thread Andre Juffer

On 09/21/2010 07:41 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/21/2010 6:22 AM, Andre Juffer wrote:

I found this (for Tomcat 5)

http://webcache.googleusercontent.com/search?q=cache:lJ-4J6f0GPQJ:old.nabble.com/How-to-configure-Toncat-to-accept-HTTP-PUT-requests--td18652489.html+%22HTTP+PUT%22+Tomcathl=enstrip=1

Seems to indicate that one can apply this to the individual wepapps
as well.


Correct: you can configure the DefaultServlet specifically for an
individual webapp if you choose. Otherwise, you inherit the global
configuration that gets applied to all webapps.


I thought that the readOnly configuration parameter could be employed
only for the default webapp (DefaultServlet).


I think you're confusing webapps (represented by a ServletContext
object) with servlets, of which the DefaultServlet is one. Each webapp
gets a copy of a DefaultServlet deployed into it to handle requests not
otherwise mapped.


OK, got it. Thanks for pointing this out. I learn these things on the 
fly and get sometimes the terminology wrong.




- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyY4FAACgkQ9CaO5/Lv0PCv/gCfaO/R2awXV7MXwq7vRkzsrrpU
4FcAniEuYEh92U/XXGFbB7JStJfY++JO
=Mori
-END PGP SIGNATURE-

-
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/
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



Re: Cocoon 2.2 PUT HTTP request

2010-09-21 Thread Andre Juffer

On 09/21/2010 09:40 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/21/2010 2:04 PM, Andre Juffer wrote:

On 09/21/2010 07:38 PM, Christopher Schultz wrote:

I find the Cocoon documentation very difficult to navigate. Can you
point me to the documentation for calling javascript functions? All I
could find was this:
http://cocoon.apache.org/2.2/core-modules/core/2.2/844_1_1.html


Yeah, it is not that well organized. Have a look at:

http://cocoon.apache.org/2.2/blocks/flowscript/1.0/1241_1_1.html


In the examples, I see them use code like this:

cocoon.request.get(foo)

to get a request parameter. get() is not a standard method on
HttpServletRequest, so this must be some kind of wrapper around
HttpServletRequest.


This provides an overview of the cocoon.request methods:

http://cocoon.apache.org/2.2/blocks/flowscript/1.0/1383_1_1.html

You will find there both cocoon.request.get(..) and 
cocoon.request.getParameter(..). I've used for other applications I've 
made in the past always the getParameter() function. Never worried 
about PUT requests.


Check out the links on the left as well.




There seems to be nothing about working withmap:parameter  elements
from the sitemap in the flowscript. :(


Yeah, you're right. I thought it was explained there. There is indeed 
almost no information about map:parameter on the cocoon 2.2 site, 
except for


http://cocoon.apache.org/2.2/core-modules/core/2.2/852_1_1.html

However, on the cocoon 2.1 site, there is the following:

http://cocoon.apache.org/2.1/userdocs/flow/sitemap.html




- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyY/CgACgkQ9CaO5/Lv0PDbZgCfSd98cokDRntfHnLRMkDLduTz
0LAAoKlpGlBDntPj09UTTlyVID7OZkS+
=JCr8
-END PGP SIGNATURE-

-
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/
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



Re: Cocoon 2.2 PUT HTTP request

2010-09-21 Thread Andre Juffer

On 09/21/2010 10:52 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/21/2010 3:15 PM, Andre Juffer wrote:

This provides an overview of the cocoon.request methods:

http://cocoon.apache.org/2.2/blocks/flowscript/1.0/1383_1_1.html


Okay, this looks like a HttpServletRequest object with a few more
methods (like get()). It's too bad the methods are poorly documented:
for instance, get() says that it gets an object from either the
attributes or parameters, but doesn't tell you what the rules are about
when it chooses parameter or attribute.

In either case, that parameter would almost certainly be a /request
parameter/, not a parameter to the function itself.


However, on the cocoon 2.1 site, there is the following:

http://cocoon.apache.org/2.1/userdocs/flow/sitemap.html


That seems to indicate that the proper way to pass parameters from the
sitemap to the flowscript function is like this:

map:match pattern=*
   map:call function=equipmentHandler
 map:parameter name=method value={request:method} /
   /map:call
/map:match

and read them like this:

function equipmentHandler()
{
 var request = cocoon.request;
 var method = cocoon.parameters.method;
...


Actually I already tried this before. Did not work either. But please 
read my next email I got it working!



See if that works for you.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyZDQcACgkQ9CaO5/Lv0PB50wCggBRhrbi7JSoDEvsTj4YnHRXf
CggAoJXr6TiRSQBznh131qQeqGJ91m4C
=svV1
-END PGP SIGNATURE-

-
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/
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



Re: Cocoon 2.2 PUT HTTP request

2010-09-21 Thread Andre Juffer

Chris,

I got it working now. It is really in the details.

I always relied upon a PUT request like

http://localhost:/equipment

expecting to see the request method set to PUT. In fact, it was always GET.

If, however, one employs

http://localhost:/equipment/
---^

(Notice the forward slash at the end!)

then the request method is set to PUT. Requests parameters are not 
available, at least not with Jetty 1.6.7 (and I would assume the same is 
true for tomcat 6 and 7, did not check). This is what one could expect, 
as the specification does not require the availability of the request 
parameters. A GET request with request parameters should also use the 
forward slash at the end like


http://localhost:/equipment/?para1=val1param2=val2

But a GET without parameters like

http://localhost:/equipment/123456

is OK (is always interpreted as a GET).

Using a POST request instead (and with the forward slash), the request 
method is POST and all parameters are now available through the 
getParameter() family of methods ion flowscript. I've not tried any of 
the other request methods like DELETE.


So, this leaves us with the issue with PUT not having the parameters 
available, but at least the request method is now properly set.


I was almost ready to switch to a different framework like 
https://jersey.dev.java.net/. Almost 


Thanks,
André

On 09/21/2010 09:40 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/21/2010 2:04 PM, Andre Juffer wrote:

On 09/21/2010 07:38 PM, Christopher Schultz wrote:

I find the Cocoon documentation very difficult to navigate. Can you
point me to the documentation for calling javascript functions? All I
could find was this:
http://cocoon.apache.org/2.2/core-modules/core/2.2/844_1_1.html


Yeah, it is not that well organized. Have a look at:

http://cocoon.apache.org/2.2/blocks/flowscript/1.0/1241_1_1.html


In the examples, I see them use code like this:

cocoon.request.get(foo)

to get a request parameter. get() is not a standard method on
HttpServletRequest, so this must be some kind of wrapper around
HttpServletRequest.

There seems to be nothing about working withmap:parameter  elements
from the sitemap in the flowscript. :(

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyY/CgACgkQ9CaO5/Lv0PDbZgCfSd98cokDRntfHnLRMkDLduTz
0LAAoKlpGlBDntPj09UTTlyVID7OZkS+
=JCr8
-END PGP SIGNATURE-

-
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/
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



Re: RESTful applications

2010-09-20 Thread Andre Juffer
Could it be true that Jetty (the one that comes with cocoon is 6.1.7, a 
rather old one) is actually not supporting the getParameters() famility 
of methods when the HTTP request method is PUT? It just supports GET and 
HEAD (is required to support these methods). If so, the problem is 
Jetty, not cocoon.


I came across some comments that Tomcat (did not mention which version 
of Tomcat) is also not supporting the getParameters() famility of 
methods [1]. Tomcat can actually handle PUT, POST etc requests, but 
blocks them by default [2].


Anyone can confirm this?

[1] http://osdir.com/ml/users-tomcat.apache.org/2010-03/msg01410.html
[2] http://marc.info/?l=tomcat-userm=127382305322732w=2

On 09/19/2010 05:42 PM, Andre Juffer wrote:

Let me just add some additional information.

I use Dojo 1.5 (www.dojotoolkit.org) on the client (browser). No dojo 
on the server. I've created a few blocks (one of them is called 
'equipment' and another one is called 'webapp') according to the 
cocoon 2.2 documentation. No extra configuration was done. I do not 
use CForms at all.


At some point, on the client (firefox) a form is processed that 
results in a HTTP PUT request. The request is assembled with 
dojo.xhrPut(), a Dojo function. With Firebug 1.5.4, I see that the 
following request is submitted (cut and pasted from the Firebug console):


PUT http://localhost:/equipment

Parameters (application/x-www-form-urlencoded)

categoryTest
descriptionTesting purposes
manufacturerTester Ltd.
nameTest
ownerId3375104
taskTesting

So far, so good. There is nothing special about this request. Jetty 
receives the request (jetty was started with mvn jetty:run from the 
webapp block).


The sitemap in the equipment block contains:

map:match pattern=*
map:call function=equipmentHandler
/map:match

So, all requests are handled by the function 'equipmentHandler()' (for 
now at least). This function subsequently calls upon 
cocoon.request.getMethod() to find out what the HTTP request method is 
and proceeds accordingly. The cocoon.request.getMethod() always 
returns GET. I tested this with 
java.lang.System.out.println(cocoon.request.getMethod()). As a matter 
of fact, none of the parameters listed above ever reach the 
equipmentHandler() function. Each cocoon.request.getParameter(..) 
calls returns null.


Could this be an encoding issue? I went through 
http://cocoon.apache.org/2.2/1366_1_1.html.


Thanks for your help,
André


On 09/18/2010 08:52 PM, Andre Juffer wrote:

Hi,

I am building a RESTful application with cocoon 2.2. I need to be able
to identify the request method. It appears that in the sitemap,
{request:method}, or in flow, cocoon.request.getMethod(), the HTTP
method value always is GET. I need to be able to distinguish between
GET, PUT, OPTIONS, etc in order to handle the request accordingly. If
the method value is always GET, then I won't be able to do so. I've
tested this all with a tool called RESTClient from WizTools at
http://rest-client.googlecode.com/.

Could one of you (not) confirm my observation? What to do if indeed the
request method is always set to GET?

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



Re: RESTful applications

2010-09-20 Thread Andre Juffer

Just a another follow up.

It appears that the whole issue is indeed caused by the servlet engine. 
According to the sevlet specification, a PUT request will not necessary 
be parsed for extracting request parameters to make them available 
through the getParameters() family of methods. It is actually up to the 
servlet engine whether or not it will do so. In contract, a POST request 
should (if certain conditions are met). For a PUT request, it seems that 
Tomcat 6 is -not- parsing the request for extracting parameters [1], 
while I found some vague statements that Jetty (version unclear) will 
extract the parameters even for a PUT request. I will try to confirm 
this all later today.


I would appreciate some response in this matter...

[1] http://marc.info/?l=tomcat-userm=127005757912988w=2


On 09/20/2010 01:34 PM, Andre Juffer wrote:
Could it be true that Jetty (the one that comes with cocoon is 6.1.7, 
a rather old one) is actually not supporting the getParameters() 
famility of methods when the HTTP request method is PUT? It just 
supports GET and HEAD (is required to support these methods). If so, 
the problem is Jetty, not cocoon.


I came across some comments that Tomcat (did not mention which version 
of Tomcat) is also not supporting the getParameters() famility of 
methods [1]. Tomcat can actually handle PUT, POST etc requests, but 
blocks them by default [2].


Anyone can confirm this?

[1] http://osdir.com/ml/users-tomcat.apache.org/2010-03/msg01410.html
[2] http://marc.info/?l=tomcat-userm=127382305322732w=2

On 09/19/2010 05:42 PM, Andre Juffer wrote:

Let me just add some additional information.

I use Dojo 1.5 (www.dojotoolkit.org) on the client (browser). No dojo 
on the server. I've created a few blocks (one of them is called 
'equipment' and another one is called 'webapp') according to the 
cocoon 2.2 documentation. No extra configuration was done. I do not 
use CForms at all.


At some point, on the client (firefox) a form is processed that 
results in a HTTP PUT request. The request is assembled with 
dojo.xhrPut(), a Dojo function. With Firebug 1.5.4, I see that the 
following request is submitted (cut and pasted from the Firebug 
console):


PUT http://localhost:/equipment

Parameters (application/x-www-form-urlencoded)

categoryTest
descriptionTesting purposes
manufacturerTester Ltd.
nameTest
ownerId3375104
taskTesting

So far, so good. There is nothing special about this request. Jetty 
receives the request (jetty was started with mvn jetty:run from the 
webapp block).


The sitemap in the equipment block contains:

map:match pattern=*
map:call function=equipmentHandler
/map:match

So, all requests are handled by the function 'equipmentHandler()' 
(for now at least). This function subsequently calls upon 
cocoon.request.getMethod() to find out what the HTTP request method 
is and proceeds accordingly. The cocoon.request.getMethod() always 
returns GET. I tested this with 
java.lang.System.out.println(cocoon.request.getMethod()). As a matter 
of fact, none of the parameters listed above ever reach the 
equipmentHandler() function. Each cocoon.request.getParameter(..) 
calls returns null.


Could this be an encoding issue? I went through 
http://cocoon.apache.org/2.2/1366_1_1.html.


Thanks for your help,
André


On 09/18/2010 08:52 PM, Andre Juffer wrote:

Hi,

I am building a RESTful application with cocoon 2.2. I need to be able
to identify the request method. It appears that in the sitemap,
{request:method}, or in flow, cocoon.request.getMethod(), the HTTP
method value always is GET. I need to be able to distinguish between
GET, PUT, OPTIONS, etc in order to handle the request accordingly. If
the method value is always GET, then I won't be able to do so. I've
tested this all with a tool called RESTClient from WizTools at
http://rest-client.googlecode.com/.

Could one of you (not) confirm my observation? What to do if indeed the
request method is always set to GET?

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



Re: RESTful applications

2010-09-20 Thread Andre Juffer

On 09/20/2010 08:25 PM, Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andre,

On 9/20/2010 6:34 AM, Andre Juffer wrote:

Could it be true that Jetty (the one that comes with cocoon is 6.1.7, a
rather old one) is actually not supporting the getParameters() family
of methods when the HTTP request method is PUT?


This almost certainly the case: the servlet specification only requires
that getParameter handle request-body data under certain conditions.
- From the 2.5 version of the spec, section SRV.3.1.1:


The following are the conditions that must be met before post form data
will
be populated to the parameter set:
1. The request is an HTTP or HTTPS request.
2. The HTTP method is POST.
3. The content type is application/x-www-form-urlencoded.
4. The servlet has made an initial call of any of the getParameter
family of methods on the request object.


So, when you use PUT, you don't get parameters in the usual way: you'll
have to parse them yourself in some way.


Yes, this is exactly right. The discussion you refer to is the one that 
I also have read. The source of my problem is therefore clear.




You might want to refer to this thread on the Tomcat-User mailing list
for an extended discussion: http://markmail.org/thread/kinlccrweiaesqoh

Note that parameters placed into the URL are always available via
request.getParameter*


Also correct. I've experimented with this already.



There are several ways you could get your server to extract request-body
PUT parameters and make them available via the getParameter* family of
methods. One such way (which would avoid having to do anything nasty
within Cocoon itself) would be to write a request Filter that overrides
getParameter* and parses a request body if it is a PUT request.

I have philosophical issues against doing such a thing because I feel
that PUT was designed to put a copy of the entire request body into the
URL used to access it, not to pass some complex set of parameters in
the body itself to do something else. But, that's not really for me to
decide on your behalf: if you want POST behavior from PUT, you'll likely
have to code it yourself in some way. I can give you some suggestions if
you would like to take this route.


PUT and POST have somewhat different meanings to RESTful applications 
and I intend to stick to that. On the tomcat list, it was indeed also 
suggested to change a PUT request into a POST request using a Filter. I 
prefer to keep things compatible with standards and specifications.





I came across some comments that Tomcat (did not mention which version
of Tomcat) is also not supporting the getParameters() famility of
methods [1]. Tomcat can actually handle PUT, POST etc requests, but
blocks them by default [2].

Anyone can confirm this?


I can: Tomcat's DefaultServlet (the servlet that responds to all request
that aren't otherwise handled by other servlets) rejects PUT (and POST)
requests, but you don't want the DefaultServlet to accept them anyway:
you want your REST-processing code to handle them. Tomcat will not
interfere with any servlet that expects to accept a PUT request.


The is indeed the readonly parameter in web.xml to change this behavior, 
but indeed this would not have any impact since the request is handled 
by my cocoon2.2-based servlet.


All Tomcat versions should behave this way, as the servlet specification
has been (relatively) consistent across the versions covered by Tomcat
implementations.


Yes, I got to the same conclusion, again from the Tomcat list. That list 
was in fact extremely helpful to understand what is going on.




Your first problem, though, was that request.getMethod was always
returning GET even when the method should be PUT, right?


Correct.



Can you show us how you have configured your pipepine (including how you
extract the method from the request) and also how you are declaring
and then using the method in your XSLT?


I use the sitemap that was generated during block creation with Maven, 
as documented on the cocoon website. I've added the following:


map:serializers
  map:serializer name=json mime-type=application/json; 
charset=UTF-8 src=org.apache.cocoon.serialization.TextSerializer

encodingUTF-8/encoding
  /map:serializer
  map:serializer name=xml mime-type=text/xml
  src=org.apache.cocoon.serialization.XMLSerializer
encodingUTF-8/encoding
  /map:serializer
/map:serializers

The pipeline that handles the request is really extremely simple:

map:match pattern=*
  map:call function=equipmentHandler
map:parameter name=method value={request:method} /
  /map:call
/map:match

So, all requests are forwarded to a single function (for now). The 
map:parameter is just there to test the value of the request method, as 
I did not get the expected response. I actually do not use it in any 
XSLT. I will remove this line as soon as I get the right request method 
value in the equipmentHandler() function

  1   2   3   >