You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/07/03 22:42:33 UTC

DO NOT REPLY [Bug 51468] New: Redirect Valve

https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

             Bug #: 51468
           Summary: Redirect Valve
           Product: Tomcat 7
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: ushakov@int.com.ru
    Classification: Unclassified


Hi, I've got Jens' code ( see
https://issues.apache.org/bugzilla/show_bug.cgi?id=14766 ) completed and
working. My implementation uses Java regex for matching the URLs to redirect
and regex capturing groups for substitutions into redirection URLs.

This sort of functionality looks quite demanded, and googling shows several
in-house implementations of Redirect Valves existing out there...

Is my implementation of any interest to the project? If yes, what are my next
steps?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #3 from Sergey Ushakov <us...@int.com.ru> 2011-07-04 03:25:36 UTC ---
Created attachment 27247
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27247
The .properties file in English

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #10 from Christopher Schultz <ch...@christopherschultz.net> 2011-07-05 22:33:53 UTC ---
(In reply to comment #9)
> (In reply to comment #8)
> > Tomcat 7 can use Filters at the container level. Configure them just as you
> > configure Valves, except that you use <Filter> instead of <Valve>.
> 
> Where did that come from? It is news to me.

I thought filters could be configured in <Context> elements in
META-INF/context.xml, hence the (slight) push to re-write Valves as Filters so
they would be more portable.

> I am struggling to see the benefit of this Valve compared to the urlrewrite,
> particularly given the features that urlrewrite has compared to this patch.

I completely agree.

I'm sure it would be useful for /some/ people to incorporate all kinds of
things from other projects into Tomcat, but it's not really appropriate if they
already exist, are well-known, and well-supported.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #9 from Mark Thomas <ma...@apache.org> 2011-07-05 21:54:52 UTC ---
(In reply to comment #8)
> Tomcat 7 can use Filters at the container level. Configure them just as you
> configure Valves, except that you use <Filter> instead of <Valve>.

Where did that come from? It is news to me.

Filters can be defined in the global web.xml, the host level web.xml or an
app's web.xml (although you do get one instance per application).

I am struggling to see the benefit of this Valve compared to the urlrewrite,
particularly given the features that urlrewrite has compared to this patch.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #12 from Sergey Ushakov <us...@int.com.ru> 2011-07-06 22:31:04 UTC ---
Just one more word regarding reluctance to incorporate existing mature
functionality into Tomcat.

I would personally be happy to use UrlRewrite for the mentioned tasks if this
filter gets the Valve interface implemented one day... Or maybe gets a wrapper
to implement the Valve interface...

But can we expect this? There may be a potential obstacle on that way that
Filter is a standard and container-independent concept, while Valve is specific
for Tomcat...

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #4 from Sergey Ushakov <us...@int.com.ru> 2011-07-04 03:26:16 UTC ---
Created attachment 27248
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27248
The .properties file in Russian

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #6 from Christopher Schultz <ch...@christopherschultz.net> 2011-07-05 14:45:04 UTC ---
A few questions:

1. Why a Valve and not a Filter?
2. Why not use urlrewrite like everyone else?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #7 from Sergey Ushakov <us...@int.com.ru> 2011-07-05 20:54:22 UTC ---
(In reply to comment #6)

Well, there is nothing wrong about UrlRewriteFilter except it is a filter :) 
It looks perfect and mature, but it is good for webapp-level tasks rather than
container-level tasks.

A filter being a part of a webapp belongs to the responsibility of a developer,
while there may be quite a variety of redirection tasks that belong to the
administration domain. So one of the motivations for a valve is separation of
responsibilities of a developer and an administrator.

Another motivation is that there may be quite a lot of various redirection
tasks common for different webapps at a server, which might be better taken
care of in a centralized manner with a valve...

Regards,
Sergey

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #8 from Christopher Schultz <ch...@christopherschultz.net> 2011-07-05 21:50:20 UTC ---
(In reply to comment #7)
> Well, there is nothing wrong about UrlRewriteFilter except it is a filter :) 
> It looks perfect and mature, but it is good for webapp-level tasks rather than
> container-level tasks.

Tomcat 7 can use Filters at the container level. Configure them just as you
configure Valves, except that you use <Filter> instead of <Valve>.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #11 from Sergey Ushakov <us...@int.com.ru> 2011-07-06 04:41:47 UTC ---
(In reply to comment #9)
> I am struggling to see the benefit of this Valve compared to the urlrewrite,
> particularly given the features that urlrewrite has compared to this patch.

Well, let's consider a task of mapping/redirecting a Tomcat app to a virtual
directory at a front-end server.

To start with, it is an administrative task, not a developer's one, so the
app's WEB-INF does not look the right place to set it up. The server admin is
not likely to be happy tinkering with the war file or the unpacked folder every
time the developer issues a new version of the app.

The next place to consider for a filter is the the global web.xml or host-level
web.xml. This is likely to do the job, but the fact that the appropriate filter
is going to be instantiated in multiple useless copies for every app, makes the
whole construct strange-looking too.

So a valve looks the most straightforward approach to do the job...

(In reply to comment #10)
> I'm sure it would be useful for /some/ people to incorporate all kinds of
> things from other projects into Tomcat, but it's not really appropriate if they
> already exist, are well-known, and well-supported.

Well, to my mind it's not incorporating existing functionality from other
projects into Tomcat, but rather adding something new and missing. This first
implementation maybe does not look great, but it may eventually get more flesh,
as new requirements get outlined by the practice...

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

Sergey Ushakov <us...@int.com.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ushakov@int.com.ru

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #2 from Sergey Ushakov <us...@int.com.ru> 2011-07-04 03:24:28 UTC ---
Created attachment 27246
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27246
A proposed implementation for a Redirect valve

The main code of the proposed valve implementation.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #1 from Pid <bu...@pidster.com> 2011-07-03 21:38:59 UTC ---
Create a patch and attach it to the bug, if someone takes an interest in it, it
might get committed.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #13 from Christopher Schultz <ch...@christopherschultz.net> 2011-07-07 03:28:22 UTC ---
(In reply to comment #12)
> Just one more word regarding reluctance to incorporate existing mature
> functionality into Tomcat.
> 
> I would personally be happy to use UrlRewrite for the mentioned tasks if this
> filter gets the Valve interface implemented one day... Or maybe gets a wrapper
> to implement the Valve interface...

I'd honestly be happy if my earlier assertion that <Filter> could be used in
place of a <Valve> were true. I'll look into what that would take to
accomplish. Maybe a Valve implementation wrapper around the Filter interface.

That shouldn't actually be that hard, honestly. I'll look into it.

Let's move this discussion onto the dev list and out of BZ.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51468] Redirect Valve

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51468

--- Comment #5 from Sergey Ushakov <us...@int.com.ru> 2011-07-04 03:27:09 UTC ---
Comment on attachment 27247
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27247
The .properties file in English

To be merged with the corresponding properties file in the existing package.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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