Return-Path: X-Original-To: apmail-wicket-users-archive@minotaur.apache.org Delivered-To: apmail-wicket-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5CFA8105FC for ; Wed, 2 Apr 2014 13:35:40 +0000 (UTC) Received: (qmail 82376 invoked by uid 500); 2 Apr 2014 13:35:36 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 82195 invoked by uid 500); 2 Apr 2014 13:35:34 -0000 Mailing-List: contact users-help@wicket.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@wicket.apache.org Delivered-To: mailing list users@wicket.apache.org Received: (qmail 82060 invoked by uid 99); 2 Apr 2014 13:35:31 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2014 13:35:31 +0000 Received: from localhost (HELO mail-wg0-f46.google.com) (127.0.0.1) (smtp-auth username mgrigorov, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2014 13:35:30 +0000 Received: by mail-wg0-f46.google.com with SMTP id b13so242932wgh.5 for ; Wed, 02 Apr 2014 06:35:29 -0700 (PDT) X-Received: by 10.180.101.166 with SMTP id fh6mr2382265wib.2.1396445729020; Wed, 02 Apr 2014 06:35:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.105.74 with HTTP; Wed, 2 Apr 2014 06:34:48 -0700 (PDT) In-Reply-To: <533C0FD0.60003@efonds.com> References: <533C0FD0.60003@efonds.com> From: Martin Grigorov Date: Wed, 2 Apr 2014 15:34:48 +0200 Message-ID: Subject: Re: Error handling in IResource implementations? To: "users@wicket.apache.org" Content-Type: multipart/alternative; boundary=f46d0418252ea0629d04f60f5b28 --f46d0418252ea0629d04f60f5b28 Content-Type: text/plain; charset=UTF-8 Hi, It is not mandatory to make the second call to the WS in #writeData(). You can make it earlier, as with the metadata. This way you can use response#setError() if needed. Martin Grigorov Wicket Training and Consulting On Wed, Apr 2, 2014 at 3:25 PM, Stefan Renz wrote: > Hi, > > I'm currently at loss: what would be the correct way signalling that a > IResource implementation encountered an error? > > Here's the case: > > I have a custom AbstractResource implementation that grabs an object > from a WebService. Getting information about the object (metadata and > ID) is one call, actually getting the content stream by ID is another. > > In > org.apache.wicket.request.resource.AbstractResource#newResourceResponse > I get the metadata, and set the response properties accordingly (time of > last modification, content type, etc.). > > Then, in the anonymous > > org.apache.wicket.request.resource.AbstractResource.WriteCallback#writeData() > I make the call to retrieve the content. And here's the problem: > > What can I do at this stage to inform the user a problem occured, i.e. > by forwarding to an error page (using IExceptionMapper)? Here, the > metadata is still present (database), whereas the file content > (filesystem) is gone for whatever reason. > > Thanks for your help, > bye > Stefan > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org > For additional commands, e-mail: users-help@wicket.apache.org > > --f46d0418252ea0629d04f60f5b28--