You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Oliver Schalch <ol...@wyona.com> on 2006/06/15 10:31:16 UTC

Upload when enable.uploads=false (l.b.p)

Hi List,

At the moment there is *no* message which gives the user a hint why a 
upload didnt happen. If you try uploading an image and enable.upload is 
false it just returns to the screen you was.

2 Suggestion:

--- before a user will try to upload ---
We add a check to all place where its possible to upload files which 
checks the l.b.p (b.p) and add an according message there if 
enable.upload=false

or

--- after a user tried to upload ---
We just check if the upload didnt happen and inform the user about this 
and why it could happen.

I'm not sure if there is a nice way we could check the enable.upload 
paramater in the local.build.properties direct from the usecase. If that 
doesent work in a nice way, we should just check if the file was 
uploaded, if not add a information about the enable.upload.

Other Ideas?


Greets,
Oli




-- 
Oliver Schalch				 oliver.schalch@wyona.com
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com			  http://lenya.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Upload when enable.uploads=false (l.b.p)

Posted by Thorsten Scherler <th...@apache.org>.
El vie, 16-06-2006 a las 13:38 +0200, Josias Thöny escribió:
> On Fri, 2006-06-16 at 12:48 +0200, Thorsten Scherler wrote:
> [...]
> > 
> > It there no way to test in the usecase doCheckPreconditions() whether
> > the upload is enabled? 
> 
> Only the CocoonServlet knows whether uploads are enabled or not. I
> didn't find a way to get this information from a usecase class.
> Either we have to patch cocoon or we have to read the value somehow from
> a configuration file, which the build process would provide. (Or read it
> directly from web.xml). 
> Or do you see any other options?


Yeah, breaking the encapsulation. ;) 

Anyway I reckon the quickest solution is to read out the
build/webapp/WEB-INF/web.xml for the
init-param[param-name='enable-uploads']/param-value/text().

Best practice is to create a helper class that could be easily contacted
via a usecase and that returns whether upload is enabled or not. Every
usecase that needs upload will then contact this helper in the
doCheckPreconditions() and report failure in log and message object.

wdyt?

Oli can you provide a patch for such a helper and its usage in a
usecase?

TIA

salu2

> 
> > Would it not work if we check whether the wrapping is possible or not?
> 
> Same problem, only CocoonServlet knows if the request will be wrapped.
> 
> Maybe we could ask on the cocoon ml.
> 
> Josias
> 
>  
> > 
> > salu2
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Upload when enable.uploads=false (l.b.p)

Posted by Josias Thöny <jo...@wyona.com>.
On Fri, 2006-06-16 at 12:48 +0200, Thorsten Scherler wrote:
[...]
> 
> It there no way to test in the usecase doCheckPreconditions() whether
> the upload is enabled? 

Only the CocoonServlet knows whether uploads are enabled or not. I
didn't find a way to get this information from a usecase class.
Either we have to patch cocoon or we have to read the value somehow from
a configuration file, which the build process would provide. (Or read it
directly from web.xml). 
Or do you see any other options?

> Would it not work if we check whether the wrapping is possible or not?

Same problem, only CocoonServlet knows if the request will be wrapped.

Maybe we could ask on the cocoon ml.

Josias

 
> 
> salu2


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Upload when enable.uploads=false (l.b.p)

Posted by Thorsten Scherler <th...@apache.org>.
see at the bottom.

El vie, 16-06-2006 a las 10:58 +0200, Oliver Schalch escribió:
> Josias Thöny wrote:
> > On Thu, 2006-06-15 at 10:31 +0200, Oliver Schalch wrote:
> >> Hi List,
> >>
> >> At the moment there is *no* message which gives the user a hint why a 
> >> upload didnt happen. If you try uploading an image and enable.upload is 
> >> false it just returns to the screen you was.
> >>
> >> 2 Suggestion:
> >>
> >> --- before a user will try to upload ---
> >> We add a check to all place where its possible to upload files which 
> >> checks the l.b.p (b.p) and add an according message there if 
> >> enable.upload=false
> >>
> >> or
> >>
> >> --- after a user tried to upload ---
> >> We just check if the upload didnt happen and inform the user about this 
> >> and why it could happen.
> >>
> >> I'm not sure if there is a nice way we could check the enable.upload 
> >> paramater in the local.build.properties direct from the usecase. If that 
> >> doesent work in a nice way, we should just check if the file was 
> >> uploaded, if not add a information about the enable.upload.
> > 
> > Unfortunately the usecase cannot check if the upload has worked or not. 
> > The reason is that request-parameters in the body of the request are
> > ignored by Cocoon for multipart/form-data requests (which are used for
> > uploading files) if uploads are disabled. (Technical background see
> > below [*])
> > As a consequence, the continuation-id is lost and the usecase doesn't
> > continue.
> > 
> > First I thought we could put the continuation-id for the upload usecases
> > into the URL (index.html?lenya.continuation=1234).
> > But the submit parameter is lost also, so it doesn't help. The whole
> > usecase-processing doesn't work :(
> 
> Mhh :(
> 
> > 
> > I guess we have to check l.b.p and display a warning on the screen where
> > the user selects the file to upload.
> 
> Yes, I like that idea anyway, in 99% it will fail because of the 
> enable.upload=false in lbp. I will have a look at it, how I could get 
> stuff out the local.b.p inside a usecase.
> 
> > Or we enable file-upload by default.
> 
> Uploading files could be a part of a CMS, so why not. But that its more 
> a workaround to get rid of the discussion above ;). And probably some 
> security reason to not set uploads=true by default.
> 
> Oliver
> 
> 
> > 
> > - Josias
> > 
> > [*]
> > The servlet API provides the method getParameter(String name) to access
> > request parameters, but this method doesn't work for in-body request
> > parameters of multipart/form-data requests.
> > Cocoon (and other web-application frameworks) now wrap the
> > HttpServletRequest into another class (MultipartHttpServletRequest)
> > which allows to access all request parameters.
> > Now if uploads are disabled, this wrapping doesn't happen, therefore the
> > request-parameters in the body are not accessible with the
> > getParameter() method.
> > 

It there no way to test in the usecase doCheckPreconditions() whether
the upload is enabled? 

Would it not work if we check whether the wrapping is possible or not?

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Upload when enable.uploads=false (l.b.p)

Posted by Oliver Schalch <ol...@wyona.com>.
Josias Thöny wrote:
> On Thu, 2006-06-15 at 10:31 +0200, Oliver Schalch wrote:
>> Hi List,
>>
>> At the moment there is *no* message which gives the user a hint why a 
>> upload didnt happen. If you try uploading an image and enable.upload is 
>> false it just returns to the screen you was.
>>
>> 2 Suggestion:
>>
>> --- before a user will try to upload ---
>> We add a check to all place where its possible to upload files which 
>> checks the l.b.p (b.p) and add an according message there if 
>> enable.upload=false
>>
>> or
>>
>> --- after a user tried to upload ---
>> We just check if the upload didnt happen and inform the user about this 
>> and why it could happen.
>>
>> I'm not sure if there is a nice way we could check the enable.upload 
>> paramater in the local.build.properties direct from the usecase. If that 
>> doesent work in a nice way, we should just check if the file was 
>> uploaded, if not add a information about the enable.upload.
> 
> Unfortunately the usecase cannot check if the upload has worked or not. 
> The reason is that request-parameters in the body of the request are
> ignored by Cocoon for multipart/form-data requests (which are used for
> uploading files) if uploads are disabled. (Technical background see
> below [*])
> As a consequence, the continuation-id is lost and the usecase doesn't
> continue.
> 
> First I thought we could put the continuation-id for the upload usecases
> into the URL (index.html?lenya.continuation=1234).
> But the submit parameter is lost also, so it doesn't help. The whole
> usecase-processing doesn't work :(

Mhh :(

> 
> I guess we have to check l.b.p and display a warning on the screen where
> the user selects the file to upload.

Yes, I like that idea anyway, in 99% it will fail because of the 
enable.upload=false in lbp. I will have a look at it, how I could get 
stuff out the local.b.p inside a usecase.

> Or we enable file-upload by default.

Uploading files could be a part of a CMS, so why not. But that its more 
a workaround to get rid of the discussion above ;). And probably some 
security reason to not set uploads=true by default.

Oliver


> 
> - Josias
> 
> [*]
> The servlet API provides the method getParameter(String name) to access
> request parameters, but this method doesn't work for in-body request
> parameters of multipart/form-data requests.
> Cocoon (and other web-application frameworks) now wrap the
> HttpServletRequest into another class (MultipartHttpServletRequest)
> which allows to access all request parameters.
> Now if uploads are disabled, this wrapping doesn't happen, therefore the
> request-parameters in the body are not accessible with the
> getParameter() method.
> 
> 
> 
>> Other Ideas?
>>
>>
>> Greets,
>> Oli
>>
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
> For additional commands, e-mail: dev-help@lenya.apache.org
> 
> 


-- 
Oliver Schalch				 oliver.schalch@wyona.com
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com			  http://lenya.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: Upload when enable.uploads=false (l.b.p)

Posted by Josias Thöny <jo...@wyona.com>.
On Thu, 2006-06-15 at 10:31 +0200, Oliver Schalch wrote:
> Hi List,
> 
> At the moment there is *no* message which gives the user a hint why a 
> upload didnt happen. If you try uploading an image and enable.upload is 
> false it just returns to the screen you was.
> 
> 2 Suggestion:
> 
> --- before a user will try to upload ---
> We add a check to all place where its possible to upload files which 
> checks the l.b.p (b.p) and add an according message there if 
> enable.upload=false
> 
> or
> 
> --- after a user tried to upload ---
> We just check if the upload didnt happen and inform the user about this 
> and why it could happen.
> 
> I'm not sure if there is a nice way we could check the enable.upload 
> paramater in the local.build.properties direct from the usecase. If that 
> doesent work in a nice way, we should just check if the file was 
> uploaded, if not add a information about the enable.upload.

Unfortunately the usecase cannot check if the upload has worked or not. 
The reason is that request-parameters in the body of the request are
ignored by Cocoon for multipart/form-data requests (which are used for
uploading files) if uploads are disabled. (Technical background see
below [*])
As a consequence, the continuation-id is lost and the usecase doesn't
continue.

First I thought we could put the continuation-id for the upload usecases
into the URL (index.html?lenya.continuation=1234).
But the submit parameter is lost also, so it doesn't help. The whole
usecase-processing doesn't work :(

I guess we have to check l.b.p and display a warning on the screen where
the user selects the file to upload.

Or we enable file-upload by default.

- Josias

[*]
The servlet API provides the method getParameter(String name) to access
request parameters, but this method doesn't work for in-body request
parameters of multipart/form-data requests.
Cocoon (and other web-application frameworks) now wrap the
HttpServletRequest into another class (MultipartHttpServletRequest)
which allows to access all request parameters.
Now if uploads are disabled, this wrapping doesn't happen, therefore the
request-parameters in the body are not accessible with the
getParameter() method.



> Other Ideas?
> 
> 
> Greets,
> Oli
> 
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org