avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy Resources.properties AbstractHttpProxyServer.java DefaultHttpFilteringProxyServer.java HttpAuditingProxyHandler.java HttpFilteringProxyHandler.java HttpProxyHandler.java
Date Sat, 20 Apr 2002 11:37:23 GMT
colus       02/04/20 04:37:23

  Modified:    httpproxy/src/java/org/apache/avalon/httpproxy
                        AbstractHttpProxyServer.java
                        DefaultHttpFilteringProxyServer.java
                        HttpAuditingProxyHandler.java
                        HttpFilteringProxyHandler.java
                        HttpProxyHandler.java
  Added:       httpproxy/src/java/org/apache/avalon/httpproxy
                        Resources.properties
  Log:
  prepare i18n.
  
  Revision  Changes    Path
  1.4       +10 -4     jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/AbstractHttpProxyServer.java
  
  Index: AbstractHttpProxyServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/AbstractHttpProxyServer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractHttpProxyServer.java	20 Apr 2002 08:45:46 -0000	1.3
  +++ AbstractHttpProxyServer.java	20 Apr 2002 11:37:23 -0000	1.4
  @@ -20,6 +20,8 @@
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.phoenix.Block;
   import org.apache.avalon.phoenix.BlockContext;
   import org.apache.avalon.phoenix.Service;
  @@ -38,6 +40,9 @@
       implements Block, Contextualizable, Composable, Configurable, Service,
       Initializable, ConnectionHandlerFactory
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( AbstractHttpProxyServer.class );
  +
       protected SocketManager m_socketManager;
       protected ConnectionManager m_connectionManager;
   
  @@ -79,8 +84,6 @@
       public void compose( final ComponentManager componentManager )
           throws ComponentException
       {
  -        getLogger().debug( "HttpProxyServer-" + m_name + ".compose()" );
  -
           m_socketManager = (SocketManager)componentManager.
               lookup( "org.apache.avalon.cornerstone.services.sockets.SocketManager" );
   
  @@ -98,8 +101,11 @@
           m_connectionManager.connect( "HttpProxyListener-" + m_name, serverSocket, this
);
   
           // This is only to help newbies.....
  -        System.out.println( getShortName() + " HTTP Proxy server running.  Configure your
browser to proxy through localhost:" + m_port + " to use it" );
  -
  +        if ( getLogger().isInfoEnabled() )
  +        {
  +            final String message = REZ.getString( "server.notice.ready", getShortName(),
new Integer( m_port ) );
  +            getLogger().info( message );
  +        }
       }
   
       protected abstract String getShortName();
  
  
  
  1.4       +17 -2     jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/DefaultHttpFilteringProxyServer.java
  
  Index: DefaultHttpFilteringProxyServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/DefaultHttpFilteringProxyServer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultHttpFilteringProxyServer.java	20 Apr 2002 08:45:46 -0000	1.3
  +++ DefaultHttpFilteringProxyServer.java	20 Apr 2002 11:37:23 -0000	1.4
  @@ -10,6 +10,8 @@
   import java.util.HashSet;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   
   /**
    * @author <a href="Paul_Hammant@yahoo.com">Paul Hammant</a>
  @@ -19,6 +21,9 @@
       extends AbstractHttpProxyServer
       implements HttpFilteringProxyServer
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( DefaultHttpFilteringProxyServer.class );
  +
       // a site may be x.y.z.p.p.hello.com, only check the last two and three parts
       protected HashSet m_blockedTwoPartDomains = new HashSet();
       protected HashSet m_blockedThreePartDomains = new HashSet();
  @@ -137,7 +142,12 @@
                                onOff,
                                m_blockedTwoPartDomains,
                                m_blockedThreePartDomains );
  -        getLogger().debug( "blockAllContentFrom " + domainName );
  +
  +        if ( getLogger().isDebugEnabled() )
  +        {
  +            final String message = REZ.getString( "filtering.notice.allow-cookies", domainName
);
  +            getLogger().debug( message );
  +        }
       }
   
       public void allowCookiesFrom( final String domainName,
  @@ -147,7 +157,12 @@
                                onOff,
                                m_cookiesAllowedForTwoPartDomains,
                                m_cookiesAllowedForThreePartDomains );
  -        getLogger().debug( "allowCookiesFrom " + domainName );
  +
  +        if ( getLogger().isDebugEnabled() )
  +        {
  +            final String message = REZ.getString( "filtering.notice.allow-cookies", domainName
);
  +            getLogger().debug( message );
  +        }
       }
   
       private void addOrRemoveFromList( String domainName,
  
  
  
  1.4       +11 -1     jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/HttpAuditingProxyHandler.java
  
  Index: HttpAuditingProxyHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/HttpAuditingProxyHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpAuditingProxyHandler.java	20 Apr 2002 08:45:46 -0000	1.3
  +++ HttpAuditingProxyHandler.java	20 Apr 2002 11:37:23 -0000	1.4
  @@ -7,6 +7,9 @@
    */
   package org.apache.avalon.httpproxy;
   
  +import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +
   
   /**
    * This handles an individual incoming request. It outputs a greeting as html.
  @@ -17,6 +20,9 @@
   public class HttpAuditingProxyHandler
       extends HttpProxyHandler
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( HttpAuditingProxyHandler.class );
  +
       protected HttpAuditingProxyHandler( final String forwardToAnotherProxy )
       {
           super( forwardToAnotherProxy );
  @@ -26,7 +32,11 @@
           throws HttpRequestValidationException
       {
           // no validate, just log.
  -        getLogger().info( "Connection to " + m_httpRequestWrapper.getURL() );
  +        if ( getLogger().isInfoEnabled() )
  +        {
  +            final String message = REZ.getString( "auditing.notice.validate", m_httpRequestWrapper.getURL()
);
  +            getLogger().info( message );
  +        }
       }
   }
   
  
  
  
  1.3       +8 -2      jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/HttpFilteringProxyHandler.java
  
  Index: HttpFilteringProxyHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/HttpFilteringProxyHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpFilteringProxyHandler.java	20 Apr 2002 08:45:46 -0000	1.2
  +++ HttpFilteringProxyHandler.java	20 Apr 2002 11:37:23 -0000	1.3
  @@ -9,6 +9,8 @@
   
   import java.net.URL;
   import java.util.StringTokenizer;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
  +import org.apache.avalon.excalibur.i18n.Resources;
   
   /**
    * This handles an individual incoming request.  It outputs a greeting as html.
  @@ -19,6 +21,9 @@
   public class HttpFilteringProxyHandler
       extends HttpProxyHandler
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( HttpFilteringProxyHandler.class );
  +
       // used for callbacks
       protected HttpFilteringProxyServer m_proxyServer;
   
  @@ -92,13 +97,14 @@
           {
               final String line = rqstTokens.nextToken();
   
  -            if ( !line.startsWith( "Cookie:" ) )
  +            if ( ! line.startsWith( "Cookie:" ) )
               {
                   newHttpRequest.append( line ).append( "\r\n" );
               }
               else
               {
  -                getLogger().info( "Cookie supressed for url :" + url.toString() );
  +                final String message = REZ.getString( "filtering.notice.cookie-supressed",
url );
  +                getLogger().info( message );
               }
           }
   
  
  
  
  1.3       +22 -7     jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/HttpProxyHandler.java
  
  Index: HttpProxyHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/HttpProxyHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpProxyHandler.java	20 Apr 2002 08:45:46 -0000	1.2
  +++ HttpProxyHandler.java	20 Apr 2002 11:37:23 -0000	1.3
  @@ -18,6 +18,8 @@
   import java.net.UnknownHostException;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
   
   /**
  @@ -30,6 +32,9 @@
       extends AbstractLogEnabled
       implements Component, ConnectionHandler
   {
  +    private static final Resources REZ =
  +        ResourceManager.getPackageResources( HttpProxyHandler.class );
  +
       protected Socket m_clientSocket;
       protected Socket m_serverSocket;
       protected String m_clientHost;
  @@ -68,23 +73,31 @@
           catch ( final HttpRequestValidationException hrve )
           {
               write403Page();
  -            getLogger().info( hrve.getMessage() );
  +
  +            if ( getLogger().isInfoEnabled() )
  +            {
  +                getLogger().info( hrve.getMessage() );
  +            }
           }
           catch ( final SocketException se )
           {
  -            getLogger().debug( "Socket to " + m_clientHost + " closed remotely.", se );
  +            final String message = REZ.getString( "handler.notice.closed-remotely", m_clientHost
);
  +            getLogger().debug( message, se );
           }
           catch ( final InterruptedIOException iioe )
           {
  -            getLogger().debug( "Socket to " + m_clientHost + " timeout.", iioe );
  +            final String message = REZ.getString( "handler.notice.timeout", m_clientHost
);
  +            getLogger().debug( message, iioe );
           }
           catch ( final IOException ioe )
           {
  -            getLogger().debug( "Exception in proxy handling socket to " + m_clientHost,
ioe );
  +            final String message = REZ.getString( "handler.error.handle", m_clientHost
);
  +            getLogger().debug( message, ioe );
           }
           catch ( final Exception e )
           {
  -            getLogger().debug( "Exception in proxy opening socket", e );
  +            final String message = REZ.getString( "handler.error.open", m_clientHost );
  +            getLogger().debug( message, e );
           }
           finally
           {
  @@ -94,7 +107,8 @@
               }
               catch ( final IOException ioe )
               {
  -                getLogger().error( "Exception closing client socket ", ioe );
  +                final String message = REZ.getString( "handler.error.close-client" );
  +                getLogger().error( message, ioe );
               }
   
               if ( null != m_serverSocket )
  @@ -105,7 +119,8 @@
                   }
                   catch ( final IOException ioe )
                   {
  -                    getLogger().error( "Exception closing server socket ", ioe );
  +                    final String message = REZ.getString( "handler.error.close-server"
);
  +                    getLogger().error( message, ioe );
                   }
               }
           }
  
  
  
  1.1                  jakarta-avalon-apps/httpproxy/src/java/org/apache/avalon/httpproxy/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  server.notice.ready={0} HTTP Proxy server running. Configure your browser to proxy through
localhost:{1} to use it.
  handler.notice.timeout=Connection to {0} timeout.
  handler.notice.closed-remotely=Connection to {0} closed remotely.
  handler.error.open=Exception in proxy opening socket to {0}.
  handler.error.handle=Exception in proxy handling socket to {0}.
  handler.error.close-server=Fail to close server socket.
  handler.error.close-client=Fail to close client socket.
  
  auditing.notice.validate=Connection to {0}.
  filtering.notice.block-content=Block all content from {0}.
  filtering.notice.allow-cookies=Allow cookies from {0}.
  filtering.notice.cookie-supressed=Cookie supressed for url {0}.
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message