Return-Path: X-Original-To: apmail-click-dev-archive@www.apache.org Delivered-To: apmail-click-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CCDBF7D44 for ; Wed, 7 Dec 2011 17:45:55 +0000 (UTC) Received: (qmail 77978 invoked by uid 500); 7 Dec 2011 17:45:55 -0000 Delivered-To: apmail-click-dev-archive@click.apache.org Received: (qmail 77934 invoked by uid 500); 7 Dec 2011 17:45:55 -0000 Mailing-List: contact dev-help@click.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@click.apache.org Delivered-To: mailing list dev@click.apache.org Delivered-To: moderator for dev@click.apache.org Received: (qmail 80657 invoked by uid 99); 7 Dec 2011 05:44:23 -0000 X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=SPF_NEUTRAL,URI_HEX,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 216.139.236.26 is neither permitted nor denied by domain of rakeshbhalke@gmail.com) Date: Tue, 6 Dec 2011 21:43:57 -0800 (PST) From: rakesh_bhalke To: dev@click.apache.org Message-ID: <1323236637847-7069479.post@n2.nabble.com> Subject: URL Rewirting MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, Click JSImport and CSImport by default appends the context to the js and css files. This causes issues in URL rewirting as follows Lets say i have 1 application to be deployed for 3 customers. Each on these is deployed on seperate tomcat instances. Hence the URL for each application will look like this http://internalip:8080/TestApp/ http://internalip.com:8081/TestApp/ http://internalip.com:8082/TestApp/ Now if my http server is front ending these tomcats then my URL rewrite will be as http://myapp.com/TestApp1/ pointing to http://internalip:8080/TestApp/ http://myapp.com/TestApp2/ pointing to http://internalip:8081/TestApp/ http://myapp.com/TestApp3/ pointing to http://internalip:8082/TestApp/ Now if we see the html generated by click, it is /TestApp1/css/style.css /TestApp1/clickclick/jquery/jquery-1.3.2.js because of which URL rewriting fails. Our analysis is as follows Following code from JsImport which add context path in js file url. public void setSrc(String src) { if (src != null) { if (src.charAt(0) == '/') { Context context = getContext(); String contextPath = context.getRequest().getContextPath(); // Guard against adding duplicate context path if (!src.startsWith(contextPath + '/')) { HtmlStringBuffer buffer = new HtmlStringBuffer(contextPath.length() + src.length()); // Append the context path buffer.append(contextPath); buffer.append(src); src = buffer.toString(); } } } setAttribute("src", src); } Our suggestion is to not append the context and to create a relative path for JS and CSS imports. -- View this message in context: http://click.1134972.n2.nabble.com/URL-Rewirting-tp7069479p7069479.html Sent from the click-development mailing list archive at Nabble.com.