Hi,

It is OK.
You can also do: throw new RestartResponseException(...)

Martin Grigorov
Wicket Training and Consulting


On Tue, Apr 22, 2014 at 11:51 AM, <[email protected]> wrote:

> I resolved it with this line:
>
> getRequestCycle().replaceAllRequestHandlers(new
> RenderPageRequestHandler(new PageProvider(new
> InternalError(e.getMessage()))));
>
> is this a good way?
>
>
> Mit freundlichen Grüßen
> Christoph Manig
>
> -----Ursprüngliche Nachricht-----
> Von: Manig, Christoph
> Gesendet: Dienstag, 22. April 2014 10:43
> An: [email protected]
> Betreff: AjaxDownload setResponsePage
>
> Hello,
>
> Iam using AJAXDownload to download some data which will created on the
> fly, while clicking an AjaxButton. Moreover Iam using an
> AbstractResourceStream. In its getInputStream method, I get an byte array.
> This method can throw some exception, which I will catch. If an exception
> is thrown, I want to redirect to an errorpage. It is shown in the code
> below. Nothing happens when the exception is thrown. Can somebody help me
> please?
>
> download = new AJAXDownload() {
>                 @Override
>                 protected IResourceStream getResourceStream() {
>                     return new AbstractResourceStream() {
>                         InputStream data;
>                         @Override
>                         public InputStream getInputStream(){
>                             try {
>                                 data = new
> ByteArrayInputStream(ConsoleDataHandlerImpl.getInstance().getReportAsByteStream(slaReportModel.getTxtDatumVon(),slaReportModel.getTxtDatumBis()));
>                             } catch (Exception e) {
>                                 log.error(ExceptionUtils.getStackTrace(e));
>                                 setResponsePage(new
> InternalError(e.getMessage()));
>                             }
>                             return data;
>                         }
>
>                         @Override
>                         public void close() throws IOException {
>                             data.close();
>                         }
>                     };
>                 }
>
>                 @Override
>                 protected String getFileName(){
>                     return filename;
>                 }
>  };
>             this.add(download);
>             download.initiate(target);
>
>
> Mit freundlichen Grüßen
> Christoph Manig
> Systems Engineer
>
> T-Systems International GmbH
> Systems Integration - SC Travel, Transport & Logistics Hoyerswerdaer Str.
> 18
> 01099 Dresden
> tel.:   +49 (0) 351 / 8152 - 188
> fax:    +49 (0) 351 / 8152 - 209
> email:  [email protected]
>
> T-SYSTEMS INTERNATIONAL GMBH
> Aufsichtsrat: Thomas Dannenfeldt (Vorsitzender)
> Geschäftsführung: Reinhard Clemens (Vorsitzender), Dr. Ferri Abolhassan,
> Thilo Kusch, Dr. Markus Müller, Georg Pepping, Hagen Rickmann
> Handelsregister: Amtsgericht Frankfurt am Main HRB 55933 Sitz der
> Gesellschaft: Frankfurt am Main WEEE-Reg.-Nr. DE50335567
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to