Return-Path: X-Original-To: apmail-tiles-dev-archive@minotaur.apache.org Delivered-To: apmail-tiles-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E2F1698BE for ; Tue, 25 Oct 2011 19:29:38 +0000 (UTC) Received: (qmail 81591 invoked by uid 500); 25 Oct 2011 19:29:38 -0000 Delivered-To: apmail-tiles-dev-archive@tiles.apache.org Received: (qmail 81549 invoked by uid 500); 25 Oct 2011 19:29:38 -0000 Mailing-List: contact dev-help@tiles.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tiles.apache.org Delivered-To: mailing list dev@tiles.apache.org Received: (qmail 81537 invoked by uid 99); 25 Oct 2011 19:29:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 19:29:38 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of antonio.petrelli@gmail.com designates 209.85.216.173 as permitted sender) Received: from [209.85.216.173] (HELO mail-qy0-f173.google.com) (209.85.216.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2011 19:29:33 +0000 Received: by qyk10 with SMTP id 10so4297872qyk.11 for ; Tue, 25 Oct 2011 12:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=xdnkdkoFeGDJjO84si4anrNVIF3AXKlDfQ7IaNfDsdQ=; b=Rk0BXc9xjKDrO4IYm1xmu2ppfo4sQKMuDYVSCvikNYEdOuZRJ6g2bjIKW4sqhCHnQE miPwVCAdTc3rScRD6Qh8AUTvc6hH/QaMPcLl6miFlsLx8lsYwmBTHRYeuMZa4Zx58oMI XkHdIN7bklp2afprXVki++KLtku+6HTlplHHY= MIME-Version: 1.0 Received: by 10.229.28.198 with SMTP id n6mr1382302qcc.144.1319570952069; Tue, 25 Oct 2011 12:29:12 -0700 (PDT) Received: by 10.229.227.17 with HTTP; Tue, 25 Oct 2011 12:29:11 -0700 (PDT) In-Reply-To: <4EA70A2C.1070402@nlebas.net> References: <4EA5DEE0.5020501@nlebas.net> <4EA70A2C.1070402@nlebas.net> Date: Tue, 25 Oct 2011 21:29:11 +0200 Message-ID: Subject: Re: Tiles Request API From: Antonio Petrelli To: dev@tiles.apache.org Content-Type: multipart/alternative; boundary=001636834050daa43d04b0248d04 --001636834050daa43d04b0248d04 Content-Type: text/plain; charset=ISO-8859-1 2011/10/25 Nicolas LE BAS > On 11-10-25 03:51 AM, Antonio Petrelli wrote: > >> 2011/10/24 Nicolas LE BAS >> >>> * getApplicationContext is only used as way to access the Application >>> scope. I'm afraid there may be two solutions to a single purpose here. I >>> understand why Renderers need to know the ApplicationContext, but perhaps >>> it >>> should be provided to them as separate object during initialization, and >>> the >>> application scope should be accessible only through the Request interface >>> to >>> avoid confusion. >>> >>> >> So you want to remove ApplicationContext.**getApplicationScope()? If yes >> notice that this way, all the objects that need a connection to the >> application scope won't be able to do it at startup-time, because they >> need >> a request. Sincerely I am -1 for it. >> >> > Actually, no, the way I said it is confusing. I want to remove > getApplicationContext from Request, and have the renderers that need it > implement ApplicationContextAware instead. > > The application scope can be accessed through getContext(APPLICATION_SCOPE) > instead of getApplicationContext().**getApplicationScope(). > > ApplicationContext itself is fine by me. Mmm... no, getApplicationContext is useful at least to retrieve resources from a request. Nevertheless even if you just want a common abstraction to javax.servlet and > javax.portlet, both "include" and "dispatch" belong to ApplicationContext. > Just like getRequestDispatcher belongs to SerlvetContext and PortletContext, > not their Request counterparts. > > Those 2 methods are for deciding who should deal with the request. It's not > the guy who submits the Request object who should decide that, nor the > Renderer. It belongs elsewhere, both JavaEE and in tiles. The API should > reflect that fact, and that would actually make it more simple to use and to > implement. Not entirely true. It is true that the request dispatcher belongs to the application context, however the fact that a dispatch transforms into an include is decided at request level (through isResponseCommitted and a special attribute in request scope). This is useful to allow calling to "dispatch" even if it is not possible. Since Tiles is a composition framework, it is a pretty frequent need. The response headers are missing, too (except for ContentType), and that's >>> a good thing, too. They're a concern of the controller, not the renderer, >>> and because they're not there, the API helps to avoid mistakes. >>> >> >> Well, no. The Request.getHeader* methods return a map that can write to >> response headers. See this class (setValue method): >> http://svn.eu.apache.org/**repos/asf/tiles/framework/** >> trunk/tiles-request/tiles-**request-servlet/src/main/java/** >> org/apache/tiles/request/**servlet/extractor/**HeaderExtractor.java >> > > I admit that I totally missed that part. It's far from obvious: the javadoc > says: "Return an immutable Map that maps header names to the set of all > values specified in the request". > It feels weird, too, because that's a Map you can write to, but never read > the data back again. That's what the servlet API does, but that's not what > people expect of a Map. As a user, I'd rather have separate maps for request > headers and response headers. > The reasoning that I made is: request headers: read but never written; response headers: written but never read. Therefore the read and write operations are orthogonal and can be (probably confusingly) combined. Probably a Map is not the right interface, probably a specific clearer interface should be better. Thanks Antonio --001636834050daa43d04b0248d04--