You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship" <hl...@attbi.com> on 2003/03/13 22:41:00 UTC

Shorter URLs

I've been thinking for a while that Tapestry should shorten the URLs it
generates a little.

One option would be to change who the service is identified.  Here's my
thought:

Today (2.3):

http://localhost:8080/examples/app?service=direct&context=0/Pets/$DirectArea
_1

Proposed:

http://localhost:8080/examples/direct.app?context=0/Pets/$DirectArea_1


In other words, plug in the context into the servlet mapping itself (Struts
does something similar).

This would require two mappings for the servlet, one on "/app", the other on
"/*.app".

Advantage: shorter, clearer URLs.  Fewer query parameters.

Disadvantage: External URLs created in 2.3 or earlier, and bookmarked, may
no longer work (or will require a kludge to make work).

Don't forget about the new JSP taglibs for creating page and external
service links.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



RE: Shorter URLs

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
That doesn't work because Tapestry has no way of knowing which key is the
service name.

It could just work through its finite list of service names, i.e., Is there
a "direct" query parameter?  Or "home", "action", "asset", "external", ...
(don't forget user-defined services).

Problems occur if you submit a form where one of the form element names is
"home" or "action" or "direct".  There will be two suitable keys, either of
which could be the service name.  I hate ambiguity.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Viktor Szathmary [mailto:phraktle@imapmail.org] 
> Sent: Friday, March 14, 2003 12:01 PM
> To: Apache Tapestry Developers
> Subject: RE: Shorter URLs
> 
> 
> On Thu, 13 Mar 2003 18:54:25 -0500, "Howard M. Lewis Ship" 
> <hl...@attbi.com> said:
> 
> > How about
> > 
> > 
> http://localhost:8080/examples/app?> service=direct/0/Pets/$DirectArea_1
> > 
> 
http://localhost:8080/examples/app?direct=0/Pets/$DirectArea_1

...maybe?

      viktor

-- 
http://www.fastmail.fm - Faster than the air-speed velocity of an
                          unladen european swallow

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


RE: Shorter URLs

Posted by Viktor Szathmary <ph...@imapmail.org>.
On Thu, 13 Mar 2003 18:54:25 -0500, "Howard M. Lewis Ship"
<hl...@attbi.com> said:

> How about
> 
> http://localhost:8080/examples/app?service=direct/0/Pets/$DirectArea_1
> 

http://localhost:8080/examples/app?direct=0/Pets/$DirectArea_1

...maybe?

      viktor

-- 
http://www.fastmail.fm - Faster than the air-speed velocity of an
                          unladen european swallow

Re: Shorter URLs

Posted by Richard Lewis-Shell <rl...@mac.com>.
http://localhost:8080/examples/app?service=direct/0/Pets/$DirectArea_1

+1

R
----- Original Message -----
From: "Howard M. Lewis Ship" <hl...@attbi.com>
To: "'Tapestry development'" <ta...@jakarta.apache.org>
Sent: Friday, March 14, 2003 12:54 PM
Subject: RE: Shorter URLs


http://localhost:8080/examples/app?direct/0/Pets/$DirectArea_1

Is not a valid URL; it looks like a query parameter with an awkward name and
no value.

How about

http://localhost:8080/examples/app?service=direct/0/Pets/$DirectArea_1

This combines the service and the context parameters together into a single
value.  It will be easy enough to parse it apart into a service name and a
service context.  This I like: it's a bit shorter and one less query
parameter to fuss with.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Richard Lewis-Shell [mailto:rlewisshell@mac.com]
> Sent: Thursday, March 13, 2003 6:01 PM
> To: Tapestry development
> Subject: Re: Shorter URLs
>
>
> Ahh yes, the good ol' days!
>
> OK - so if the problem is the relative URLs - what about
> this: http://localhost:8080/examples/app?direct/0/Pets/$DirectArea_1
>
> R
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org




RE: Shorter URLs

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
http://localhost:8080/examples/app?direct/0/Pets/$DirectArea_1

Is not a valid URL; it looks like a query parameter with an awkward name and
no value.

How about

http://localhost:8080/examples/app?service=direct/0/Pets/$DirectArea_1

This combines the service and the context parameters together into a single
value.  It will be easy enough to parse it apart into a service name and a
service context.  This I like: it's a bit shorter and one less query
parameter to fuss with.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Richard Lewis-Shell [mailto:rlewisshell@mac.com] 
> Sent: Thursday, March 13, 2003 6:01 PM
> To: Tapestry development
> Subject: Re: Shorter URLs
> 
> 
> Ahh yes, the good ol' days!
> 
> OK - so if the problem is the relative URLs - what about 
> this: http://localhost:8080/examples/app?direct/0/Pets/$DirectArea_1
> 
> R
> 


Re: Shorter URLs

Posted by Richard Lewis-Shell <rl...@mac.com>.
Ahh yes, the good ol' days!

OK - so if the problem is the relative URLs - what about this:
http://localhost:8080/examples/app?direct/0/Pets/$DirectArea_1

R

----- Original Message -----
From: "Howard M. Lewis Ship" <hl...@attbi.com>
To: "'Tapestry development'" <ta...@jakarta.apache.org>
Sent: Friday, March 14, 2003 11:41 AM
Subject: RE: Shorter URLs


This is a trip back in time!

Your later examples reflect Tapestry from the 1.0 - 2.0 time frame, give or
take.  This is definitely possible in the Servlet API, it makes use of the
pathInfo property of the HttpServletRequest.

In you second example, the pathInfo would be "/direct/0/Pets/$DirectArea_1".
It's very easy to parse that into a service and an array of service context
parameters.

Unfortunately, that leaves the base URL for the response as:

http://localhost:8080/examples/app/direct/0/Pets/

Relative URLs in static HTML templates to things like "images/foo.gif" will
not work, because the browser will see them as ".../0/Pets/images/foo.gif"
which doesn't exist.

You are forced to use absolute URLs, such as "/context/images/foo.gif" ...
which means your app breaks if it is not deployed as "/context".

I've tried in the past to work around this using the <base> tag; even
changed the Shell component to emit the <base> tag.

Didn't work; there was always something that didn't take.  It seems like
firewalls are a real pain when it comes to this; put one in the middle and
stuff that works in the lab breaks in production.  Even straightening that
out just revealted the next layer in the onion: javascript issues raising
popup windows.

I gave up and decided to use query parameters so that the base URL didn't
ever need kluding or translating.

A future release, not 2.4/3.0, may extract this aspect of Tapestry and make
it pluggable.


--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Richard Lewis-Shell [mailto:rlewisshell@mac.com]
> Sent: Thursday, March 13, 2003 5:01 PM
> To: Tapestry development
> Subject: Re: Shorter URLs
>
>
> Shorter URLS = good.  More servlet mappings to get up and
> running = bad.  We are trying to lower the entry bar
> remember, and that doesn't seem much shorter - all you've
> really done is "service=direct" -> "direct.".
>
> I am not too clued up on the issues surrounding URL encodings
> - there always seems to be some problem when they are
> modified, but what about:
> http://localhost:8080/examples/app/direct?context=0/Pets/$DirectArea_1
>
> Is that possible?  Would a single servlet mapping handle this?
>
> Now to really illustrate how little I know about the issues
> here, how about:
> http://localhost:8080/examples/app/direct/0/Pets/$DirectArea_1
>
> ?
>
> R
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org




RE: Shorter URLs

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
This is a trip back in time!

Your later examples reflect Tapestry from the 1.0 - 2.0 time frame, give or
take.  This is definitely possible in the Servlet API, it makes use of the
pathInfo property of the HttpServletRequest.

In you second example, the pathInfo would be "/direct/0/Pets/$DirectArea_1".
It's very easy to parse that into a service and an array of service context
parameters.

Unfortunately, that leaves the base URL for the response as:

http://localhost:8080/examples/app/direct/0/Pets/

Relative URLs in static HTML templates to things like "images/foo.gif" will
not work, because the browser will see them as ".../0/Pets/images/foo.gif"
which doesn't exist.

You are forced to use absolute URLs, such as "/context/images/foo.gif" ...
which means your app breaks if it is not deployed as "/context".

I've tried in the past to work around this using the <base> tag; even
changed the Shell component to emit the <base> tag.

Didn't work; there was always something that didn't take.  It seems like
firewalls are a real pain when it comes to this; put one in the middle and
stuff that works in the lab breaks in production.  Even straightening that
out just revealted the next layer in the onion: javascript issues raising
popup windows.

I gave up and decided to use query parameters so that the base URL didn't
ever need kluding or translating.

A future release, not 2.4/3.0, may extract this aspect of Tapestry and make
it pluggable.


--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



> -----Original Message-----
> From: Richard Lewis-Shell [mailto:rlewisshell@mac.com] 
> Sent: Thursday, March 13, 2003 5:01 PM
> To: Tapestry development
> Subject: Re: Shorter URLs
> 
> 
> Shorter URLS = good.  More servlet mappings to get up and 
> running = bad.  We are trying to lower the entry bar 
> remember, and that doesn't seem much shorter - all you've 
> really done is "service=direct" -> "direct.".
> 
> I am not too clued up on the issues surrounding URL encodings 
> - there always seems to be some problem when they are 
> modified, but what about: 
> http://localhost:8080/examples/app/direct?context=0/Pets/$DirectArea_1
> 
> Is that possible?  Would a single servlet mapping handle this?
> 
> Now to really illustrate how little I know about the issues 
> here, how about: 
> http://localhost:8080/examples/app/direct/0/Pets/$DirectArea_1
> 
> ?
> 
> R
> 
>


Re: Shorter URLs

Posted by Eric Everman <ev...@precedadesign.com>.
At 3/13/2003, you wrote:
>Shorter URLS = good.  More servlet mappings to get up and running = bad.  We
>are trying to lower the entry bar remember, and that doesn't seem much
>shorter - all you've really done is "service=direct" -> "direct.".
>
>I am not too clued up on the issues surrounding URL encodings - there always
>seems to be some problem when they are modified, but what about:
>http://localhost:8080/examples/app/direct?context=0/Pets/$DirectArea_1
>
>Is that possible?  Would a single servlet mapping handle this?
>
>Now to really illustrate how little I know about the issues here, how about:
>http://localhost:8080/examples/app/direct/0/Pets/$DirectArea_1

I think including more data in the path (like the example above) instead of 
in query parameters is a great idea, though I am also not sure if there are 
workability issues here.

I would definitely keep the    /app/[something]    portion of the 
URL.  This keeps the mappings simple and there are other ways to shorten 
the urls.

$.02

Eric Everman


Re: Shorter URLs

Posted by Richard Lewis-Shell <rl...@mac.com>.
Shorter URLS = good.  More servlet mappings to get up and running = bad.  We
are trying to lower the entry bar remember, and that doesn't seem much
shorter - all you've really done is "service=direct" -> "direct.".

I am not too clued up on the issues surrounding URL encodings - there always
seems to be some problem when they are modified, but what about:
http://localhost:8080/examples/app/direct?context=0/Pets/$DirectArea_1

Is that possible?  Would a single servlet mapping handle this?

Now to really illustrate how little I know about the issues here, how about:
http://localhost:8080/examples/app/direct/0/Pets/$DirectArea_1

?

R

----- Original Message -----
From: "Howard M. Lewis Ship" <hl...@attbi.com>
To: "Tapestry-Dev" <ta...@jakarta.apache.org>
Sent: Friday, March 14, 2003 10:41 AM
Subject: Shorter URLs


I've been thinking for a while that Tapestry should shorten the URLs it
generates a little.

One option would be to change who the service is identified.  Here's my
thought:

Today (2.3):

http://localhost:8080/examples/app?service=direct&context=0/Pets/$DirectArea
_1

Proposed:

http://localhost:8080/examples/direct.app?context=0/Pets/$DirectArea_1


In other words, plug in the context into the servlet mapping itself (Struts
does something similar).

This would require two mappings for the servlet, one on "/app", the other on
"/*.app".

Advantage: shorter, clearer URLs.  Fewer query parameters.

Disadvantage: External URLs created in 2.3 or earlier, and bookmarked, may
no longer work (or will require a kludge to make work).

Don't forget about the new JSP taglibs for creating page and external
service links.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/proposals/tapestry



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org