Maybe I'm not fully grasping the problem... what's wrong with using a context asset?
Instead of saying <link href="/context/default.css"...>, why not do:
<link t:type="Any" href="prop:stylsheet" />

.java:

@Inject("context:default.css")
private Asset _stylesheet;

//note: tapestry will coerce the stylesheet appropriately into the client url string
public Asset getStylesheet() {
  return _stylesheet;
}


Then you just need to know the path relative to the context, without needing to know the context...

Robert

On Mar 14, 2007, at 3/143:55 PM , Todd Orr wrote:

Realistically, the context is not always known during development.
Business folk could easily come back after the entire QA cycle and say
that it needs to be changed for marketing reasons. This would require
a code change that may force an entire round of QA again. There should
be some way to refer to resources without hard coding the context.

On 3/12/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
This is a conscious decision, that you will know early on what the
context path will be.

The effort to avoid this in T4, using a <base> tag, caused far more
problems than it solved.

A solution using query parameters is likewise: it makes your site
off-limits to any kind of search engine, and it tends to create longer
and less "pretty" URLs.

On 3/12/07, D&J Gredler <[EMAIL PROTECTED]> wrote:
> I've never had to operate out of a context other than root, so I've just
> hardcoded it to "/mystyle.css" or whatever...
>
>
> On 3/12/07, Bogdan Calmac <[EMAIL PROTECTED]> wrote:
> >
> > Consider a UserDetail page that has an URL like
> > "http://server/context/UserDetail/jdoe";. Here I'm using the tapestry > > style of passing parameters, as part of the context. The problem here > > is that if you have a styleset link to "mystyle.css", it will try to
> > look for "http"://server/context/userdetail/mystyle.css" which of
> > course does not exit. The alternative to use the full path to the css, > > "/context/mystyle.css" is also bad because you don't want to hardcode
> > the name of the context.
> >
> > There are 2 correct solutions to this problem which would be nice to
> > be part of the framework:
> >
> > 1. Allow context information to (optionally) be passed to a page as
> > query parameters, so the above URL would be
> > "http://server/context/UserDetail?userid=jdoe";. The relative link to > > the stylesheet would be fine now, but I don't know if this fits with
> > the design of the framework.
> >
> > 2. Create something like an AssetLink component that takes care to
> > prepend so context, so that:
> >
> >   <link t:type="AssetLink" href="/mystyle.css" rel="stylesheet"
> > type="text/css"/>
> >
> > would generate;
> >
> > <link href="/context/mystyle.css" rel="stylesheet" type="text/ css"/>
> >
> >
> > I would expect there were others who encountered the same quirk. How
> > did you address it?
> >
> > Thank you,
> > Bogdan Calmac.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to