Re: Tapestry's ugly-ass URLs

Scot Doyle <[email protected]>
Newsgroups gmane.comp.java.tapestry.devel
Message-ID <[email protected]>
Howard, I for one agree that WYSIWYG is more imprtant
than pretty URL's.

I also would resist solutions that are brittle.  My
philosophy on design is similar to Paul Graham's... if
it isn't beautiful, there must be a better way.   I
think that is what I hear you saying.  So I will keep
thinking on this... maybe someone can come up with a
better solution than any of us have thought up so
far...

http://paulgraham.com/taste.html


--- [email protected] wrote:
> Just wanted to say that I really, really, really
> wanted Tapestry URLs to be 
> pretty, but it just doesn't work ... unless we
> through the WYSIWYG aspect out 
> the door!
> 
> Another option, which I'm a little loath to get
> into, is to identify relative 
> URLs in the HTML template and convert them to
> absolute URLs dynamically.  This 
> allows the template to live in the context root with
> relative URLs to assets 
> under the context root but at runtime, the relative
> URLs become complete URLs 
> (well, technically, URIs).
> 
> That is,
> 
> <img src="images/button.gif"/>
> 
> Would be translate to:
> 
> <img src="/context-name/images/button.gif"/>
> 
> Where /context-name is determined at runtime.
> 
> What the hell, might as well localize it on the fly,
> too:
> 
> <img src="/context-name/images/button_de.gif"/>
> 
> 
> Again, the downside is accurately locating these
> URLs in the HTML template; 
> they show up in various tags, in stylesheets ... and
> in JavaScript!  So its not 
> trivial, but probably should be examined!
> 
> And ... once you've done all that, you still
> wouldn't want to hack the URL with 
> any expectation of getting anything but the
> exception page ...
> 
> 
> --
> [email protected]
> 
> http://tapestry.sf.net
> > Howard, thanks for the resonse, and I will think
> on
> > this.
> > 
> > Scot
> > 
> > 
> > --- [email protected] wrote:
> > > Encoding information in the path info was, in
> fact,
> > > the way Tapestry originally 
> > > operated.
> > > 
> > > It has a few defects.
> > > 
> > > As you wander the application, your base URL
> (used,
> > > by the client browser, to 
> > > calculate relative URLs) varies considerably ...
> > > this is especially bad in 
> > > Tapestry, because the number of "terms" in the
> path
> > > info varies depending on 
> > > service.
> > > 
> > > The end result is that you have to use absolute,
> not
> > > relative, paths to all 
> > > your static resources (images, stylesheets,
> etc.).
> > > 
> > > Worse, the first "term" in the URL is "/context"
> (as
> > > in "/context/servlet?
> > > service=....").  This is variable depending on
> > > deployment, so you end up in a 
> > > situtation where your implementation mandates a
> > > deployment detail that is 
> > > supposed to be variable.
> > > 
> > > That's why Sun (in model 1 and 2) strongly
> suggests
> > > that you always use 
> > > relative URLs to assets.
> > > 
> > > --
> > > [email protected]
> > > 
> > > http://tapestry.sf.net
> > > > Howard,
> > > > 
> > > > I have an idea for the URL's that you could
> > > probably
> > > > either confirm or shoot down pretty quickly.
> > > > 
> > > > What about the way Amazon does it?  Of course
> I
> > > don't
> > > > understand all the details, but here are some
> > > basics:
> > > > 
> > > > 1. Here is a pretty URL that goes to a unique
> > > page,
> > > > but is stateless
> > > >
> http://www.amazon.com/exec/obidos/ASIN/0618260587
> > > > 
> > > > 2. One a person goes to that page, state is
> added
> > > > automatically so taht it looks like
> > > >
> > >
> >
>
http://www.amazon.com/exec/obidos/ASIN/0618260587/102-3321578-2400930
> > > > 
> > > > 3. The URL actually contains state, but
> without
> > > using
> > > > the querystring indicator, i.e. "?"
> > > > 
> > > > Now, there are two key points about this form
> of
> > > URL.
> > > > A) It looks like a stateless URL so all search
> > > engines
> > > > will crawl it and record it.  B)
> > > > 
> > > > 4. If someone else was to go to Amazon using
> the
> > > URL
> > > > in #2 above, it would be silently converted to
> > > > represent their session with Amazon, not mine.
>  In
> > > > other words, the part of the URL that has
> state
> > > would
> > > > cause an internal Tapestry exception, since it
> > > would
> > > > be invalid.  Then Tapestry would create a new
> > > session
> > > > (Visit) and attach it to the end of the URL.
> > > > 
> > > > Now, as I see it, there are two very important
> > > > objectives Amazon has achieved by using this
> form
> > > of
> > > > URL.
> > > > 
> > > > 1. There is no query string (i.e. "?")
> indicator. 
> > > > This means that all search engines will now be
> > > able to
> > > > catalog my site.  In e-commerce, this is
> > > absolutely
> > > > essential.
> > > > 
> > > > 2. I can send this URL to someone else, or
> > > bookmark
> > > > it, and it will still work.  Again, this is
> > > essential
> > > > for e-commerce.
> > > > 
> > > > Now, on the downside, I admit that the URL is
> not
> > > > pretty in the sense that it is hierarchical,
> but
> > > it
> > > > would at least achieve two of the three goals.
> > > > 
> > > > Also, please know that I have not developed
> any
> > > > Tapestry applications.  I have just completed
> my
> > > first
> > > > read-through of the developers guide, and will
> > > start
> > > > later this month.
> > > > 
> > > > Thanks for your consideration,
> > > > Scot
> > > > 
> > > > 
> > > > --- "Andrew C. Oliver" <[email protected]>
> > > wrote:
> > > > > I understand.  I just suggest people do care
> > > about
> > > > > such things.  Myself 
> > > > > included.  That is all.
> > > > > 
> > > > > -Andy
> > > > > 
> > > > > Howard M. Lewis Ship wrote:
> > > > > 
> 
=== message truncated ===

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.