Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5C446200B63 for ; Mon, 15 Aug 2016 23:27:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5AD96160AA7; Mon, 15 Aug 2016 21:27:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A242A160A8A for ; Mon, 15 Aug 2016 23:27:17 +0200 (CEST) Received: (qmail 92652 invoked by uid 500); 15 Aug 2016 21:27:16 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 92641 invoked by uid 99); 15 Aug 2016 21:27:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2016 21:27:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B9EC1185F5E for ; Mon, 15 Aug 2016 21:27:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.713 X-Spam-Level: X-Spam-Status: No, score=0.713 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, NO_RDNS_DOTCOM_HELO=0.433, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id DtZ4KPC2uyGI for ; Mon, 15 Aug 2016 21:27:13 +0000 (UTC) Received: from vms173007pub.verizon.net (vms173007pub.verizon.net [206.46.173.7]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 82B4C5FC1A for ; Mon, 15 Aug 2016 21:27:11 +0000 (UTC) Received: from vz-proxy-m005.mx.aol.com ([64.236.83.15]) by vms173007.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0OBY000MJZKHYP50@vms173007.mailsrvcs.net> for users@tomcat.apache.org; Mon, 15 Aug 2016 16:26:46 -0500 (CDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Nc0brD34 c=1 sm=1 tr=0 a=NimJJ1rWho3RDXpqkQh0Zg==:117 a=IkcTkHD0fZMA:10 a=7z1cN_iqozsA:10 a=j4nzMFrpAAAA:8 a=QfKxxUxMAAAA:8 a=OFRpyE9r4BtbX0Azq6gA:9 a=QEXdDO2ut3YA:10 Received: by 71.127.40.115 with SMTP id 2f8e7a00; Mon, 15 Aug 2016 21:26:46 GMT Subject: Re: Any way to configure a javascript/html war with deployment-time properties? To: Tomcat Users List References: From: Christopher Schultz Message-id: <21d09755-84ac-a450-375a-f710709a7961@christopherschultz.net> Date: Mon, 15 Aug 2016 17:26:41 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit archived-at: Mon, 15 Aug 2016 21:27:18 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 David, On 8/15/16 3:39 PM, KARR, DAVID wrote: > I'm using TomEE, but I think this question is Tomcat-specific, if > there's any solution at all. > > I have a WAR that is a "pure" webapp, with only javascript, css, > and html. The javascript connects to a REST service at a defined > host:port. The host:port is currently hardcoded in a javascript > variable. > > I really need to be able to configure this host:port at deployment > time. I know how to do this sort of thing with Java apps, but I'm > at a loss to see how to do this conveniently for a non-Java war. > > How can I rearrange this solution so that I can change the > host:port the WAR uses at deployment time? If your content is non-dynamic, then it's .. non-dynamic. There is no problem returning a dynamically-built javascript source file if you'd like. You have a lot of choices for how to dynamically-build a source file like that, but if you were to use JSP, it could look something like this : // This is my "pure" webapp, with only javascript, css, and html var serviceBaseURL = '<%= request.getServletContext().getAttribute("baseURL") %>'; // Here is the rest of your application. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJXsjORAAoJEBzwKT+lPKRYr+YQAJ176abKGbiOxE1PSoXBzZ1B dMELhokb9/nIsS4h9JkJ4MU+paQit/Hl4vjWYqLL9wyP7zzr3qM40gWlTLT5VnyB afpt+q3IjJihgsAzMrCe+2SHBr6kSVctwFtiUu0mHFlgpO1j/HtZ/Eu96+0IRZln Deqn2Ci29P2S10cwTAWNE+vByE+YJiG857pwJ+M25HXoHXheJumqE0SqK2pqVCcT DkoB86qTEe8wVEtKImNwR8m8NhWEthca860n/Zvo1nhdA1+oXtJU2F89Khu5v3nW bDErUdks0jUErMtCQFRCl4iq6KxMbWFLmv2fV8weIoM9X6d4w1/0u9MIHXkxOjSd mOWKH0ECdldk2alz45aX3CFxeKjnx8o6jlyc2oCyUJZgSDck7A01a3FwjSEqz2+T XqZYOzgXV1C/7NC+ocG0vK7G6YVRPjruq1k94/+QwaebS/oOqgNDsP4t+R5ZUoJQ 5pOyVcH3RzJqsobtjthR277xHv3CwDGqGbZFJhc7MLegs9nRySX7vOAaloC8/61R zMBumUdH3Wpee/8tTs5gOPcsEkjGagVXlCrpxaTjKXzT496f0Zc+33ZJeypVG1OF zb6jqZyK3Q3Z3Hiinx84B+kX5lhIb9ezq5vlthnzmmjluExL9gvjF1p5rd8qFc8m QLuYNTyl12udOjD57SUn =Rf7X -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org