You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by cm...@apache.org on 2002/02/24 23:25:55 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/util Configuration.java

cmlenz      02/02/24 14:25:55

  Modified:    src/share/org/apache/slide/util Tag: SLIDE_1_0
                        Configuration.java
  Log:
  Porting bugfixes/enhancements from the HEAD branch:
  - Committed by juergen, 02/01/03 01:08:18
    "the default encoding for URLs can be set in slide.properties. If not set the
    default platform encoding is returned."
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +43 -17    jakarta-slide/src/share/org/apache/slide/util/Configuration.java
  
  Index: Configuration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/Configuration.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- Configuration.java	26 Sep 2000 02:44:28 -0000	1.4
  +++ Configuration.java	24 Feb 2002 22:25:55 -0000	1.4.2.1
  @@ -1,13 +1,13 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/Configuration.java,v 1.4 2000/09/26 02:44:28 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/09/26 02:44:28 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/Configuration.java,v 1.4.2.1 2002/02/24 22:25:55 cmlenz Exp $
  + * $Revision: 1.4.2.1 $
  + * $Date: 2002/02/24 22:25:55 $
    *
    * ====================================================================
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -15,7 +15,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    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
  @@ -23,15 +23,15 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution, if
  - *    any, must include the following acknowlegement:  
  - *       "This product includes software developed by the 
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowlegement may appear in the software itself,
    *    if and wherever such third-party acknowlegements normally appear.
    *
    * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
    *    Foundation" must not be used to endorse or promote products derived
  - *    from this software without prior written permission. For written 
  + *    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"
  @@ -59,7 +59,7 @@
    *
    * [Additional notices, if required by prior licensing conditions]
    *
  - */ 
  + */
   
   package org.apache.slide.util;
   
  @@ -85,14 +85,14 @@
    * configuration file and properties set in the Slide JAR, allowing for
    * each customization. All three files are named <tt>slide.properties</tt>.
    * <p>
  - * For example, to change the domain init file in use, create a new 
  - * configuration file in the current directory, instead of modifying 
  + * For example, to change the domain init file in use, create a new
  + * configuration file in the current directory, instead of modifying
    * the global one.
  - * 
  + *
    * @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
    * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.4 $ $Date: 2000/09/26 02:44:28 $
  + * @version $Revision: 1.4.2.1 $ $Date: 2002/02/24 22:25:55 $
    */
   public abstract class Configuration {
       
  @@ -115,7 +115,7 @@
            * org.apache.slide.domain
            * </pre>
            */
  -        public static final String DomainInitFilename = 
  +        public static final String DomainInitFilename =
               "org.apache.slide.domain";
           
           
  @@ -125,7 +125,7 @@
            * org.apache.slide.security
            * </pre>
            */
  -        public static final String IntegratedSecurity = 
  +        public static final String IntegratedSecurity =
               "org.apache.slide.security";
           
           
  @@ -139,6 +139,15 @@
           
           
           /**
  +         * Property specifying the encoding for URLs.
  +         * <pre>
  +         * org.apache.slide.urlEncoding
  +         * </pre>
  +         */
  +        public static final String UrlEncoding = "org.apache.slide.urlEncoding";
  +        
  +        
  +        /**
            * Property specifying whether to run in debug mode.
            * <pre>
            * org.apache.slide.debug
  @@ -156,7 +165,7 @@
           public static final String FileName = "slide.properties";
           
           
  -        static final String ResourceName = 
  +        static final String ResourceName =
               "/org/apache/slide/slide.properties";
           
       }
  @@ -189,6 +198,12 @@
       private static boolean _locking;
       
       
  +    /**
  +     * URL encoding.
  +     */
  +    private static String _urlEncoding;
  +    
  +    
       // ------------------------------------------------------------- Properties
       
       
  @@ -216,6 +231,14 @@
       }
       
       
  +    /**
  +     * Returns the used URL encoding.
  +     */
  +    public static String urlEncoding() {
  +        return _urlEncoding;
  +    }
  +    
  +    
       // ------------------------------------------------------------ Initializer
       
       
  @@ -286,7 +309,7 @@
           // Get overriding configuration from the classpath,
           // ignore if not found.
           try {
  -            is = Configuration.class.getResourceAsStream("/" 
  +            is = Configuration.class.getResourceAsStream("/"
                                                            + Property.FileName);
               if ( is != null ) {
                   _default = new Properties(_default);
  @@ -317,6 +340,9 @@
           } else {
               _locking = false;
           }
  +        
  +        String defaultEncoding = new java.io.InputStreamReader(System.in).getEncoding();
  +        _urlEncoding = _default.getProperty(Property.UrlEncoding, defaultEncoding);
           
       }
       
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>