Re: NullPointerException in AbstractWidgetDefinitionBuilder

2008-01-28 Thread Harald Entner

Vadim Gritsenko schrieb:

On Jan 17, 2008, at 10:47 AM, Vadim Gritsenko wrote:


On Jan 17, 2008, at 8:12 AM, Joerg Heinicke wrote:


On 17.01.2008 05:45, Harald Entner wrote:

In normal mode everything runs fine. But when running a jmeter test 
with 40 concurrent users, the AbstractWidgetDefinitionBuilder 
throws a NullPointerException.


It's now fixed in 2.1 branch, cocoon-forms-1.0.0 branch, and in trunk.

Vadim

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



Thanks Vadim, i will check it out soon.


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



Re: upload-max-size with no effect

2008-01-28 Thread Jean-Claude Vogel
Thank for your reply,

Like you said, I tried to add an upload-max-size init param in the Spring
configuration of the Cocoon SitemapServlet but I have still the same error.

Here is what I wrote :
bean id=zzz.ma-adminui.block class=
org.apache.cocoon.sitemap.SitemapServlet
servlet:context mount-path=/ui
context-path=blockcontext:/ma-adminui/ 

servlet:init-params
entry key=upload-max-size value=1000 /
/servlet:init-params

servlet:connections
entry key=ajax value-ref=
org.apache.cocoon.ajax.impl.servlet /
entry key=forms value-ref=
org.apache.cocoon.forms.impl.servlet /
entry key=services value-ref=zzz.ma-service.block/
/servlet:connections
/servlet:context
/bean

Perhaps is my syntax wrong, I am still looking for it on the net.

Best regards,
JC

2008/1/26, Grzegorz Kossakowski [EMAIL PROTECTED]:

 Jean-Claude Vogel pisze:
  Hello,
 
  I would like to upload a file in a Cocoon forms ihm, so I have fixed the
  limit upload size in my web.xml :
  servlet
  descriptionCocoon blocks dispatcher/description
  display-nameDispatcherServlet/display-name
  servlet-nameDispatcherServlet/servlet-name
 
  servlet-classorg.apache.cocoon.servletservice.DispatcherServlet
 /servlet-class
  init-param
  param-nameenable-uploads/param-name
  param-valuetrue/param-value
  /init-param
  init-param
  param-nameupload-max-size/param-name
  param-value1000/param-value
  /init-param
  load-on-startup2/load-on-startup
  /servlet
 
  It works fine when I upload a small file. But when I try to upload a
  bigger file I am still having the exception :
  Could somebody explain me what is wrong in my code please ?

 Hi Jean,

 I'm not sure but I guess that it's SitemapServlet that makes checks for
 upload limits and other
 fancy stuff. If you pass the configuration to the DispatcherServlet it
 never reaches SitemapServlet.

 I suggest to move this configuration to declaration of your SitemapServlet
 bean. Try again and
 report back if it still works for you.

 Best regards,

 --
 Grzegorz Kossakowski
 Committer and PMC Member of Apache Cocoon
 http://reflectingonthevicissitudes.wordpress.com/

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




Re: upload-max-size with no effect

2008-01-28 Thread Grzegorz Kossakowski
Jean-Claude Vogel pisze:
 Thank for your reply,
 
 Like you said, I tried to add an upload-max-size init param in the
 Spring configuration of the Cocoon SitemapServlet but I have still the
 same error.
 
 Here is what I wrote :
 bean id=zzz.ma-adminui.block
 class=org.apache.cocoon.sitemap.SitemapServlet
 servlet:context mount-path=/ui
 context-path=blockcontext:/ma-adminui/ 
 
 servlet:init-params
 entry key=upload-max-size value=1000 /
 /servlet:init-params
 
 servlet:connections
 entry key=ajax
 value-ref=org.apache.cocoon.ajax.impl.servlet /
 entry key=forms
 value-ref=org.apache.cocoon.forms.impl.servlet /
 entry key=services value-ref=zzz.ma-service.block/
 /servlet:connections
 /servlet:context
 /bean
 
 Perhaps is my syntax wrong, I am still looking for it on the net.

Your syntax is right. I have taken a closer look and found that we have changed 
whole mechanism and
configuration for it.

Now you need to configure it using properties, the list of them you can find 
there [1]. I hope you
know how to set them in your block.

Actually, it's perfect work for some volunteer to add this information to 
documentation, for
example, as a FAQ entry.

[1]
http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartConfigurationHelper.java?view=markup

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

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



Re: C2.2: Accessing form via servlet services?

2008-01-28 Thread Rainer Pruy


Grzegorz Kossakowski schrieb:
 Rainer Pruy pisze:
 Thanks Grzegorz
 for illustrating some aspects of the basic concepts.

 From my first post in this thread you can read that I already had the 
 impression
 that on the way from M to A some POST call might be missing in the 
 interaction. And thus unsuccessfully tried to abuse some mechanisms
 of SSP to get the trick done.
 
 You are right, I forgot about your attempts.
 
 I think, you're right that inverting control will allow for keeping the 
 necessary control for a e.g. form contained within block A.
 I'm still pondering the structural difference between my approach and the 
 structure and ideas laid out by you.
 I'm not yet sure, I'll get convinced to it, but more on this further down
 
 Don't worry, I expected little opposition from you. :-)
 
 To put the reasoning behind my structure a bit clearer:

 M is the master entry point of a web based application. There reside access 
 control, (top) navigation logic and basic contract for
 presentation (e.g. themes).

 The application consists of a dynamic set of modules (e.g. A) that implement 
 various aspects of possible interactions and
 functionality of the application. Thus, the basic contract and interface of 
 M is most likely known when e.g. A is implemented.

 However, in the end, I'd like to implement M without knowledge of any of the 
 (possible) blocks (e.g. A) that the application
 installation is composed of at a given time. (So, just add a new block and 
 there are new menu entries and is new functionality)
 
 Yes, it's fair requirement to implement block providing common functionality 
 and resources without
 thinking about particular cases (blocks). I would like to change name for M 
 block. In my humble
 opinion it's not *master* but *common* block. It contains resources that are 
 commonly used for pages
 generation.

Agreed, that would better reflect it's role in page composition.
However, a small but nevertheless important role is authentication and (global) 
authorization.
I have the firm conviction that it is bad design to rely on each subordinate 
block (the As) to correctly implement the
authentication and authorization contract of the overall application. 
Especially if we allow for such blocks to be contributed by
third parties. Not involved with putting up the application in the first 
place (e.g. customers).
 
 After changing wording a little I think that real role of M block becomes a 
 little more evident:
 it's just accessed by other blocks generating specific page. As you see, I 
 suggest to invert role of
 M block too; from the block accessing (in order to do delegation) all other 
 block to the block
 accessed by all other blocks requiring common stuff.
 
 Spring does help a lot here (e.g. registering new menu entries with a 
 global manager located with block M).
 Nevertheless the whole idea fails miserably, if any menu from a subsidiary 
 block requires some additional coding with M.
 
 I don't understand why you would need to modify M when new A block is added. 
 Could you give an example?

If there is no inversion of control, and passing (POST) requests resulting from 
submitting forms does not work transparently, the
there must be provisions with M to process forms from any subordinate block.
 
 Anyway, you are touching on another aspect of SSF: dynamic blocks/services 
 discovery[1].

Having a standardized way of discovering blocks dynamically, would ease 
handling the overall structure (e.g. better error messages on
requests to (currently) not available blocks...)
For my current use case, I can come by without, as there is a quite strong 
motivation for an implementor of a subordinate block to
follow a local registration policy (otherwise it won't work reasonably).
 
 So, yes, I'am making use of delegation of control here (at least for some 
 detail aspects of the final page).
 But that should just resemble standard functional delegation, same as it 
 is quite natural with calling functions in classic
 programming languages.
 
 Agreed but lets think about it for a while. Isn't it weird that you have one 
 single function that
 takes numerous parameters that it doesn't care about but only passes to 
 another function and only
 there all the interesting stuff is happening? Don't you have a feeling that 
 this big procedure is
 redundant and only adds to stack trace unnecessarily? I have such feeling all 
 the time I think about
 it...

As it adds single point of authentication/authorization it is not redundant 
in the first place.
When just considering contribution to resulting page, you are right.

 
 If you invert roles, then A block also uses delegation for generating common 
 layout but this time
 there is only one procedure taking numerous parameters and the second, 
 responsible for generation of
 common stuff, takes only a few of them or maybe even none. I see such 
 situation as improvement and
 less complex code.

Yes, it will simplify code for M 

Re: upload-max-size with no effect

2008-01-28 Thread Jean-Claude Vogel
Thank a lot,

I fact I don't know how to set static variables in the spring configuration
of the block but I will look for it. If you can send a small example it
would be great.

Best regards,
Jean-Claude


2008/1/28, Grzegorz Kossakowski [EMAIL PROTECTED]:

 Jean-Claude Vogel pisze:
  Thank for your reply,
 
  Like you said, I tried to add an upload-max-size init param in the
  Spring configuration of the Cocoon SitemapServlet but I have still the
  same error.
 
  Here is what I wrote :
  bean id=zzz.ma-adminui.block
  class=org.apache.cocoon.sitemap.SitemapServlet
  servlet:context mount-path=/ui
  context-path=blockcontext:/ma-adminui/ 
 
  servlet:init-params
  entry key=upload-max-size value=1000 /
  /servlet:init-params
 
  servlet:connections
  entry key=ajax
  value-ref=org.apache.cocoon.ajax.impl.servlet /
  entry key=forms
  value-ref=org.apache.cocoon.forms.impl.servlet /
  entry key=services value-ref=zzz.ma-service.block/
  /servlet:connections
  /servlet:context
  /bean
 
  Perhaps is my syntax wrong, I am still looking for it on the net.

 Your syntax is right. I have taken a closer look and found that we have
 changed whole mechanism and
 configuration for it.

 Now you need to configure it using properties, the list of them you can
 find there [1]. I hope you
 know how to set them in your block.

 Actually, it's perfect work for some volunteer to add this information to
 documentation, for
 example, as a FAQ entry.

 [1]

 http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartConfigurationHelper.java?view=markup

 --
 Grzegorz Kossakowski
 Committer and PMC Member of Apache Cocoon
 http://reflectingonthevicissitudes.wordpress.com/

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




Re: upload-max-size with no effect

2008-01-28 Thread Joerg Heinicke

On 28.01.2008 05:34, Grzegorz Kossakowski wrote:


Like you said, I tried to add an upload-max-size init param in the
Spring configuration of the Cocoon SitemapServlet but I have still the
same error.

Here is what I wrote :
bean id=zzz.ma-adminui.block
class=org.apache.cocoon.sitemap.SitemapServlet
servlet:context mount-path=/ui
context-path=blockcontext:/ma-adminui/ 

servlet:init-params
entry key=upload-max-size value=1000 /
/servlet:init-params

servlet:connections
entry key=ajax
value-ref=org.apache.cocoon.ajax.impl.servlet /
entry key=forms
value-ref=org.apache.cocoon.forms.impl.servlet /
entry key=services value-ref=zzz.ma-service.block/
/servlet:connections
/servlet:context
/bean

Perhaps is my syntax wrong, I am still looking for it on the net.


Your syntax is right. I have taken a closer look and found that we have changed 
whole mechanism and
configuration for it.

Now you need to configure it using properties, the list of them you can find 
there [1]. I hope you
know how to set them in your block.


Hmm, I might misss something, but what's the point of enforcing 
splitting configuration into different files? I can see the possible 
advantages of the properties, but not of preventing the user from 
explicitly configuring such a property directly on the bean.


Joerg

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



Re: upload-max-size with no effect

2008-01-28 Thread Grzegorz Kossakowski
Jean-Claude Vogel pisze:
 Thank a lot,
 
 I fact I don't know how to set static variables in the spring
 configuration of the block but I will look for it. If you can send a
 small example it would be great.

Jean, you probably have misunderstood what I meant. I didn't mean you need to 
set static variables
as it's quite insane to try to _change_ value of _static_ variable, don't you 
think? ;-)

You should look at the configure() method of MultipartConfigurationHelper 
class. There configuration
is obtained from properties in a way like this:
value = settings.getProperty(KEY_UPLOADS_MAXSIZE);
if (value != null) {
setMaxUploadSize(Integer.valueOf(value).intValue());
}

Where KEY_UPLOADS_MAXSIZE is defined at the top of the class:

String KEY_UPLOADS_MAXSIZE = org.apache.cocoon.uploads.maxsize;

So you just need to set this property. You can do this multiple ways[1]. I 
suggest creating a
uploadsettings.properties file in src/main/resources/META-INF/cocoon/properties 
directory of your block.

[1] 
http://cocoon.apache.org/subprojects/configuration/1.0/spring-configurator/1.0/1310_1_1.html

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

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



Set/Read Response Code?

2008-01-28 Thread Edward S
Hey guys,

Had a question.

I have a reader that reads in a XML containing 'x' URL's. Each URL returns a
PDF and this reader merges the PDF and gives a single PDF as the output.
Now, if something fails, i get a 0 page pdf with an error saying 'Cannot
open the pdf because it has 0 pages'

I have no way to find out, what failed in between (except for checking the
logs)

I want to modify it in such a way, that the reader can tell me which url's
failed.
So, I thot of nesting the sitemaps and writing a transformer that can go
thru each URL first and tell me if it returns a valid pdf or not. However,
for this to work...I need to set the response code in another component to
failure and read that response code here.

Any idea how I can do that?

thanks

Ed.


Re: upload-max-size with no effect

2008-01-28 Thread Jean-Claude Vogel
Yes, it works fine. Thank you and thank to every body who tried to
understand the problem.

I ever not understand why I have to specify these properties, my file to
upload size is less than 1Mb when the default Cocoon max value is 10Mb.
Files to upload with a size less than 100kb have ever been uploaded, only
files bigger than 100kb were not uploaded.

Now I specify 10Mb in a uploadsettings.properties configuration file and
it's ok also for files bigger than 100kb. Strange.

Thank again

PS (for ohter users), my property file in
/META-INF/cocoon/perperties/uploadsettings.properties contains just :
org.apache.cocoon.uploads.maxsize=1000
org.apache.cocoon.uploads.enable=true


2008/1/28, Joerg Heinicke [EMAIL PROTECTED]:

 On 28.01.2008 05:34, Grzegorz Kossakowski wrote:

  Like you said, I tried to add an upload-max-size init param in the
  Spring configuration of the Cocoon SitemapServlet but I have still the
  same error.
 
  Here is what I wrote :
  bean id=zzz.ma-adminui.block
  class=org.apache.cocoon.sitemap.SitemapServlet
  servlet:context mount-path=/ui
  context-path=blockcontext:/ma-adminui/ 
 
  servlet:init-params
  entry key=upload-max-size value=1000 /
  /servlet:init-params
 
  servlet:connections
  entry key=ajax
  value-ref=org.apache.cocoon.ajax.impl.servlet /
  entry key=forms
  value-ref=org.apache.cocoon.forms.impl.servlet /
  entry key=services value-ref=zzz.ma-service.block
 /
  /servlet:connections
  /servlet:context
  /bean
 
  Perhaps is my syntax wrong, I am still looking for it on the net.
 
  Your syntax is right. I have taken a closer look and found that we have
 changed whole mechanism and
  configuration for it.
 
  Now you need to configure it using properties, the list of them you can
 find there [1]. I hope you
  know how to set them in your block.

 Hmm, I might misss something, but what's the point of enforcing
 splitting configuration into different files? I can see the possible
 advantages of the properties, but not of preventing the user from
 explicitly configuring such a property directly on the bean.

 Joerg

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




Re: servlet-mapping in Cocoon 2.2 bean?

2008-01-28 Thread Josh2007

Hi Grzegorz,

I ran my webapp, but the same error occured.
Before going further I need to clarify one point about ServletService.

If I call my servlet this way:
map:generate src=servlet:xquery:/exist-xquery-samples/guess.xql
type=file/

it's the same as making an http request to xquery servlet, where
/exist-xquery-samples/guess.xql is considered as an URI?

Thanks,

Josh



Grzegorz Kossakowski-3 wrote:
 
 Josh2007 pisze:
 Thanks Grzegorz,
 
 No problem.
 
 Servlet implementation and Spring bean registration:
 I've, then, been able to set my XQuery Servlet in a block registered as a
 bean.
 I patched the block web.xml to implement eXist database servlet, and add
 the
 required dependencies in the pom.xml (after installing then in my mvn
 local
 repositery).
 It works. I can now start XQuery block using [mvn jetty:run] and execute
 any
 XQuery file stored in my block under the root webapp and, in the
 meantime,
 access the database.
 
 Servlet Service functionality:
 I tried to access this block from another block (named block test1) by:
 adding the XQuery block (named test2) as a dependency of the block test1,
 in
 test1 pom.xml.
 adding the XQuery block entry in test1 servlet-sevice.xml 
 creating, in test1 block, a sitemap pipeline calling the XQuery servlet:
 
 pipeline :
 map:match pattern=trytest2
   map:generate src=servlet:test2:/header.xml type=file/
   map:serialize type=xml/
 /map:match
 
 note: 
 XQuery block has no use of sitemap.xmap but I kept
 src/main/resources/COB-INF directory.
 I've been succesful accessing another block from test1 block (this block
 was
 based on org.apache.cocoon.sitemap.SitemapServlet)
  
 problem with my XQuery Servlet called from test1 block: 
 I got an error:
 
 
 snip/
 
 servlet:test2:/test2/header.xml_S-xml-;encoding=ISO-8859-1
 2008-01-25 20:27:04,665 btpool0-1 DEBUG util.ConfigurationHelper - Got
 eXist
 home from broker: C:\Users\BMS\Documents\test\test1
 
 \target\rcl\webapp\WEB-INF
 2008-01-25 20:27:04,665 btpool0-1 WARN  http.Descriptor - Giving up
 unable
 to read descriptor file from C:\Users\BMS\Documents\test\test1
 
 \target\rcl\webapp\WEB-INF\descriptor.xml
 2008-01-25 20:27:04,666 btpool0-1 WARN  http.Descriptor - Giving up
 unable
 to read descriptor.xml file from classloader in package 
 
 snip/
 
 The detail worth attention is classloader words here.
 
 It seems it cannot find the file, but if I execute only the XQuery
 Servlet,
 it works.
 Here's my XQuery Servlet bean:
 bean id=com.mycompany.test2.service
 class=org.exist.http.servlets.XQueryServlet
 servlet:context mount-path=/test2
 context-path=blockcontext:/test2//
 /bean
 
 Any idea?
 
 When you run a block using just jetty:run in block's directory the Cocoon
 RCL[1] is run as well. It'
 s purpose is to enable RAD thus it plays with class reloading which may be
 an issue for eXist I
 think. I would suggest to try assembly a WAR archive by using webapp
 archetype[2]. If you run your
 app using:
 cd myCocoonWebapp
 mvn clean jetty:run
 
 it will assemble a WAR package and run it with plain Jetty container. This
 way you will be able to
 find out if it's RCL's fault. Depending on your findings we will try to
 investigate further.
 
 [1]
 http://cocoon.apache.org/2.2/maven-plugins/maven-plugin/1.0/1295_1_1.html
 [2] http://cocoon.apache.org/2.2/1362_1_1.html
 
 -- 
 Grzegorz Kossakowski
 Committer and PMC Member of Apache Cocoon
 http://reflectingonthevicissitudes.wordpress.com/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/servlet-mapping-in-Cocoon-2.2-bean--tp15028682p15145469.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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



Re: servlet-mapping in Cocoon 2.2 bean?

2008-01-28 Thread Grzegorz Kossakowski
Josh2007 pisze:
 Hi Grzegorz,
 
 I ran my webapp, but the same error occured.
 Before going further I need to clarify one point about ServletService.
 
 If I call my servlet this way:
 map:generate src=servlet:xquery:/exist-xquery-samples/guess.xql
 type=file/
 
 it's the same as making an http request to xquery servlet, where
 /exist-xquery-samples/guess.xql is considered as an URI?

Yes, I can confirm your assumption. I hope that you know how to setup Cocoon 
for debugging.

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

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



Is it possible to restrict file uploads to certain URLs?

2008-01-28 Thread Andy Stevens
Hi,

New year, new webmail; hopefully google mangles embedded xml less than
hotmail :-)

I have a new requirement for one of our sites to allow the users to
upload some files.  However, I read in the Cocoon docs/wiki that
switching on the enable-uploads init parameter will make it use the
multipart request factory etc. on all requests it receives.  This
seems to me like a lot of unnecessary work (and either disk IO or heap
churn) when only a couple of pipelines will be processing the uploaded
files.

Since the URLs that will handle the file Part(s) are all in a specific
area of the site (a subdirectory requiring the user to have logged
in), I was wondering whether it was possible to configure Cocoon (with
a regex, say) to only use the multipart parser on a subset of the URL
space.  If not, would this be a considered a generally useful feature
if I can come up with a patch?


Andy.
-- 
http://pseudoq.sourceforge.net/  Open source java Sudoku application

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



Re: Set/Read Response Code?

2008-01-28 Thread solprovider
Can we see the code?
Can you fix the code?

The Reader needs better handling of errors.  Find the code that
translates the URL into a PDF and make Exceptions return a PDF that
reads:
   This is where the PDF from:
   http://example.com/a.pdf
   would have been inserted if the following error had not occurred:
   IOException: Could not connect to example.com.

You could also write to the command line or a log to inform an
administrator, but explaining the error in the text will allow upset
people to provide something more relevant than variations of I
received a blank document.

About catching the error before providing a response, have you tried
the usual method of throwing a Java Exception and catching with
map:handle-errors in the XMAP?  Which version of Cocoon may also be
relevant.

solprovider

On 1/28/08, Edward S [EMAIL PROTECTED] wrote:
 I have a reader that reads in a XML containing 'x' URL's. Each URL returns a
 PDF and this reader merges the PDF and gives a single PDF as the output.
 Now, if something fails, i get a 0 page pdf with an error saying 'Cannot
 open the pdf because it has 0 pages'

 I have no way to find out, what failed in between (except for checking the
 logs)

 I want to modify it in such a way, that the reader can tell me which url's
 failed.
 So, I thot of nesting the sitemaps and writing a transformer that can go
 thru each URL first and tell me if it returns a valid pdf or not. However,
 for this to work...I need to set the response code in another component to
 failure and read that response code here.

 Any idea how I can do that?

 thanks
 Ed.

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