cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject Re: C2: Patch for BrowserSelectorFactory and Proxies
Date Wed, 22 Nov 2000 12:41:12 GMT
Carsten,
Patched. Can you please cross-check.

Thanks,
dims

--- Carsten Ziegeler <cziegeler@sundn.de> wrote:
> Hi,
> 
> the included Patch adds the "Vary" header to the response with the value "User-Agent"
if the
> BrowserSelectorFactory is used.
> The "Vary" is needed as Proxies usually cache files regardless of the user agent. But
if the
> selector is used, the result might differ for different user agents.
> 
> Regards
> Carsten Ziegeler
> 
> Open Source Group              sunShine - Lighting up e:Business
> ================================================================
> Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
> www.sundn.de                           mailto:cziegeler@sundn.de 
> ================================================================
> > Index: BrowserSelectorFactory.java
> ===================================================================
> RCS file:
> /home/cvspublic/xml-cocoon/src/org/apache/cocoon/selection/Attic/BrowserSelectorFactory.java,v
> retrieving revision 1.1.2.11
> diff -u -r1.1.2.11 BrowserSelectorFactory.java
> --- BrowserSelectorFactory.java	2000/10/30 23:02:46	1.1.2.11
> +++ BrowserSelectorFactory.java	2000/11/22 09:40:48
> @@ -73,6 +73,8 @@
>           sb.append("if (pattern != null && objectModel.get(Cocoon.REQUEST_OBJECT)
!= null) {")
>            .append("javax.servlet.http.HttpServletRequest request =
> (javax.servlet.http.HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT);")
>            .append("String userAgent = request.getHeader(\"User-Agent\");")
> +          .append("javax.servlet.http.HttpServletResponse response =
> (javax.servlet.http.HttpServletResponse) objectModel.get(Cocoon.RESPONSE_OBJECT);")
> +          .append("response.addHeader(\"Vary\", \"User-Agent\");")
>  	  .append("for (int i = 0; i < pattern.length; i++) {")
>            .append("if (userAgent.indexOf(pattern[i]) != -1) return true;}");
>          return sb.append("} return false;").toString();
> 


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/

Mime
View raw message