cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <ovi...@cup.hp.com>
Subject Re: [PATCH] browser database capabilities
Date Mon, 30 Oct 2000 01:49:33 GMT
All right, I'll try to do it for C2 too.

Thanks,
Ovidiu

On Sun, 29 Oct 2000 16:23:50 -0800 (PST), Davanum Srinivas <dims@yahoo.com> 
wrote:

> Yes, I am interested in this :) (Assuming this is for C2).
> 
> Thanks,
> dims
> --- Ovidiu Predescu <ovidiu@cup.hp.com> wrote:
> > The following patch extends the browser support in Cocoon 1.x, adding the
> > ability to detect the browser type using the Accept: header, in addition to the
> > User-agent: header. This way WAP browsers not described by their user-agent
> > still work correctly as long as they send the text/vnd.wap.wml MIME type in the
> > Accept: header.
> > 
> > In addition to this, browser descriptions have been moved out of
> > cocoon.properties into an XML file, which is intended to hierarchically
> > describe browsers and their capabilities. Currently the browser description is
> > very WAP-oriented, however new browsers can be described easily. A particular
> > browser description is passed as an argument to the XSLT processor so that
> > decisions based on it can be taken at the time of page generation.
> > 
> > The XML browser capabilities file is translated at compile time into a Java
> > class. The class can be dynamically reloaded at runtime when the XML file
> > changes; I don't plan support for this feature in C1, in C2 things seem to be a
> > easier.
> > 
> > The browser capabilities database is an important piece of the WML support, as
> > determining what features are available on a device is currently impossible.
> > The CC/PP standard will take some time to be implemented by various vendors and
> > until then this seems to be the only reasonable way to implement it. I plan to
> > extend the current support with a way to determine changing of dynamic features
> > in the browser (like Java(Script) enabled/disabled, accept/disallow fax receive
> > on cell phones etc.).
> > 
> > I believe this is a good feature to have, is anybody interested in having it?
> > 
> > Regards,
> > Ovidiu
> > 
> > -- 
> > Ovidiu Predescu <ovidiu@cup.hp.com>
> > http://orion.nsr.hp.com/ (inside HP's firewall only)
> > http://www.geocities.com/SiliconValley/Monitor/7464/
> > 
> > > diff -ruN -x TAGS -x *docs* -x *CVS* -x .cvsignore -x *.jar Cocoon.orig/build.xml
> > cocoon/build.xml
> > --- Cocoon.orig/build.xml	Wed Sep 27 16:32:22 2000
> > +++ cocoon/build.xml	Tue Oct 24 20:38:00 2000
> > @@ -267,9 +267,22 @@
> >    </target>
> >  
> >    <!-- =================================================================== -->
> > +  <!-- Generate the Java code from XML using XSLT                          -->
> > +  <!-- =================================================================== -->
> > +  <target name="generate-java-code">
> > +    <delete dir="${build.src}/org/apache/cocoon/browser"
> > +	    includes="Browser.java"/>
> > +    <style basedir="${src.dir}/org/apache/cocoon/browser"
> > +	   destdir="${build.src}/org/apache/cocoon/browser"
> > +	   includes="Browser.xml"
> > +	   extension=".java"
> > +	   style="Browser.xsl"/>
> > +  </target>
> > +
> > +  <!-- =================================================================== -->
> >    <!-- Compiles the source directory                                       -->
> >    <!-- =================================================================== -->
> > -  <target name="compile" depends="prepare-src">
> > +  <target name="compile" depends="prepare-src, generate-java-code">
> >      <javac srcdir="${build.src}"
> >             destdir="${build.dest}"
> >             debug="${debug}"
> > diff -ruN -x TAGS -x *docs* -x *CVS* -x .cvsignore -x *.jar
> > Cocoon.orig/src/org/apache/cocoon/Browsers.java cocoon/src/org/apache/cocoon/Browsers.java
> > --- Cocoon.orig/src/org/apache/cocoon/Browsers.java	Sun Feb 13 10:29:16 2000
> > +++ cocoon/src/org/apache/cocoon/Browsers.java	Tue Oct 24 20:38:04 2000
> > @@ -1,124 +0,0 @@
> > -/*-- $Id: Browsers.java,v 1.4 2000/02/13 18:29:16 stefano Exp $ -- 
> > -
> > - ============================================================================
> > -                   The Apache Software License, Version 1.1
> > - ============================================================================
> > - 
> > - Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
> > - 
> > - Redistribution and use in source and binary forms, with or without modifica-
> > - tion, are permitted provided that the following conditions are met:
> > - 
> > - 1. Redistributions of  source code must  retain the above copyright  notice,
> > -    this list of conditions and the following disclaimer.
> > - 
> > - 2. Redistributions in binary form must reproduce the above copyright notice,
> > -    this list of conditions and the following disclaimer in the documentation
> > -    and/or other materials provided with the distribution.
> > - 
> > - 3. The end-user documentation included with the redistribution, if any, must
> > -    include  the following  acknowledgment:  "This product includes  software
> > -    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
> > -    Alternately, this  acknowledgment may  appear in the software itself,  if
> > -    and wherever such third-party acknowledgments normally appear.
> > - 
> > - 4. The names "Cocoon" and  "Apache Software Foundation"  must not be used to
> > -    endorse  or promote  products derived  from this  software without  prior
> > -    written permission. For written permission, please contact
> > -    apache@apache.org.
> > - 
> > - 5. Products  derived from this software may not  be called "Apache", nor may
> > -    "Apache" appear  in their name,  without prior written permission  of the
> > -    Apache Software Foundation.
> > - 
> > - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
> > - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> > - FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
> > - APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
> > - INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
> > - DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
> > - OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
> > - ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
> > - (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
> > - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > - 
> > - This software  consists of voluntary contributions made  by many individuals
> > - on  behalf of the Apache Software  Foundation and was  originally created by
> > - Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache

> > - Software Foundation, please see <http://www.apache.org/>.
> > - 
> > - */
> > -package org.apache.cocoon;
> > -
> > -import java.util.*;
> > -import org.apache.cocoon.framework.*;
> > -
> > -/**
> > - * This inner class is used to store the mapping between browser names
> > - * and those signature fragments used for mapping.
> > - *
> > - * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
> > - * @version $Revision: 1.4 $ $Date: 2000/02/13 18:29:16 $
> > - */
> > -
> > -public class Browsers extends Vector implements Configurable, Status {
> > -
> > -    /**
> > -     * Inner class that contains single browser information.
> > -     */
> > -    public class Browser {
> > -
> > -        public String name;
> > -        public String signature;
> > -
> > -        public Browser(String name, String signature) {
> > -            this.name = name;
> > -            this.signature = signature;
> > -        }
> > -
> > -        public String toString() {
> > -            return "( " + name + ", " + signature + " )";
> > -        }
> > -    }
> > -
> > -    /**
> > -     * Initialize the map with the mapping rules.
> > -     */
> > -    public void init(Configurations conf) throws InitializationException {
> > -        for (int i = 0; ; i++) {
> > -            String filter = (String) conf.get(Integer.toString(i));
> > -            if (filter == null) break;
> > -            int index = filter.indexOf('=');
> > -            this.addElement(new Browser(filter.substring(0, index), filter.subs
> > tring(index + 1)));
> > -        }
> > -    }
> > -
> > -    /**
> > -     * This method maps the "user-Agent" request parameter to a browser name
> > -     * following the search rules defined in the servlet properties.
> > -     */
> > -    public String map(String agent) {
> > -        try {
> > -            for (int i = 0;; i++) {
> > -                Browser b = (Browser) this.elementAt(i);
> > -                int index = agent.indexOf(b.signature);
> > -                if (index > -1) return b.name;
> > -            }
> > -        } catch (Exception e) {
> > -            return "unknown";
> > -        }
> > -    }
> > -
> > -    public String getStatus() {
> > -        StringBuffer buffer = new StringBuffer();
> > -
> > -        for (int i = 0; i < this.size(); i++) {
> > -            Browser b = (Browser) this.elementAt(i);
> > -            buffer.append("<li>");
> > -            buffer.append(b.toString());
> > -            buffer.append("</li>");
> > -        }
> > -
> > -        return buffer.toString();
> > -    }
> > -}
> > \ No newline at end of file
> > diff -ruN -x TAGS -x *docs* -x *CVS* -x .cvsignore -x *.jar
> > Cocoon.orig/src/org/apache/cocoon/Engine.java cocoon/src/org/apache/cocoon/Engine.java
> > --- Cocoon.orig/src/org/apache/cocoon/Engine.java	Sun Oct 15 15:43:13 2000
> > +++ cocoon/src/org/apache/cocoon/Engine.java	Tue Oct 24 20:40:37 2000
> > @@ -95,7 +95,7 @@
> >      InterpreterFactory interpreters;
> >  
> >      Manager manager;
> > -    Browsers browsers;
> > +    Browser browsers;
> >      Parser parser;
> >      Transformer transformer;
> >      Cache cache;
> > @@ -136,22 +136,22 @@
> >          manager.setRole("logger", logger);
> >  
> >          // Create the parser and register it
> > -        parser = (Parser) manager.create(getConfigTr(PARSER_PROP,
> > +        parser = (Parser) manager.create((String) configurations.get(PARSER_PROP,
> >              PARSER_DEFAULT), configurations.getConfigurations(PARSER_PROP));
> >          manager.setRole("parser", parser);
> >  
> >          // Create the transformer and register it
> > -        transformer = (Transformer) manager.create(getConfigTr(TRANSFORMER_PROP,
> > +        transformer = (Transformer) manager.create((String)
> > configurations.get(TRANSFORMER_PROP,
> >              TRANSFORMER_DEFAULT), configurations.getConfigurations(TRANSFORMER_PROP));
> >          manager.setRole("transformer", transformer);
> >  
> >          // Create the store and register it
> > -        store = (Store) manager.create(getConfigTr(STORE_PROP,
> > +        store = (Store) manager.create((String) configurations.get(STORE_PROP,
> >              STORE_DEFAULT), configurations.getConfigurations(STORE_PROP));
> >          manager.setRole("store", store);
> >  
> >          // Create the cache and register it
> > -        cache = (Cache) manager.create(getConfigTr(CACHE_PROP,
> > +        cache = (Cache) manager.create((String) configurations.get(CACHE_PROP,
> >              CACHE_DEFAULT), configurations.getConfigurations(CACHE_PROP));
> >          manager.setRole("cache", cache);
> >  
> > @@ -167,6 +167,10 @@
> > 
> === message truncated ===
> 
> 
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Messenger - Talk while you surf!  It's FREE.
> http://im.yahoo.com/
> 



Mime
View raw message