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 D7557E666 for ; Mon, 18 Feb 2013 20:16:32 +0000 (UTC) Received: (qmail 14182 invoked by uid 500); 18 Feb 2013 20:16:31 -0000 Delivered-To: apmail-wicket-users-archive@wicket.apache.org Received: (qmail 14082 invoked by uid 500); 18 Feb 2013 20:16:31 -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 14074 invoked by uid 99); 18 Feb 2013 20:16:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Feb 2013 20:16:31 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [66.111.4.25] (HELO out1-smtp.messagingengine.com) (66.111.4.25) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Feb 2013 20:16:25 +0000 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 7880A20BBC for ; Mon, 18 Feb 2013 15:16:04 -0500 (EST) Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160]) by compute6.internal (MEProxy); Mon, 18 Feb 2013 15:16:04 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:subject:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; s=smtpout; bh=byHIPln1hKvurskbmyy1LL DpgHw=; b=m13OwMVmo7xZryTxHKc2NWeCx2ANNmLo7x0eBhinHP/tBAMVAR5q3C wnLHYn+160BQO60oqwk3USdAm3HphN1etXqbu50qK/iwzGSO13xkII9+BaAwPI68 gYEmA8jGORqqBsuA2kb+xI7ItVIFzsOM9jLasWgt8tvZSN5ODCx5M= X-Sasl-enc: JLPXXzawYpx47em0dEfDaaz/ffg+02F3jzRHtqzvohYb 1361218564 Received: from privatron (unknown [46.244.184.108]) by mail.messagingengine.com (Postfix) with ESMTPA id DFBF98E0166 for ; Mon, 18 Feb 2013 15:16:03 -0500 (EST) Date: Mon, 18 Feb 2013 21:16:01 +0100 From: Carl-Eric Menzel To: users@wicket.apache.org Subject: Re: Migration issue: page that writes binary data to the response Message-ID: <20130218211601.79e05bf9@privatron> In-Reply-To: <20130218180341.GA10179@fh-wedel.de> References: <20130218165537.GA9865@fh-wedel.de> <20130218182511.4afa5f36@robotron> <20130218180341.GA10179@fh-wedel.de> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.13; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Mon, 18 Feb 2013 19:03:41 +0100 Martin Dietze wrote: > On Mon, February 18, 2013, Carl-Eric Menzel wrote: > > > Is there a particular reason you're using a page? > > One - unfortunately - big reason: it's legacy code (most of > which I did not even write myself). The Wicket upgrade is badly > needed for browser compatibiy, however I don't want to change > code if it's not absolutely necessary. For generating binaries, I would *really* recommend doing this change. Pages simply are not a good fit for that. Also, it shouldn't be that big of a change, since you're writing to the Response anyway. Within AbstractResource's WriteCallback you're going to use the same Response object, so you can simply copy most of your code over without much change. (pseudocode from memory, but close enough) MyResource extends AbstractResource { @Override newResourceResponse(Attributes att) { att.setFilename("foo.pdf"); att.disableCaching(); att.setContentType("text/pdf"); att.setWriteCallback(new WriteCallback() { @Override writeData(Attributes att) { Response r = att.getResponse(); // write to the response here like you did before } }); } } Except in this case you won't have to mangle the Response object like you have to do with the page. Carl-Eric --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org For additional commands, e-mail: users-help@wicket.apache.org