You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/04/13 17:41:49 UTC
Standardizing Redirect in Cocoon
As of Servlet 2.3, the spec officially states that redirects to "/"
get sent to the server root. I can think of many cases where an easy
redirect to the context root is important.
To that end, I propose that the redirect() method should be wrapped,
and if the "context:" protocol is specified, then the URL should be
relative to the context root. This should be easy in Cocoon 2, because
we are limiting the access to the redirect function--I don't know about
Cocoon 1.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by Berin Loritsch <bl...@apache.org>.
Donald Ball wrote:
>
> On Mon, 16 Apr 2001, Berin Loritsch wrote:
>
> > > i'd think it would be pretty cool to have a filter which would check for
> > > context urls in certain HTML elements (a:href, img:src, etc.) and
> > > translate context: urls appropriately. anyone else think this would be
> > > useful?
> >
> > Yup. That would be useful, but probably best done as a transformer. The
> > transformer would be very light weight.
>
> i think filter == transformer. :) but good to see we're on the same page
> on this at least.
Ah, C2 vs. C1 terminology. We should add to the C2 glossary what the equivalents
where called in C1, and in the C1 glossary (is there one?) what they will be
called in C2. That way we can make the translation easily.
When I see the term "filter" I tend to think in more broad terms than Cocoon,
IOW implementation not architecture.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 16 Apr 2001, Berin Loritsch wrote:
> > i'd think it would be pretty cool to have a filter which would check for
> > context urls in certain HTML elements (a:href, img:src, etc.) and
> > translate context: urls appropriately. anyone else think this would be
> > useful?
>
> Yup. That would be useful, but probably best done as a transformer. The
> transformer would be very light weight.
i think filter == transformer. :) but good to see we're on the same page
on this at least.
- donald
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by Berin Loritsch <bl...@apache.org>.
Donald Ball wrote:
>
> On Fri, 13 Apr 2001, Berin Loritsch wrote:
>
> > > > and if the "context:" protocol is specified, then the URL should be
> > > > relative to the context root. This should be easy in Cocoon 2, because
> > > > we are limiting the access to the redirect function--I don't know about
> > > > Cocoon 1.
> > >
> > > Can you explain a bit in detail?
> >
> > Basically something like this:
> >
> > Current URI: "http://localhost/cocoon/foo/bar/index.html"
> > Current context: "cocoon"
> >
> > CURRENTLY DONE BY SERVLET API
> > Redirect-to: "/index.html" maps to "http://localhost/index.html"
> > Redirect-to: "../index.html" maps to "http://localhost/cocoon/foo/index.html"
> >
> > NEW FUNCTIONALITY
> > Redirect-to: "context://index.html" maps to "http://localhost/cocoon/index.html"
> >
> > If the context is moved to "margaritaville/parrothead"
> > then the context urls won't have to be changed
> > ("http://localhost/margaritaville/parrothead/index.html")
> > to go to the new location.
> >
> > Absolute urls like "/cocoon/index.html" won't work in that case, they
> > would have to be changed in the code.
>
> +1. i was also thinking about how to link to c2 resources as well. fer
> instance, suppose i have an image located at
>
> context://resources/images/pretty.gif
>
> in a webapp mounted at 'foo'. the only way i can reliably link to that
> image across all of the pages in my webapp is to link to
>
> '/foo/resources/images/pretty.gif'
>
> i'd think it would be pretty cool to have a filter which would check for
> context urls in certain HTML elements (a:href, img:src, etc.) and
> translate context: urls appropriately. anyone else think this would be
> useful?
Yup. That would be useful, but probably best done as a transformer. The
transformer would be very light weight.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by Santiago Gala <sg...@hisitech.com>.
Donald Ball escribió:
>
> On Fri, 13 Apr 2001, Berin Loritsch wrote:
>
> > > > and if the "context:" protocol is specified, then the URL should be
> > > > relative to the context root. This should be easy in Cocoon 2, because
> > > > we are limiting the access to the redirect function--I don't know about
> > > > Cocoon 1.
> > >
> > > Can you explain a bit in detail?
> >
> > Basically something like this:
> >
> > Current URI: "http://localhost/cocoon/foo/bar/index.html"
> > Current context: "cocoon"
> >
> > CURRENTLY DONE BY SERVLET API
> > Redirect-to: "/index.html" maps to "http://localhost/index.html"
> > Redirect-to: "../index.html" maps to "http://localhost/cocoon/foo/index.html"
> >
> > NEW FUNCTIONALITY
> > Redirect-to: "context://index.html" maps to "http://localhost/cocoon/index.html"
> >
> > If the context is moved to "margaritaville/parrothead"
> > then the context urls won't have to be changed
> > ("http://localhost/margaritaville/parrothead/index.html")
> > to go to the new location.
> >
> > Absolute urls like "/cocoon/index.html" won't work in that case, they
> > would have to be changed in the code.
>
> +1. i was also thinking about how to link to c2 resources as well. fer
> instance, suppose i have an image located at
>
> context://resources/images/pretty.gif
>
> in a webapp mounted at 'foo'. the only way i can reliably link to that
> image across all of the pages in my webapp is to link to
>
> '/foo/resources/images/pretty.gif'
>
> i'd think it would be pretty cool to have a filter which would check for
> context urls in certain HTML elements (a:href, img:src, etc.) and
> translate context: urls appropriately. anyone else think this would be
> useful?
>
If our experience with Jetspeed in a completely different environment
serves you, I would say go ahead.
The best solution we found, after fighting with this problem in order to
deliver a working war file, is to have everything "context relative",
and use a <BASE href="<context uri>"> in all our pages. As cocoon will
process every generator content through the pipeline, having the
context:// uris filtered will save you quite a few headaches when
delivering static links, with unnoticeable overhead, giving about the
same functionality that a BASE uri would give.
This is WRT links (in Stephano's definition). Flows (i.e. control
information for the webapp) needs to be handled in more complex ways,
specially when aggregating different webapps together.
> - donald
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by Donald Ball <ba...@webslingerZ.com>.
On Fri, 13 Apr 2001, Berin Loritsch wrote:
> > > and if the "context:" protocol is specified, then the URL should be
> > > relative to the context root. This should be easy in Cocoon 2, because
> > > we are limiting the access to the redirect function--I don't know about
> > > Cocoon 1.
> >
> > Can you explain a bit in detail?
>
> Basically something like this:
>
> Current URI: "http://localhost/cocoon/foo/bar/index.html"
> Current context: "cocoon"
>
> CURRENTLY DONE BY SERVLET API
> Redirect-to: "/index.html" maps to "http://localhost/index.html"
> Redirect-to: "../index.html" maps to "http://localhost/cocoon/foo/index.html"
>
> NEW FUNCTIONALITY
> Redirect-to: "context://index.html" maps to "http://localhost/cocoon/index.html"
>
> If the context is moved to "margaritaville/parrothead"
> then the context urls won't have to be changed
> ("http://localhost/margaritaville/parrothead/index.html")
> to go to the new location.
>
> Absolute urls like "/cocoon/index.html" won't work in that case, they
> would have to be changed in the code.
+1. i was also thinking about how to link to c2 resources as well. fer
instance, suppose i have an image located at
context://resources/images/pretty.gif
in a webapp mounted at 'foo'. the only way i can reliably link to that
image across all of the pages in my webapp is to link to
'/foo/resources/images/pretty.gif'
i'd think it would be pretty cool to have a filter which would check for
context urls in certain HTML elements (a:href, img:src, etc.) and
translate context: urls appropriately. anyone else think this would be
useful?
- donald
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by Berin Loritsch <bl...@apache.org>.
giacomo wrote:
>
> On Fri, 13 Apr 2001, Berin Loritsch wrote:
>
> > giacomo wrote:
> > >
> > > On Fri, 13 Apr 2001, Berin Loritsch wrote:
> > >
> > > > As of Servlet 2.3, the spec officially states that redirects to "/"
> > > > get sent to the server root. I can think of many cases where an easy
> > > > redirect to the context root is important.
> > > >
> > > > To that end, I propose that the redirect() method should be wrapped,
> > >
> > > Which redirect() method? The one of the Environment object?
> >
> > The one that a developer of Cocoon can use. Perhaps both. Actually,
> > since all developers are using the Cocoon wrapped objects, we can have
> > the Environment one call the Request object, which handles all the real
> > logic.
>
> Today it is the other way around: the Request calls the Environments.
That's alright. As long as there is only one place to standardize the code.
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by giacomo <gi...@apache.org>.
On Fri, 13 Apr 2001, Berin Loritsch wrote:
> giacomo wrote:
> >
> > On Fri, 13 Apr 2001, Berin Loritsch wrote:
> >
> > > As of Servlet 2.3, the spec officially states that redirects to "/"
> > > get sent to the server root. I can think of many cases where an easy
> > > redirect to the context root is important.
> > >
> > > To that end, I propose that the redirect() method should be wrapped,
> >
> > Which redirect() method? The one of the Environment object?
>
> The one that a developer of Cocoon can use. Perhaps both. Actually,
> since all developers are using the Cocoon wrapped objects, we can have
> the Environment one call the Request object, which handles all the real
> logic.
Today it is the other way around: the Request calls the Environments.
Giacomo
> > > and if the "context:" protocol is specified, then the URL should be
> > > relative to the context root. This should be easy in Cocoon 2, because
> > > we are limiting the access to the redirect function--I don't know about
> > > Cocoon 1.
> >
> > Can you explain a bit in detail?
>
> Basically something like this:
>
> Current URI: "http://localhost/cocoon/foo/bar/index.html"
> Current context: "cocoon"
>
> CURRENTLY DONE BY SERVLET API
> Redirect-to: "/index.html" maps to "http://localhost/index.html"
> Redirect-to: "../index.html" maps to "http://localhost/cocoon/foo/index.html"
>
> NEW FUNCTIONALITY
> Redirect-to: "context://index.html" maps to "http://localhost/cocoon/index.html"
>
> If the context is moved to "margaritaville/parrothead"
> then the context urls won't have to be changed
> ("http://localhost/margaritaville/parrothead/index.html")
> to go to the new location.
>
> Absolute urls like "/cocoon/index.html" won't work in that case, they
> would have to be changed in the code.
>
> >
> > Giacomo
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by Berin Loritsch <bl...@apache.org>.
giacomo wrote:
>
> On Fri, 13 Apr 2001, Berin Loritsch wrote:
>
> > As of Servlet 2.3, the spec officially states that redirects to "/"
> > get sent to the server root. I can think of many cases where an easy
> > redirect to the context root is important.
> >
> > To that end, I propose that the redirect() method should be wrapped,
>
> Which redirect() method? The one of the Environment object?
The one that a developer of Cocoon can use. Perhaps both. Actually,
since all developers are using the Cocoon wrapped objects, we can have
the Environment one call the Request object, which handles all the real
logic.
> > and if the "context:" protocol is specified, then the URL should be
> > relative to the context root. This should be easy in Cocoon 2, because
> > we are limiting the access to the redirect function--I don't know about
> > Cocoon 1.
>
> Can you explain a bit in detail?
Basically something like this:
Current URI: "http://localhost/cocoon/foo/bar/index.html"
Current context: "cocoon"
CURRENTLY DONE BY SERVLET API
Redirect-to: "/index.html" maps to "http://localhost/index.html"
Redirect-to: "../index.html" maps to "http://localhost/cocoon/foo/index.html"
NEW FUNCTIONALITY
Redirect-to: "context://index.html" maps to "http://localhost/cocoon/index.html"
If the context is moved to "margaritaville/parrothead"
then the context urls won't have to be changed
("http://localhost/margaritaville/parrothead/index.html")
to go to the new location.
Absolute urls like "/cocoon/index.html" won't work in that case, they
would have to be changed in the code.
>
> Giacomo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
Re: Standardizing Redirect in Cocoon
Posted by giacomo <gi...@apache.org>.
On Fri, 13 Apr 2001, Berin Loritsch wrote:
> As of Servlet 2.3, the spec officially states that redirects to "/"
> get sent to the server root. I can think of many cases where an easy
> redirect to the context root is important.
>
> To that end, I propose that the redirect() method should be wrapped,
Which redirect() method? The one of the Environment object?
> and if the "context:" protocol is specified, then the URL should be
> relative to the context root. This should be easy in Cocoon 2, because
> we are limiting the access to the redirect function--I don't know about
> Cocoon 1.
Can you explain a bit in detail?
Giacomo
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org