Writing directly to the HTTP Response object?
I have a non-Wicket AJAX request call a Wicket page to process some data (it's that jQuery file uploader I was working on). Now, the PHP example that came with that jQuery based file uploader writes out some status information to the AJAX JS script via HTTP Response like this (I'm no PHP coder): { echo {; Echo error: ': . $error . ',\n; Echo msg: ' . $msg . '\n; Echo } That's the message that the JS will use to show the status. Now, since I'm in Wicket, not in PHP I will need to bounce back something similar. I was hoping that I could just call: getRequest().write(); However, it's not showing up. What is the recommended way of writing directly to the response object (for this, or RSS feeds, etc..). Do I have to create a fake txt/xml page that I'm bouncing back, or can I just write plain text back via the HTTP Response object? Any help would be appreciated. Best, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Writing directly to the HTTP Response object?
wicket is probably buffering the response, so you should try ((webresponse)getresponse).gethttpservletresponse().getoutputstream().write -igor On Fri, Mar 28, 2008 at 2:16 PM, Michael Mehrle [EMAIL PROTECTED] wrote: I have a non-Wicket AJAX request call a Wicket page to process some data (it's that jQuery file uploader I was working on). Now, the PHP example that came with that jQuery based file uploader writes out some status information to the AJAX JS script via HTTP Response like this (I'm no PHP coder): { echo {; Echo error: ': . $error . ',\n; Echo msg: ' . $msg . '\n; Echo } That's the message that the JS will use to show the status. Now, since I'm in Wicket, not in PHP I will need to bounce back something similar. I was hoping that I could just call: getRequest().write(); However, it's not showing up. What is the recommended way of writing directly to the response object (for this, or RSS feeds, etc..). Do I have to create a fake txt/xml page that I'm bouncing back, or can I just write plain text back via the HTTP Response object? Any help would be appreciated. Best, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Writing directly to the HTTP Response object?
Yeah, we actually talked about exactly that a few minutes ago. We suspected that it writes it to the object but is not actually streaming it out. I tried your code below and my text shows up when I call the page directly. So, it must be that [fill in explicit of your choice] JavaScript... oh joy. Thanks for your input - enjoy your weekend. Michael -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2008 2:44 PM To: users@wicket.apache.org Subject: Re: Writing directly to the HTTP Response object? wicket is probably buffering the response, so you should try ((webresponse)getresponse).gethttpservletresponse().getoutputstream().wr ite -igor On Fri, Mar 28, 2008 at 2:16 PM, Michael Mehrle [EMAIL PROTECTED] wrote: I have a non-Wicket AJAX request call a Wicket page to process some data (it's that jQuery file uploader I was working on). Now, the PHP example that came with that jQuery based file uploader writes out some status information to the AJAX JS script via HTTP Response like this (I'm no PHP coder): { echo {; Echo error: ': . $error . ',\n; Echo msg: ' . $msg . '\n; Echo } That's the message that the JS will use to show the status. Now, since I'm in Wicket, not in PHP I will need to bounce back something similar. I was hoping that I could just call: getRequest().write(); However, it's not showing up. What is the recommended way of writing directly to the response object (for this, or RSS feeds, etc..). Do I have to create a fake txt/xml page that I'm bouncing back, or can I just write plain text back via the HTTP Response object? Any help would be appreciated. Best, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Writing directly to the HTTP Response object?
Actually, your line throws IllegalStateException: STREAM I tried this, which seems to work as well and doesn't throw that exception: RequestCycle.get().setRequestTarget(new IRequestTarget() { public void respond(RequestCycle requestCycle) { Response rep = requestCycle.getResponse(); Rep.write(foo); } }); -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2008 2:44 PM To: users@wicket.apache.org Subject: Re: Writing directly to the HTTP Response object? wicket is probably buffering the response, so you should try ((webresponse)getresponse).gethttpservletresponse().getoutputstream().wr ite -igor On Fri, Mar 28, 2008 at 2:16 PM, Michael Mehrle [EMAIL PROTECTED] wrote: I have a non-Wicket AJAX request call a Wicket page to process some data (it's that jQuery file uploader I was working on). Now, the PHP example that came with that jQuery based file uploader writes out some status information to the AJAX JS script via HTTP Response like this (I'm no PHP coder): { echo {; Echo error: ': . $error . ',\n; Echo msg: ' . $msg . '\n; Echo } That's the message that the JS will use to show the status. Now, since I'm in Wicket, not in PHP I will need to bounce back something similar. I was hoping that I could just call: getRequest().write(); However, it's not showing up. What is the recommended way of writing directly to the response object (for this, or RSS feeds, etc..). Do I have to create a fake txt/xml page that I'm bouncing back, or can I just write plain text back via the HTTP Response object? Any help would be appreciated. Best, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]