Quick poll for web developers

Do you use relative or absolute URL's within your web application? Why?

--
Norris Shelton
Sun Certified Java Programmer

0
19 comments
Avatar
Permanently deleted user

Why this question?

We suppose be not using absolute URLs to refer pages inside the same WebApp
If you deploy you app onto some different server with different context or same server with different context (There are many possibilities).... then there is no point in using absolute URLs

-Anki.N

0
Avatar
Permanently deleted user

Also think there is (except a few exceptions) not really a use for absolute URLs, so I used relative ones until now... am I missing something?

regards,

Messi

0
Avatar
Permanently deleted user

Norris? Really? Dude absolute paths and you change your context and bust your whole app. Why do you ask?

R

0
Avatar
Permanently deleted user

Norris Shelton wrote:

Do you use relative or absolute URL's within your web application? Why?


Absolute URLs. Simplest in combination with request.getContextPath().

/Kreiger



Attachment(s):
signature.asc
0
Avatar
Permanently deleted user

We act as an ASP, but each customer believes that they have their own
site. We have 6 sites with their own net address. An example is
www.justicexchange.com, www.alertxpress.com, www.vinewatch.com. Unknown
to our customers, all the applications run on the same machine, under
the same instance.

We get away with each application thinking it is the root context by
using tomcat's ability to specify a service for each webapp. This
allows each webapp to have it's own docBase, ports and to have "/" as
it's context path. Then we have BigIP performing encryption/decryption
and load balancing.

This removes context path a deployment issue.

The problem comes in when we have a group who wants to move to JBoss.
Unfortunately, the JBoss Tomcat does not have the full feature set that
the normal Tomcat does. Now we are looking at having something like the
following:
www.justicexchange.com/justicexchange or
www.alertxpress.com/alertxpress. Or worse, our customers will now be
able to www.justicexchange.com/alertxpress. When a customer types
www.justicexchange.com, they are not going to get the website that they
are trying to get.

Bah.

Norris Shelton
Sun Certified Java Programmer




Robert S. Sfeir wrote:

>Norris? Really? Dude absolute paths and you change your context and bust your whole app. Why do you ask?
>
>R

>

0
Avatar
Permanently deleted user

Or worse, our customers will now be
able to www.justicexchange.com/alertxpress. When a customer types
www.justicexchange.com, they are not going to get the website that
they
are trying to get.

We have the same problem and found no solution till yet :(. On some forums
I received the hint that this could be solved with Apache in front of of
the WebApplication and the JK2 connector, but I didn't managed to find out
how :(.

Ahmed.

0
Avatar
Permanently deleted user

Never tried that by myself, but did you take a look at the virtual-host
element in jboss-web.xml? Maybe that could help...

Norris Shelton wrote:

We act as an ASP, but each customer believes that they have their own
site. We have 6 sites with their own net address. An example is
www.justicexchange.com, www.alertxpress.com, www.vinewatch.com. Unknown
to our customers, all the applications run on the same machine, under
the same instance.

We get away with each application thinking it is the root context by
using tomcat's ability to specify a service for each webapp. This
allows each webapp to have it's own docBase, ports and to have "/" as
it's context path. Then we have BigIP performing encryption/decryption
and load balancing.

This removes context path a deployment issue.

The problem comes in when we have a group who wants to move to JBoss.
Unfortunately, the JBoss Tomcat does not have the full feature set that
the normal Tomcat does. Now we are looking at having something like the
following:
www.justicexchange.com/justicexchange or
www.alertxpress.com/alertxpress. Or worse, our customers will now be
able to www.justicexchange.com/alertxpress. When a customer types
www.justicexchange.com, they are not going to get the website that they
are trying to get.

Bah.

Norris Shelton
Sun Certified Java Programmer




Robert S. Sfeir wrote:

>> Norris? Really? Dude absolute paths and you change your context and
>> bust your whole app. Why do you ask?
>>
>> R
>>
>>

0
Avatar
Permanently deleted user

That is the BS that the guys who want JBoss sold us on. They can't
figure out how to do it. It's fairly easy to do with Tomcat. If you
use that platform, I can show you what changes need to be made to the
server.xml. They are fairly trivial.

Norris Shelton
Sun Certified Java Programmer




Ahmed Mohombe wrote:

>> Or worse, our customers will now be
>> able to www.justicexchange.com/alertxpress. When a customer types
>> www.justicexchange.com, they are not going to get the website that
>> they
>> are trying to get.
>

We have the same problem and found no solution till yet :(. On some
forums I received the hint that this could be solved with Apache in
front of of the WebApplication and the JK2 connector, but I didn't
managed to find out how :(.

>

Ahmed.

>

0
Avatar
Permanently deleted user

They had hoped that BigIP would allow them to map www.site.com to the
/site context. Then they said Apache could do it. So far, no one has
figured out how to do it.

Relative links wouldn't be such a big deal if the site wasn't so large
(>250 JSPs). Trying to remember how many levels you have to go back,
just to go forward so you can access the layout page for this particular
page is NOT going to be fun.

Norris Shelton
Sun Certified Java Programmer




Martin Fuhrer wrote:

Never tried that by myself, but did you take a look at the
virtual-host element in jboss-web.xml? Maybe that could help...

>

Norris Shelton wrote:

>
>> We act as an ASP, but each customer believes that they have their own
>> site. We have 6 sites with their own net address. An example is
>> www.justicexchange.com, www.alertxpress.com, www.vinewatch.com.
>> Unknown to our customers, all the applications run on the same
>> machine, under the same instance.
>>
>> We get away with each application thinking it is the root context by
>> using tomcat's ability to specify a service for each webapp. This
>> allows each webapp to have it's own docBase, ports and to have "/" as
>> it's context path. Then we have BigIP performing
>> encryption/decryption and load balancing.
>>
>> This removes context path a deployment issue.
>>
>> The problem comes in when we have a group who wants to move to
>> JBoss. Unfortunately, the JBoss Tomcat does not have the full
>> feature set that the normal Tomcat does. Now we are looking at
>> having something like the following:
>> www.justicexchange.com/justicexchange or
>> www.alertxpress.com/alertxpress. Or worse, our customers will now be
>> able to www.justicexchange.com/alertxpress. When a customer types
>> www.justicexchange.com, they are not going to get the website that
>> they are trying to get.
>>
>> Bah.
>>
>> Norris Shelton
>> Sun Certified Java Programmer
>>
>>
>>
>>
>> Robert S. Sfeir wrote:
>>
>>> Norris? Really? Dude absolute paths and you change your context
>>> and bust your whole app. Why do you ask?
>>>
>>> R
>>>
>>>

0
Avatar
Permanently deleted user

We use absolute and have custom tags that add the context to links/image
paths, etc...

Norris Shelton wrote:

Do you use relative or absolute URL's within your web application? Why?


--
"A man's ethical behavior should be based effectually on sympathy,
education, and social ties and needs; no religious basis is necessary.
Man would indeed be in a poor way if he had to be restrained by fear of
punishment and hope of reward after death."
[Albert Einstein, "Religion and Science", New York Times Magazine, 9
November 1930]

0
Avatar
Permanently deleted user

....and I believe we had problems with relative paths on iPlanet.

Norris Shelton wrote:

Do you use relative or absolute URL's within your web application? Why?


--
"A man's ethical behavior should be based effectually on sympathy,
education, and social ties and needs; no religious basis is necessary.
Man would indeed be in a poor way if he had to be restrained by fear of
punishment and hope of reward after death."
[Albert Einstein, "Religion and Science", New York Times Magazine, 9
November 1930]

0
Avatar
Permanently deleted user

Can you give me an example of what this looks like?

Norris Shelton
Sun Certified Java Programmer




Brad wrote:

We use absolute and have custom tags that add the context to
links/image paths, etc...

>

Norris Shelton wrote:

>
>> Do you use relative or absolute URL's within your web application? Why?
>>
>

0
Avatar
Permanently deleted user

Well I think neither relative links nor absolute will help I think. The first problem you have is that someone going to www.foo.com/foo and www.foo.com/bar can access either foo or bar context. You need to add IP addresses to your machine, or via virtual domains enable specific access to domains. So that's the first thing. The second thing I recommend is that you put Apache in front, with virtual domains forwarding to the proper context, so someone hitting www.foo.com gets properly served www.foo.com/foo, and I believe that you can illiminate the /foo when using apache in front, which means that if you use relative links, it will always keep forwarding any request to the domain to the /foo context. I may be a little off on it, but I think I'm pretty close.

R

0

The Struts link tag adds context for you. the rolloverImg tag is our own tag that adds the context and gets the rest of the path from the specified bundle.

   

]]>

0
Avatar
Permanently deleted user

It's not BS, we've done this, and my current ISP did it for us. Contact me off line since this is OT, and I'll try to guide you to it, or refer you to someone who has. robert(a)NOSPAMdotcodepuccinodotcom

0
Avatar
Permanently deleted user

That is true. I just hate the idea of using Struts HTML tags.

Norris Shelton
Sun Certified Java Programmer




Brad Lane wrote:

>The Struts link tag adds context for you. the rolloverImg tag is our own tag that adds the context and gets the rest of the path from the specified bundle.
>


>         styleId="add"
>      bundle="system-web"
>      activeKey="system.button.add.active"
>      inactiveKey="system.button.add.inactive"
>      border="0"
>   />
>
>]]>

>

0
Avatar
Permanently deleted user

so use jstl they have the same thing there.

R

0
Avatar
Permanently deleted user

Very true. I think I will have to switch to this. Wish I could fine a
less verbose implementation.

Norris Shelton
Sun Certified Java Programmer




Robert S. Sfeir wrote:

>so use jstl they have the same thing there.
>
>R

>

0

Now we are looking at having something like the
following:
www.justicexchange.com/justicexchange or
www.alertxpress.com/alertxpress. Or worse, our
customers will now be
able to www.justicexchange.com/alertxpress. When a
customer types
www.justicexchange.com, they are not going to get the
website that they are trying to get.


I'm a bit late on this one, but I just found this forum.

What I think you can do is put Apache in front of everything, and use mod_proxy to forward the requests to where you want them. It's exactly like using mod_proxy to access Tomcat instead of mod_jk. I had a nightmare trying to get mod_jk going on my latest server (it's always worked well before, god knows what happened), so in the end I just used mod_proxy and it works like a charm.

The thing you might have to do that I haven't tried (although I'm assured it's possible, and maybe even easy) is use mod_rewrite to rewrite the urls on the way back, to make sure that links to images and so on work. You may be able to get away without this with mapping in Tomcat, depending on how the links are set up.

0

Please sign in to leave a comment.