Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 305B57ECB for ; Mon, 12 Sep 2011 15:38:21 +0000 (UTC) Received: (qmail 86838 invoked by uid 500); 12 Sep 2011 15:38:20 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 86736 invoked by uid 500); 12 Sep 2011 15:38:15 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 86707 invoked by uid 99); 12 Sep 2011 15:38:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Sep 2011 15:38:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Sep 2011 15:38:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D14912388A3F; Mon, 12 Sep 2011 15:37:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1169802 - /sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java Date: Mon, 12 Sep 2011 15:37:48 -0000 To: commits@sling.apache.org From: justin@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110912153748.D14912388A3F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: justin Date: Mon Sep 12 15:37:48 2011 New Revision: 1169802 URL: http://svn.apache.org/viewvc?rev=1169802&view=rev Log: SLING-2218 - invalidating tag files on modification; thanks to Julian Sedding for the patch! Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java?rev=1169802&r1=1169801&r2=1169802&view=diff ============================================================================== --- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java (original) +++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java Mon Sep 12 15:37:48 2011 @@ -69,6 +69,11 @@ public final class JspRuntimeContext { // Logger private Log log = LogFactory.getLog(JspRuntimeContext.class); + /** + * Prefixes, in which repository paths and script paths can differ. + */ + private static final String[] PATH_PREFIXES = {"", "/WEB-INF/tags"}; + /* * Counts how many times the webapp's JSPs have been reloaded. */ @@ -279,17 +284,19 @@ public final class JspRuntimeContext { } private void invalidate(final JspServletWrapper jsw) { + log.debug("Invalidating script " + jsw.getJspUri()); jsw.clearLastModificationTest(); } - public void handleModification(final String scriptName) { + public void handleModification(final String repositoryPath) { + final String scriptName = getScriptPath(repositoryPath); synchronized ( this ) { // first check if jsps contains this JspServletWrapper wrapper = jsps.get(scriptName); if ( wrapper != null ) { invalidate(wrapper); } - if ( wrapper == null ) { + if (wrapperIsValid(wrapper)) { synchronized ( depToJsp ) { final Set deps = depToJsp.get(scriptName); if ( deps != null ) { @@ -305,6 +312,20 @@ public final class JspRuntimeContext { } } + private String getScriptPath(String repositoryPath) { + for (final String prefix : PATH_PREFIXES) { + final String path = prefix + repositoryPath; + if (depToJsp.containsKey(path)) { + return path; + } + } + return repositoryPath; + } + + private boolean wrapperIsValid(JspServletWrapper wrapper) { + return wrapper == null || wrapper.getLastModificationTest() == -1; + } + /** * Add a new JspServletWrapper. * @@ -313,6 +334,7 @@ public final class JspRuntimeContext { */ public void addWrapper(String jspUri, JspServletWrapper jsw) { jsps.put(jspUri, jsw); + addJspDependencies(jsw); } /**