cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Wilder-Smith <ch...@wilder-smith.org>
Subject Re: Multipart form upload
Date Fri, 06 Feb 2004 00:23:32 GMT
Geoff,


On Thu, 2004-02-05 at 17:23, Geoff Howard wrote:
> Chris Wilder-Smith wrote:
> > Sorry,
> > 
> > Cocoon 2.1.3
> > 
> > and this wiki page...
> > 
> > http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadsWithFlow
> 
> 1) request-factory should be ignored in 2.1, but get rid of it in case 
> it was left in for compatibility and is screwing you up.  The fact that 
> you have it in implies that you are basing your understanding off a mix 
> of 2.0 and 2.1 documents.  Make sure you read the note at the top of 
> http://wiki.cocoondev.org/Wiki.jsp?page=FileUploadsWithCocoon, ignore 
> the rest of that page and follow the link to the 2.1 specific info.

I actually tried the factory stuff after not getting anywhere the first
few times - in hopes it would help.  I have been working off the 2.1
wiki pages.

> 2) Did you change web.xml in the src/webapps directory (wrong) or the 
> build/webapps directory (right) or some other deployed directory 
> (right)?  There is also a build property in build.properties to set this 
> automatically.  You can run just the config changes by changing that 
> setting (via local.build.properties - see INSTALL.txt) and just running 
> build custom-conf.  See 
> http://wiki.cocoondev.org/Wiki.jsp?page=CustomConfigTarget.

We actually deploy a bit differently, via maven - but the correct
web.xml is getting deployed.

> 3) Did you restart the servlet container after editing web.xml?
Yes.

> 4) Did you say you were getting a HttpRequest?  That brings up a change 
> to the Request stored in the objectModel which may make that code on the 
> wiki no longer work as written.  Try this:
> 
> Request request = ObjectModelHelper.getRequest(obj);
> Object o = request.get("blah");
> if (o == null) {
>    // parameter missing from request
> } else if (o instanceof Part) {
>    Part part = (Part) o;
>    // do something with it
> } else if (o instanceof String) {
>    // upload is disabled - I think.
> }

this is basically what I'm doing.  When I print out something like this:

System.err.println("  ** request class: " + 
     "request.getClass().getName());

I get

 ** request class: org.apache.cocoon.environment.http.HttpRequest



I'm assuming that request.get(str) is functionally different from
request.getAttribute(str) - is there an equivalent to
request.getAtrributeNames() - I would like to verify that I'm not just
doing something stupid, like using the wrong key on the 'get'. I'll go
dig through the source.

Thanks for all your help!

Chris

> 
> Geoff
> 
> > On Thu, 2004-02-05 at 16:35, Geoff Howard wrote:
> > 
> >>Chris Wilder-Smith wrote:
> >>
> >>>Hi,
> >>>
> >>>We're trying to use a multipart/form-data post to upload audio files
> >>>recorded on the client machine to our cocoon-based backend. All of the
> >>>web.xml file upload params seem to be set correctly:
> >>>
> >>>request-factory=org.apache.cocoon.components.request.MultipartRequestFactoryImpl
> >>>enable-uploads=true
> >>>upload-directory=WEB-INF/work/upload-dir
> >>>autosave-uploads=true
> >>>overwrite-uploads=rename
> >>>upload-max-size=10000000
> >>>
> >>>
> >>>According to the wiki pages, I should see the request type as
> >>>MultipartHttpServletRequest when it comes through, but it is a regular
> >>>cocoon HttpRequest.  According to the example, this implies that uploads
> >>>still aren't enabled.
> >>>
> >>>I do see other parameters that come through on the request, it's picking
> >>>up the correct generator, etc.
> >>
> >>Which Cocoon version, which wiki page?
> >>
> >>Geoff
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


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


Mime
View raw message