Author: dashorst
Date: Tue Sep 13 19:49:24 2011
New Revision: 1170322

URL: http://svn.apache.org/viewvc?rev=1170322&view=rev
Log:
WICKET-4049
Enable SSL for quickstart to make debugging SSL errors easier

Added:
    
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/resources/
    
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/resources/keystore
   (with props)
Modified:
    
wicket/trunk/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
    
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
    
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/main/java/HomePage.html
    
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java

Modified: 
wicket/trunk/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
URL: 
http://svn.apache.org/viewvc/wicket/trunk/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml?rev=1170322&r1=1170321&r2=1170322&view=diff
==============================================================================
--- 
wicket/trunk/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
 (original)
+++ 
wicket/trunk/archetypes/quickstart/src/main/resources/META-INF/maven/archetype-metadata.xml
 Tue Sep 13 19:49:24 2011
@@ -14,6 +14,12 @@
                                <include>**/*.java</include>
                        </includes>
                </fileSet>
+               <fileSet filtered="false" packaged="false" encoding="UTF-8">
+                       <directory>src/test/resources</directory>
+                       <includes>
+                               <include>**/*</include>
+                       </includes>
+               </fileSet>
                <fileSet filtered="true" packaged="false" encoding="UTF-8">
                        <directory>src/main/resources</directory>
                        <includes>

Modified: 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
URL: 
http://svn.apache.org/viewvc/wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml?rev=1170322&r1=1170321&r2=1170322&view=diff
==============================================================================
--- 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
 (original)
+++ 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/pom.xml
 Tue Sep 13 19:49:24 2011
@@ -21,7 +21,7 @@
        </licenses>
        <properties>
                <wicket.version>1.5-SNAPSHOT</wicket.version>
-               <jetty.version>7.3.0.v20110203</jetty.version>
+               <jetty.version>7.5.0.v20110901</jetty.version>
        </properties>
        <dependencies>
                <!--  WICKET DEPENDENCIES -->
@@ -42,7 +42,7 @@
                <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
-                       <version>1.6.1</version>
+                       <version>1.6.2</version>
                </dependency>
                <dependency>
                        <groupId>log4j</groupId>
@@ -86,6 +86,10 @@
                <testResources>
                        <testResource>
                                <filtering>false</filtering>
+                               <directory>src/test/resources</directory>
+                       </testResource>
+                       <testResource>
+                               <filtering>false</filtering>
                                <directory>src/test/java</directory>
                                <includes>
                                        <include>**</include>

Modified: 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/main/java/HomePage.html
URL: 
http://svn.apache.org/viewvc/wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/main/java/HomePage.html?rev=1170322&r1=1170321&r2=1170322&view=diff
==============================================================================
--- 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/main/java/HomePage.html
 (original)
+++ 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/main/java/HomePage.html
 Tue Sep 13 19:49:24 2011
@@ -16,12 +16,17 @@
                <div id="bd">
                        <h2>Congratulations!</h2>
                        <p>
-                               Your quickstart works! This project is 
especially useful to
+                               Your quick start works! This project is 
especially useful to
                 start developing your Wicket application or to create a test
                 case for a bug report.
                        </p>
                        <h3>Get started</h3>
                        <p>
+                               If you started the quick start using the 
<tt>Start</tt> class
+                               from the <tt>src/test/java</tt> source folder, 
you can even
+                               <a href="https://localhost:8443";>switch to 
HTTPS</a>!
+                       </p> 
+                       <p>
                                From here you can start hacking away at your 
application and
                 wow your clients:
                        </p>

Modified: 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java?rev=1170322&r1=1170321&r2=1170322&view=diff
==============================================================================
--- 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java
 (original)
+++ 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/java/Start.java
 Tue Sep 13 19:49:24 2011
@@ -1,21 +1,52 @@
 package ${package};
 
-import org.eclipse.jetty.server.Connector;
+import org.apache.wicket.util.time.Duration;
+import org.eclipse.jetty.http.ssl.SslContextFactory;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.bio.SocketConnector;
+import org.eclipse.jetty.server.ssl.SslSocketConnector;
+import org.eclipse.jetty.util.resource.Resource;
 import org.eclipse.jetty.webapp.WebAppContext;
 
 public class Start {
+    public static void main(String[] args) throws Exception {
+        int timeout = (int) Duration.ONE_HOUR.getMilliseconds();
 
-       public static void main(String[] args) throws Exception {
         Server server = new Server();
         SocketConnector connector = new SocketConnector();
 
         // Set some timeout options to make debugging easier.
-        connector.setMaxIdleTime(1000 * 60 * 60);
+        connector.setMaxIdleTime(timeout);
         connector.setSoLingerTime(-1);
         connector.setPort(8080);
-        server.setConnectors(new Connector[] { connector });
+        server.addConnector(connector);
+
+               // check if a keystore for a SSL certificate is available, and
+               // if so, start a SSL connector on port 8443. By default, the
+               // quickstart comes with a Apache Wicket Quickstart Certificate
+               // that expires about half way september 2021. Do not use this
+               // certificate anywhere important as the passwords are available
+               // in the source.
+
+        Resource keystore = Resource.newClassPathResource("/keystore");
+        if (keystore != null && keystore.exists()) {
+            connector.setConfidentialPort(8443);
+
+            SslContextFactory factory = new SslContextFactory();
+            factory.setKeyStoreResource(keystore);
+            factory.setKeyStorePassword("wicket");
+            factory.setTrustStore(keystore);
+            factory.setKeyManagerPassword("wicket");
+            SslSocketConnector sslConnector = new SslSocketConnector(factory);
+            sslConnector.setMaxIdleTime(timeout);
+            sslConnector.setPort(8443);
+            sslConnector.setAcceptors(4);
+            server.addConnector(sslConnector);
+
+            System.out.println("SSL access to the quickstart has been enabled 
on port 8443");
+            System.out.println("You can access the application using SSL on 
https://localhost:8443";);
+            System.out.println();
+        }
 
         WebAppContext bb = new WebAppContext();
         bb.setServer(server);
@@ -35,14 +66,11 @@ public class Start {
             server.start();
             System.in.read();
             System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
-            // while (System.in.available() == 0) {
-            //   Thread.sleep(5000);
-            // }
             server.stop();
             server.join();
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(100);
+            System.exit(1);
         }
-       }
+    }
 }

Added: 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/resources/keystore
URL: 
http://svn.apache.org/viewvc/wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/resources/keystore?rev=1170322&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
wicket/trunk/archetypes/quickstart/src/main/resources/archetype-resources/src/test/resources/keystore
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to