Re: Accessing tapestry request params outwith a page
Hi If your utility class is managed by the ioc, which seems unlikely, then you can @Inject request and response into it. regards Taha On Nov 26, 2012, at 9:55 PM, dkeenan wrote: > Hi. I have a utility class that I call from within my application. Is it > possible to access the current request and requests parameters from within > my utility class so I can access form parameter values that were uploaded in > the current request? > > > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-request-params-outwith-a-page-tp5718291.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org >
Re: Accessing tapestry request params outwith a page
In the case of a multipart form submission (one that has a FileUpload component involved), then request parameters are NOT visible inside the HttpServletRequest but ARE visible inside the (Tapestry) Request. On Mon, Nov 26, 2012 at 9:07 AM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Mon, 26 Nov 2012 14:51:50 -0200, dkeenan > wrote: > > ...just out of interest. Am I correct in thinking that form parameters >> for a Tapestry form upload are not stored in the usual HttpServletRequest >> parameters? >> > > No. The Tapestry form field components generate ordinary HTML fields. > > > The reason I ask is that I was originally accessing the >> HttpServletRequest object, to try and get to the form parameter I was >> looking for. From memory, I think that my HttpServletRequst only had a >> parameter called 'f:formdata', rather than each parameter of the form. >> > > Please check again. > > > Does tapestry actually put submitted form fields into a single >> HttpServletReqeust parameter when a form is submitted? >> > > No. Request is just a thin layer separating most code from using the > HttpServletRequest directly. > > > -- > Thiago H. de Paula Figueiredo > > --**--**- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com
Re: Accessing tapestry request params outwith a page
I'm taking an educated guess here and guessing that you're trying to implement your file upload progress bar mentioned here http://tapestry.1045711.n5.nabble.com/Adding-a-progress-listener-to-UploadedFile-td5718197.html To implement this you will do two things: 1. Upload a file 2. Send regular ajax requests to get the percentage complete of the file upload. So, you must keep in mind that 1 and 2 are separate requests on separate threads so you will not share any request state or thread state between the two. Instead, you will probably update a session attribute in the file upload which can be polled by the ajax requests. Cheers, Lance. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-request-params-outwith-a-page-tp5718291p5718305.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing tapestry request params outwith a page
On Mon, 26 Nov 2012 14:51:50 -0200, dkeenan wrote: ...just out of interest. Am I correct in thinking that form parameters for a Tapestry form upload are not stored in the usual HttpServletRequest parameters? No. The Tapestry form field components generate ordinary HTML fields. The reason I ask is that I was originally accessing the HttpServletRequest object, to try and get to the form parameter I was looking for. From memory, I think that my HttpServletRequst only had a parameter called 'f:formdata', rather than each parameter of the form. Please check again. Does tapestry actually put submitted form fields into a single HttpServletReqeust parameter when a form is submitted? No. Request is just a thin layer separating most code from using the HttpServletRequest directly. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing tapestry request params outwith a page
On Mon, 26 Nov 2012 14:46:16 -0200, dkeenan wrote: Nice. I was thinking I could only inject a request into a page class. So I can inject the request anywhere in the application? Great. Thanks. Yes. It is a normal per-thread Tapestry-IoC service. Of course, this will only work on threads that are requests. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing tapestry request params outwith a page
...just out of interest. Am I correct in thinking that form parameters for a Tapestry form upload are not stored in the usual HttpServletRequest parameters? The reason I ask is that I was originally accessing the HttpServletRequest object, to try and get to the form parameter I was looking for. From memory, I think that my HttpServletRequst only had a parameter called 'f:formdata', rather than each parameter of the form. Does tapestry actually put submitted form fields into a single HttpServletReqeust parameter when a form is submitted? If so, is this why we inject a tapestry Request class to get access to the form parameters, rather than accessing them from the original HttpServletRequest (as they would actually be bundled within one parameter at that stage)? Not sure if I'm way off the mark with my thinking there ^^^ -- View this message in context: http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-request-params-outwith-a-page-tp5718291p5718294.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing tapestry request params outwith a page
Nice. I was thinking I could only inject a request into a page class. So I can inject the request anywhere in the application? Great. Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-request-params-outwith-a-page-tp5718291p5718293.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing tapestry request params outwith a page
On Mon, 26 Nov 2012 14:25:50 -0200, dkeenan wrote: Hi. I have a utility class that I call from within my application. Is it possible to access the current request and requests parameters from within my utility class so I can access form parameter values that were uploaded in the current request? Just inject the Request service. -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org