Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BB1A09885 for ; Tue, 24 Jan 2012 14:13:03 +0000 (UTC) Received: (qmail 11711 invoked by uid 500); 24 Jan 2012 14:13:03 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 11644 invoked by uid 500); 24 Jan 2012 14:13:03 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 11635 invoked by uid 99); 24 Jan 2012 14:13:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2012 14:13:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2012 14:13:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E4177238889B for ; Tue, 24 Jan 2012 14:12:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1235259 [2/2] - in /directory/apacheds/trunk: core-jndi/src/main/java/org/apache/directory/server/core/jndi/ core-jndi/src/test/java/org/apache/directory/server/core/jndi/ core-shared/src/main/java/org/apache/directory/server/core/shared/ ... Date: Tue, 24 Jan 2012 14:12:40 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120124141241.E4177238889B@eris.apache.org> Modified: directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java?rev=1235259&r1=1235258&r2=1235259&view=diff ============================================================================== --- directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java (original) +++ directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java Tue Jan 24 14:12:39 2012 @@ -75,16 +75,16 @@ public class HttpServer /** Transport for http */ private TcpTransport httpTransport = null; - + /** Transport for https */ private TcpTransport httpsTransport = null; - + /** protocol identifier for http */ public static final String HTTP_TRANSPORT_ID = "http"; - + /** protocol identifier for https */ public static final String HTTPS_TRANSPORT_ID = "https"; - + /** an internal flag to check the server configuration */ private boolean configured = false; @@ -92,6 +92,7 @@ public class HttpServer private DirectoryService dirService; + public HttpServer() { } @@ -105,7 +106,7 @@ public class HttpServer public void start( DirectoryService dirService ) throws Exception { this.dirService = dirService; - + XmlConfiguration jettyConf = null; if ( confFile != null ) @@ -135,16 +136,16 @@ public class HttpServer if ( configured ) { Handler[] handlers = jetty.getHandlers(); - - for( Handler h : handlers ) + + for ( Handler h : handlers ) { - if( h instanceof ContextHandler ) + if ( h instanceof ContextHandler ) { ContextHandler ch = ( ContextHandler ) h; ch.setAttribute( HttpDirectoryService.KEY, new HttpDirectoryService( dirService ) ); } } - + LOG.info( "starting jetty http server" ); jetty.start(); } @@ -178,26 +179,28 @@ public class HttpServer // load the admin entry to get the private key and certificate Dn adminDn = dirService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN ); Entry adminEntry = dirService.getAdminSession().lookup( adminDn, "*", "+" ); - + File confDir = dirService.getInstanceLayout().getConfDirectory(); File ksFile = new File( confDir, "httpserver.generated.ks" ); - + String password = UUID.randomUUID().toString(); - + KeyStore ks = KeyStore.getInstance( KeyStore.getDefaultType() ); ks.load( null, null ); - + X509CertParser parser = new X509CertParser(); - - parser.engineInit( new ByteArrayInputStream( adminEntry.get( TlsKeyGenerator.USER_CERTIFICATE_AT ).getBytes() ) ); - + + parser.engineInit( new ByteArrayInputStream( adminEntry.get( TlsKeyGenerator.USER_CERTIFICATE_AT ) + .getBytes() ) ); + X509Certificate cert = ( X509Certificate ) parser.engineRead(); - + ks.setCertificateEntry( "cert", cert ); - + KeyPair keyPair = TlsKeyGenerator.getKeyPair( adminEntry ); - ks.setKeyEntry( "privatekey", keyPair.getPrivate(), password.toCharArray(), new Certificate[]{ cert } ); - + ks.setKeyEntry( "privatekey", keyPair.getPrivate(), password.toCharArray(), new Certificate[] + { cert } ); + OutputStream stream = new FileOutputStream( ksFile ); ks.store( stream, password.toCharArray() ); @@ -208,10 +211,10 @@ public class HttpServer httpsConnector.setKeystore( ksFile.getAbsolutePath() ); httpsConnector.setPassword( password ); httpsConnector.setKeyPassword( password ); - + jetty.addConnector( httpsConnector ); } - + List handlers = new ArrayList(); for ( WebApp w : webApps ) { @@ -219,46 +222,46 @@ public class HttpServer webapp.setWar( w.getWarFile() ); webapp.setContextPath( w.getContextPath() ); handlers.add( webapp ); - + webapp.setParentLoaderPriority( true ); } // add web apps from the webapps directory inside directory service's working directory // the exploded or archived wars File webAppDir = new File( dirService.getInstanceLayout().getInstanceDirectory(), "webapps" ); - + FilenameFilter webAppFilter = new FilenameFilter() { - + public boolean accept( File dir, String name ) { return name.endsWith( ".war" ); } }; - + if ( webAppDir.exists() ) { File[] appList = webAppDir.listFiles( webAppFilter ); - for( File app : appList ) + for ( File app : appList ) { WebAppContext webapp = new WebAppContext(); webapp.setWar( app.getAbsolutePath() ); String ctxName = app.getName(); int pos = ctxName.indexOf( '.' ); - if( pos > 0 ) + if ( pos > 0 ) { ctxName = ctxName.substring( 0, pos ); } - + webapp.setContextPath( "/" + ctxName ); handlers.add( webapp ); - + webapp.setParentLoaderPriority( true ); } } - - jetty.setHandlers( handlers.toArray( new Handler[ handlers.size() ] ) ); - + + jetty.setHandlers( handlers.toArray( new Handler[handlers.size()] ) ); + configured = true; } catch ( Exception e ) Modified: directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/WebApp.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/WebApp.java?rev=1235259&r1=1235258&r2=1235259&view=diff ============================================================================== --- directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/WebApp.java (original) +++ directory/apacheds/trunk/http-integration/src/main/java/org/apache/directory/server/integration/http/WebApp.java Tue Jan 24 14:12:39 2012 @@ -20,6 +20,7 @@ package org.apache.directory.server.integration.http; + import java.io.File; @@ -46,13 +47,13 @@ public class WebApp public String getContextPath() { - if( contextPath != null ) + if ( contextPath != null ) { return contextPath; } - + String fileName = new File( warFile ).getName(); - + return fileName.substring( 0, fileName.lastIndexOf( '.' ) ); } Modified: directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=1235259&r1=1235258&r2=1235259&view=diff ============================================================================== --- directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java (original) +++ directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java Tue Jan 24 14:12:39 2012 @@ -759,7 +759,7 @@ public enum I18n ERR_723("ERR_723"), ERR_724("ERR_724"), ERR_725("ERR_725"), - ERR_726_FILE_UNDELETABLE( "ERR_726_FILE_UNDELETABLE" ), + ERR_726_FILE_UNDELETABLE("ERR_726_FILE_UNDELETABLE"), ERR_727("ERR_727"), ERR_728("ERR_728"), ERR_729("ERR_729"), @@ -784,9 +784,9 @@ public enum I18n ERR_748("ERR_748"), ERR_749("ERR_749"), ERR_750("ERR_750"); - + private static ResourceBundle errBundle = ResourceBundle - .getBundle( "org.apache.directory.server.i18n.errors" ); + .getBundle( "org.apache.directory.server.i18n.errors" ); private final static ResourceBundle msgBundle = ResourceBundle .getBundle( "org/apache/directory/server/i18n/messages" );