On Wed, Nov 16, 2011 at 2:57 PM, Alberto Brosich <abros...@ogs.trieste.it> wrote: > On 11/16/2011 11:10 AM, Martin Grigorov wrote: >> >> On Wed, Nov 16, 2011 at 12:02 PM, Sven Meier<s...@meiers.net> wrote: >>> >>> Hi, >>> >>> just create you own IRequestHandler. >> >> No need to create, there are default ones: TextRequestHandler (for >> success) and ErrorCodeRequestHandler (for failure) > > Ok, it's working. I use the following statement: > onSubmit() > > ... > this.getRequestCycle().scheduleRequestHandlerAfterCurrent(new > TextRequestHandler(contentType, "utf-8", result)); > ... > ) > > But is there a way to control the http header (for content location, for > example)? When the result is a csv file the browser uses a weird filename to > write to.
Use another IRequestHandler implementation. Like org.apache.wicket.request.handler.resource.ResourceRequestHandler, just wrap your response in IResource. > > >>> Instead of interrupting request processing with an exception, just >>> schedule it with RequestCycle#scheduleRequestHandlerAfterCurrent() in your >>> form's submit method. >>> >>> Sven >>> >>> -----Ursprüngliche Nachricht----- >>> Von: Alberto Brosich [mailto:abros...@ogs.trieste.it] >>> Gesendet: Mittwoch, 16. November 2011 10:51 >>> An: users@wicket.apache.org >>> Betreff: Re: Call an external url setting method and header >>> >>> On 11/16/2011 08:16 AM, Martin Grigorov wrote: >>>> >>>> Hi, >>>> >>>> On Tue, Nov 15, 2011 at 8:45 PM, Alberto<abros...@ogs.trieste.it> >>>> wrote: >>>>> >>>>> Hi, >>>>> I have to call an external url (a rest web service) from onSubmit of >>>>> a >>>>> form. >>>>> I found this solution: >>>>> >>>>> |throw new RedirectToUrlException( >>>>> "http://www.facebook.com/login.php?api_key="+ _apiKey + "&v=1.0", >>>>> HttpServletResponse.SC_MOVED_PERMANENTLY); >>>>> >>>>> >>>>> but it is just a redirect and I cannot post form data and set the >>>>> accept header. The web service return different type of data (csv, xml, >>>>> html, json) depending on the accept header. >>>>> >>>>> How can I handle that? >>>> >>>> Use Apache HttpClient or pure UrlConnection instead. >>> >>> Yes, I'm using Jersey client for that. But how can I send the output I >>> read from web service to the browser. SetResponsePage() accept only a >>> Page class parameter. Sorry if it is a silly question but I'm new to >>> Wicket. I'm googling since 2 days without success. >>> >>>>> Best regards >>>>> >>>>> Alberto >>>>> | >>>>> >>>>> >>>>> >>>> >>> >>> -- >>> Alberto Brosich >>> >>> Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS >>> Dipartimento di Oceanografia - OGA >>> National Oceanographic Data Centre/IOC - NODC >>> Borgo Grotta Gigante 42/c, 34010 Sgonico, Trieste (ITALY) >>> Phone: +39 040 2140281 >>> E-mail:abros...@ogs.trieste.it >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >> >> > > > -- > Alberto Brosich > > Istituto Nazionale di Oceanografia e di Geofisica Sperimentale - OGS > Dipartimento di Oceanografia - OGA > National Oceanographic Data Centre/IOC - NODC > Borgo Grotta Gigante 42/c, 34010 Sgonico, Trieste (ITALY) > Phone: +39 040 2140281 > E-mail:abros...@ogs.trieste.it > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org