Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #4543

Re: Dealing with application names in a JEE web app

From Tom Anderson <twic@urchin.earth.li>
Newsgroups comp.lang.java.programmer
Subject Re: Dealing with application names in a JEE web app
Date 2011-05-24 18:16 +0100
Organization Stack Usenet News Service
Message-ID <alpine.DEB.2.00.1105241802310.27717@urchin.earth.li> (permalink)
References <irebhd$16t$1@dont-email.me>

Show all headers | View raw


On Mon, 23 May 2011, markspace wrote:

> So how do folks write their apps so that they can handle being deployed 
> under different names?

Just to add to what others have said, the ground truth value for the path 
at which your app is located is HttpServletRequest.getContextPath:

http://download.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getContextPath%28%29

Having access to that lets you programmatically construct URLs of various 
kinds (absolute, host-relative, etc). That's how various things, like 
c:url, get this right.

It doesn't help you deal with this in resources which are not 
programmatic, like static CSS, so here you have to depend on relative 
references. This doesn't strike me as difficult - you decide early on to 
keep all your css under /contextpath/css, and your site furniture images 
under /contextpath/images, and then because CSS image paths are relative 
to the stylesheet, in your CSS you can write:

background:url(../images/bbg.jpg) left top repeat;

A similar approach should be usable in other static resources which 
contain links.

tom

-- 
Just because Congresspeople do it, doesn't mean it's right. -- Ian York

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Dealing with application names in a JEE web app markspace <-@.> - 2011-05-23 12:11 -0700
  Re: Dealing with application names in a JEE web app Lew <noone@lewscanon.com> - 2011-05-23 15:30 -0400
    Re: Dealing with application names in a JEE web app markspace <-@.> - 2011-05-23 12:41 -0700
    Re: Dealing with application names in a JEE web app markspace <-@.> - 2011-05-23 13:10 -0700
      Re: Dealing with application names in a JEE web app Lew <noone@lewscanon.com> - 2011-05-23 17:02 -0400
        Re: Dealing with application names in a JEE web app jebblue <n@n.nnn> - 2011-05-23 19:30 -0500
          Re: Dealing with application names in a JEE web app Lew <noone@lewscanon.com> - 2011-05-23 21:13 -0400
        Re: Dealing with application names in a JEE web app markspace <-@.> - 2011-05-24 09:32 -0700
  Re: Dealing with application names in a JEE web app Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-23 19:01 -0300
  Re: Dealing with application names in a JEE web app Owen Jacobson <angrybaldguy@gmail.com> - 2011-05-23 23:20 -0400
  Re: Dealing with application names in a JEE web app Tom Anderson <twic@urchin.earth.li> - 2011-05-24 18:16 +0100
    Re: Dealing with application names in a JEE web app markspace <-@.> - 2011-05-25 12:16 -0700
      Re: Dealing with application names in a JEE web app markspace <-@.> - 2011-05-25 16:40 -0700
      Re: Dealing with application names in a JEE web app Tom Anderson <twic@urchin.earth.li> - 2011-05-26 18:07 +0100
        Re: Dealing with application names in a JEE web app Lew <noone@lewscanon.com> - 2011-05-26 13:25 -0400
          Re: Dealing with application names in a JEE web app markspace <-@.> - 2011-05-26 12:57 -0700
            Re: Dealing with application names in a JEE web app Lew <noone@lewscanon.com> - 2011-05-26 19:39 -0400
              Re: Dealing with application names in a JEE web app Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-05-27 07:31 -0300
                Re: Dealing with application names in a JEE web app Lew <noone@lewscanon.com> - 2011-05-27 10:14 -0400
        Re: Dealing with application names in a JEE web app markspace <-@.> - 2011-05-26 12:51 -0700
        Re: Dealing with application names in a JEE web app Steve Sobol <sjsobol@JustThe.net> - 2011-05-26 14:51 -0700

csiph-web