Return-Path: Delivered-To: apmail-incubator-click-dev-archive@minotaur.apache.org Received: (qmail 48512 invoked from network); 16 Jul 2009 17:07:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Jul 2009 17:07:53 -0000 Received: (qmail 11054 invoked by uid 500); 16 Jul 2009 17:08:58 -0000 Delivered-To: apmail-incubator-click-dev-archive@incubator.apache.org Received: (qmail 11039 invoked by uid 500); 16 Jul 2009 17:08:58 -0000 Mailing-List: contact click-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: click-dev@incubator.apache.org Delivered-To: mailing list click-dev@incubator.apache.org Received: (qmail 11031 invoked by uid 99); 16 Jul 2009 17:08:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 17:08:58 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.186.19.63] (HELO mail16.bluewin.ch) (195.186.19.63) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2009 17:08:49 +0000 Received: from [195.186.18.195] ([195.186.18.195:21586] helo=ps7zhb.bluewin.ch) by mail16.bluewin.ch (envelope-from ) (ecelerity 2.2.2.41 r(31179/31189)) with ESMTP id A2/4D-32648-A8E5F5A4; Thu, 16 Jul 2009 17:08:26 +0000 Received: from ps7zhb (localhost [127.0.0.1]) by ps7zhb.bluewin.ch (Postfix) with ESMTP id 525BEF47 for ; Thu, 16 Jul 2009 17:08:27 +0000 (GMT) Received: from (127.0.0.1) by ps7zhb.bluewin.ch; Thu, 16 Jul 2009 17:08:27 +0000 Message-ID: <19182457.158231247764107333.JavaMail.webmail@ps7zhb.bluewin.ch> Date: Thu, 16 Jul 2009 17:08:27 +0000 (GMT) From: "jozsef.gabor@bluewin.ch" Reply-To: jozsef.gabor@bluewin.ch To: Subject: AW: [jira] Created: (CLK-568) Add ability to use templates with custom extensions In-Reply-To: <1957600703.1247761874980.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain;charset="UTF-8" Content-Transfer-Encoding: 7bit References: <1957600703.1247761874980.JavaMail.jira@brutus> X-FXIT-IP: 212.25.31.150 X-Bluewin-ln: de X-Virus-Checked: Checked by ClamAV on apache.org Hello. This is my favorite issue. Currently I use a small hack in order to generate stylesheet from velocity template. Example: http://212.25.31.150/shop2/style.css First I tell the ClickServlet to trigger for special extensions in the deployment descriptor. (web.xml). SpringClickServlet *.htm /robots.txt /style.css Small modification of performRender method in the ClickServlet is necessary. It is not perfect solution because it prevents using jsp pages. (IMHO jsp is a nightmare) /** * Performs rendering of the specified page. * * @param page page to render * @param context the request context * @throws java.lang.Exception if error occurs */ protected void performRender(Page page, Context context) throws Exception { final HttpServletRequest request = context.getRequest(); final HttpServletResponse response = context.getResponse(); if (StringUtils.isNotBlank(page.getRedirect())) { String url = page.getRedirect(); url = response.encodeRedirectURL(url); if (logger.isTraceEnabled()) { logger.debug(" redirect: " + url); } else if (logger.isDebugEnabled()) { logger.debug("redirect: " + url); } response.sendRedirect(url); } else if (StringUtils.isNotBlank(page.getForward())) { // Indicates the request is forwarded request.setAttribute(CLICK_FORWARD, CLICK_FORWARD); if (logger.isTraceEnabled()) { logger.debug(" forward: " + page.getForward()); } else if (logger.isDebugEnabled()) { logger.debug("forward: " + page.getForward()); } if (page.getForward().endsWith(".jsp")) { renderJSP(page); } else { RequestDispatcher dispatcher = request.getRequestDispatcher(page.getForward()); dispatcher.forward(request, response); } } else if (page.getPath() != null) { // MODIFICATION JGA --------------------- /* String pagePath = page.getPath(); // Check if request is a JSP page if (pagePath.endsWith(".jsp") || configService.isJspPage(pagePath)) { // CLK-141. Set pagePath as the forward value. page.setForward(StringUtils.replace(pagePath, ".htm", ".jsp")); // Indicates the request is forwarded request.setAttribute(CLICK_FORWARD, CLICK_FORWARD); renderJSP(page); } else { renderTemplate(page); } */ renderTemplate(page); // MODIFICATION JGA --------------------- } else { if (logger.isTraceEnabled()) { logger.debug(" path not defined for " + page.getClass().getName()); } else if (logger.isDebugEnabled()) { logger.debug("path not defined for " + page.getClass().getName()); } } }