Re: Pros and cons of extension less requests (was Re: Url without extensions - how to match/rewrite)

2007-12-14 Thread Vadim Gritsenko

On Dec 10, 2007, at 11:34 AM, Thorsten Scherler wrote:


On Mon, 2007-12-10 at 10:00 -0500, Vadim Gritsenko wrote:

On Dec 10, 2007, at 3:40 AM, Thorsten Scherler wrote:


I ended up with:

!-- This will match all extension less requests --
map:match type=regexp pattern=^[^.]+$
  !-- This will match all requests having / on the end --
  map:match type=regexp pattern=^(.*)/$
map:match pattern=*/
  map:redirect-to uri=../{1}.html /


This is a browser redirect, so user will ultimately see .../foo.html
URL in the browser. In this case, why would you start with a URL
without extension? I does not make any sense. Just use URL with
extension from the beginning.


lol, tell it my client.

The problem is when you do not do the rewrite


Solution's simple - since you really don't need them, just do not use  
such URLs at all :)




you will end up to use
absolute urls for all images, css, etc. since the client browser will
interpret the / on the end as directory screwing up the relative
imports. Meaning you have either lots of test whether or not we have  
/

on the end or do a rewrite.




/map:match
map:match pattern=**/*/
  map:redirect-to uri=../{2}.html /
/map:match
  /map:match
  map:match pattern=**/*
map:redirect-to uri={2}.html /
  /map:match
  map:match pattern=*
map:redirect-to uri={1}.html /
  /map:match
/map:match


Regardless of comment above, what you got here is too verbose, you  
can

DRY it down using smarter match pattern. For example:

  map:match pattern=^(?:[^.\/]*\/)*([^.\/]+)\/$
map:redirect-to uri=../{1}.html/
  /map:match
  map:match pattern=^(?:[^.\/]*\/)*([^.\/]+)$
map:redirect-to uri={1}.html/
  /map:match



Hmm, sorry but the above is not working for me.


I tested with the applet, was working fine. Probably you need to  
double up each '\' to work around sitemap escaping syntax.


Vadim



Pros and cons of extension less requests (was Re: Url without extensions - how to match/rewrite)

2007-12-10 Thread Thorsten Scherler
On Fri, 2007-12-07 at 08:52 -0500, Vadim Gritsenko wrote:
 On Dec 7, 2007, at 7:44 AM, Thorsten Scherler wrote:
 
  I tried with the regexp matcher but could not found any pattern that
  matches the documents WITHOUT extensions
 
 ^[^.]+$
 
 http://jakarta.apache.org/regexp/applet.html
 
 Vadim

Thanks Vadim,

I ended up with:

!-- This will match all extension less requests --
  map:match type=regexp pattern=^[^.]+$
!-- This will match all requests having / on the end --
map:match type=regexp pattern=^(.*)/$
  map:match pattern=*/
map:redirect-to uri=../{1}.html /
  /map:match
  map:match pattern=**/*/
map:redirect-to uri=../{2}.html /
  /map:match
/map:match
map:match pattern=**/*
  map:redirect-to uri={2}.html /
/map:match
map:match pattern=*
  map:redirect-to uri={1}.html /
/map:match
  /map:match

One side effect is that the app is now way slower if you use
extensionless requests. In our application we need the extensions to
trigger the correct pipelines, which I consider the normal usage of
cocoon. By redirecting the request one is causing more processing on the
app which explains the higher response time.

That makes me wonder whether extension less requests makes sense at all
in a multi-output-format environment.

WDYT?

salu2
-- 
Thorsten Scherler thorsten.at.apache.org
Open Source Java  consulting, training and solutions



Re: Pros and cons of extension less requests (was Re: Url without extensions - how to match/rewrite)

2007-12-10 Thread Vadim Gritsenko

On Dec 10, 2007, at 3:40 AM, Thorsten Scherler wrote:


I ended up with:

!-- This will match all extension less requests --
 map:match type=regexp pattern=^[^.]+$
   !-- This will match all requests having / on the end --
   map:match type=regexp pattern=^(.*)/$
 map:match pattern=*/
   map:redirect-to uri=../{1}.html /


This is a browser redirect, so user will ultimately see .../foo.html  
URL in the browser. In this case, why would you start with a URL  
without extension? I does not make any sense. Just use URL with  
extension from the beginning.




 /map:match
 map:match pattern=**/*/
   map:redirect-to uri=../{2}.html /
 /map:match
   /map:match
   map:match pattern=**/*
 map:redirect-to uri={2}.html /
   /map:match
   map:match pattern=*
 map:redirect-to uri={1}.html /
   /map:match
 /map:match


Regardless of comment above, what you got here is too verbose, you can  
DRY it down using smarter match pattern. For example:


  map:match pattern=^(?:[^.\/]*\/)*([^.\/]+)\/$
map:redirect-to uri=../{1}.html/
  /map:match
  map:match pattern=^(?:[^.\/]*\/)*([^.\/]+)$
map:redirect-to uri={1}.html/
  /map:match



One side effect is that the app is now way slower if you use
extensionless requests. In our application we need the extensions to
trigger the correct pipelines, which I consider the normal usage of
cocoon. By redirecting the request one is causing more processing on  
the

app which explains the higher response time.


You probably mean more round trips. I don't see any extra processing  
on the app.


Vadim


That makes me wonder whether extension less requests makes sense at  
all

in a multi-output-format environment.

WDYT?

salu2
--
Thorsten Scherler  
thorsten.at.apache.org
Open Source Java  consulting, training and  
solutions




Re: Pros and cons of extension less requests (was Re: Url without extensions - how to match/rewrite)

2007-12-10 Thread Thorsten Scherler
On Mon, 2007-12-10 at 10:00 -0500, Vadim Gritsenko wrote:
 On Dec 10, 2007, at 3:40 AM, Thorsten Scherler wrote:
 
  I ended up with:
 
  !-- This will match all extension less requests --
   map:match type=regexp pattern=^[^.]+$
 !-- This will match all requests having / on the end --
 map:match type=regexp pattern=^(.*)/$
   map:match pattern=*/
 map:redirect-to uri=../{1}.html /
 
 This is a browser redirect, so user will ultimately see .../foo.html  
 URL in the browser. In this case, why would you start with a URL  
 without extension? I does not make any sense. Just use URL with  
 extension from the beginning.

lol, tell it my client.

The problem is when you do not do the rewrite you will end up to use
absolute urls for all images, css, etc. since the client browser will
interpret the / on the end as directory screwing up the relative
imports. Meaning you have either lots of test whether or not we have /
on the end or do a rewrite. 

 
 
   /map:match
   map:match pattern=**/*/
 map:redirect-to uri=../{2}.html /
   /map:match
 /map:match
 map:match pattern=**/*
   map:redirect-to uri={2}.html /
 /map:match
 map:match pattern=*
   map:redirect-to uri={1}.html /
 /map:match
   /map:match
 
 Regardless of comment above, what you got here is too verbose, you can  
 DRY it down using smarter match pattern. For example:
 
map:match pattern=^(?:[^.\/]*\/)*([^.\/]+)\/$
  map:redirect-to uri=../{1}.html/
/map:match
map:match pattern=^(?:[^.\/]*\/)*([^.\/]+)$
  map:redirect-to uri={1}.html/
/map:match
 

Hmm, sorry but the above is not working for me.

 
  One side effect is that the app is now way slower if you use
  extensionless requests. In our application we need the extensions to
  trigger the correct pipelines, which I consider the normal usage of
  cocoon. By redirecting the request one is causing more processing on  
  the
  app which explains the higher response time.
 
 You probably mean more round trips. I don't see any extra processing  
 on the app.

Yeah, I meant more round trips.

Thanks for your feedback.

salu2

 
 Vadim
 
 
  That makes me wonder whether extension less requests makes sense at  
  all
  in a multi-output-format environment.
 
  WDYT?
 
  salu2
  -- 
  Thorsten Scherler  
  thorsten.at.apache.org
  Open Source Java  consulting, training and  
  solutions
 
-- 
Thorsten Scherler thorsten.at.apache.org
Open Source Java  consulting, training and solutions



Re: Url without extensions - how to match/rewrite

2007-12-07 Thread Vadim Gritsenko


On Dec 7, 2007, at 7:44 AM, Thorsten Scherler wrote:


I tried with the regexp matcher but could not found any pattern that
matches the documents WITHOUT extensions


^[^.]+$

http://jakarta.apache.org/regexp/applet.html

Vadim


Re: Url without extensions - how to match/rewrite

2007-12-07 Thread Dev at weitling
Hi Thorsten,

I'm not sure if I caught your problem completely, but what about
handling every request as html as long as there is no known extension, e.g.

map:match pattern=*.jpg...

map:match pattern=*.gif...

map:match pattern=*...

Important is that the *-matcher comes last. Or just write your own
matcher :-)

Bye,
Florian



Thorsten Scherler wrote:
 Hi all,

 my current client wants to navigate their website without extensions.

 Meaning they want to use something like:
 http://www.apache.org/dev/version-control

 instead of
 http://www.apache.org/dev/version-control.html

 The above example is working fine thanks to the httpd servers
 content-negotiation [1], but is this possible in cocoon without
 implementing every single match for every single page?

 I tried with the regexp matcher but could not found any pattern that
 matches the documents WITHOUT extensions to then map:redirect-to
 uri=cocoon://{1}.html/.

 Did somebody implemented something similar or is it just not feasible
 with cocoon matches?

 TIA for any feedback. 

 salu2

 [1] http://httpd.apache.org/docs/1.3/content-negotiation.html
   


Url without extensions - how to match/rewrite

2007-12-07 Thread Thorsten Scherler
Hi all,

my current client wants to navigate their website without extensions.

Meaning they want to use something like:
http://www.apache.org/dev/version-control

instead of
http://www.apache.org/dev/version-control.html

The above example is working fine thanks to the httpd servers
content-negotiation [1], but is this possible in cocoon without
implementing every single match for every single page?

I tried with the regexp matcher but could not found any pattern that
matches the documents WITHOUT extensions to then map:redirect-to
uri=cocoon://{1}.html/.

Did somebody implemented something similar or is it just not feasible
with cocoon matches?

TIA for any feedback. 

salu2

[1] http://httpd.apache.org/docs/1.3/content-negotiation.html
-- 
Thorsten Scherler thorsten.at.apache.org
Open Source Java  consulting, training and solutions