WICKET-6194 - Undertow Impl / Javadoc / Project added to build

Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fd2ce6b3
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fd2ce6b3
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fd2ce6b3

Branch: refs/heads/master
Commit: fd2ce6b389e390e702e50a6ea213e2b05cd2fd28
Parents: c6952d0
Author: Tobias Soloschenko <[email protected]>
Authored: Sat Jul 9 06:24:43 2016 +0200
Committer: Tobias Soloschenko <[email protected]>
Committed: Sat Jul 9 06:30:41 2016 +0200

----------------------------------------------------------------------
 pom.xml                                         |  6 +++
 wicket-experimental/wicket-http2/pom.xml        |  1 +
 .../org/apache/wicket/http2/Http2Settings.java  | 45 ++++++++++++++++--
 .../http2/markup/head/NoopPushBuilder.java      | 22 ++++++++-
 .../wicket/http2/markup/head/PushBuilder.java   | 12 ++++-
 .../http2/markup/head/PushHeaderItem.java       | 11 +++--
 .../org/apache/wicket/http2/Initializer.java    |  9 +++-
 .../http2/markup/head/Jetty9PushBuilder.java    |  8 +++-
 .../org/apache/wicket/http2/Initializer.java    |  9 +++-
 .../http2/markup/head/Tomcat85PushBuilder.java  |  7 ++-
 .../wicket-http2/wicket-http2-undertow/pom.xml  | 48 ++++++++++++++++++++
 .../org/apache/wicket/http2/Initializer.java    | 46 +++++++++++++++++++
 .../http2/markup/head/UndertowPushBuilder.java  | 48 ++++++++++++++++++++
 .../services/org.apache.wicket.IInitializer     |  1 +
 14 files changed, 256 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 09cebb2..86a064c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -417,6 +417,12 @@
                                <type>jar</type>
                        </dependency>
                        <dependency>
+                               
<groupId>org.apache.wicket.experimental.wicket8</groupId>
+                               <artifactId>wicket-http2</artifactId>
+                               <version>0.1-SNAPSHOT</version>
+                               <type>jar</type>
+                       </dependency>
+                       <dependency>
                                <groupId>org.jboss.seam.conversation</groupId>
                                <artifactId>seam-conversation-spi</artifactId>
                                <version>3.0.0.Final</version>

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-http2/pom.xml 
b/wicket-experimental/wicket-http2/pom.xml
index 9f7f7fb..e13198e 100644
--- a/wicket-experimental/wicket-http2/pom.xml
+++ b/wicket-experimental/wicket-http2/pom.xml
@@ -35,5 +35,6 @@
                <module>wicket-http2-core</module>
                <module>wicket-http2-jetty</module>
                <module>wicket-http2-tomcat</module>
+               <module>wicket-http2-undertow</module>
        </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/Http2Settings.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/Http2Settings.java
 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/Http2Settings.java
index 4a161d7..08ba298 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/Http2Settings.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/Http2Settings.java
@@ -23,20 +23,33 @@ import org.apache.wicket.http2.markup.head.PushBuilder;
 import org.apache.wicket.util.lang.Args;
 
 /**
- *
+ * The http2 settings used to get the vendor specific push builder API
+ * 
+ * @author Martin Grigorov
  */
 public class Http2Settings
 {
+       /**
+        * The meta data key of the http2 settings
+        */
        private static final MetaDataKey<Http2Settings> KEY = new 
MetaDataKey<Http2Settings>()
        {
+               private static final long serialVersionUID = 1L;
        };
 
        /**
-        * Holds this Http2Settings in the Application's metadata.
-        * This way wicket-core module doesn't have reference to 
wicket-http2-core
+        * Holds this Http2Settings in the Application's meta data. This way 
wicket-core module doesn't
+        * have reference to wicket-http2-core
         */
        public static final class Holder
        {
+               /**
+                * Gets the http2 settings from the given application
+                * 
+                * @param application
+                *            the application to get the meta data from
+                * @return the http2 settings
+                */
                public static Http2Settings get(Application application)
                {
                        Http2Settings settings = application.getMetaData(KEY);
@@ -54,6 +67,14 @@ public class Http2Settings
                        return settings;
                }
 
+               /**
+                * Sets the given http2 settings to the given application
+                * 
+                * @param application
+                *            the application to set the meta data key to
+                * @param settings
+                *            the http2 settings to be set to the application
+                */
                public static void set(Application application, Http2Settings 
settings)
                {
                        application.setMetaData(KEY, settings);
@@ -62,12 +83,26 @@ public class Http2Settings
 
        private PushBuilder pushBuilder = NoopPushBuilder.INSTANCE;
 
-       public Http2Settings setPushBuilder(PushBuilder pushBuilder) {
+       /**
+        * Sets the push builder that has been initialized
+        * 
+        * @param pushBuilder
+        *            the push builder to be used after the initialization
+        * @return the push builder
+        */
+       public Http2Settings setPushBuilder(PushBuilder pushBuilder)
+       {
                this.pushBuilder = Args.notNull(pushBuilder, "pushBuilder");
                return this;
        }
 
-       public PushBuilder getPushBuilder() {
+       /**
+        * Gets the push builder which has been initialized
+        * 
+        * @return the push builder
+        */
+       public PushBuilder getPushBuilder()
+       {
                return pushBuilder;
        }
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/NoopPushBuilder.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/NoopPushBuilder.java
 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/NoopPushBuilder.java
index b2ddc82..eab6c02 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/NoopPushBuilder.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/NoopPushBuilder.java
@@ -22,20 +22,38 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
+ * The noop push builder is used to inform the dev to place in a vendor 
specific jar to support the
+ * push builder API
+ * 
+ * @author Martin Grigorov
  *
  */
 public class NoopPushBuilder implements PushBuilder
 {
        private static final Logger LOG = 
LoggerFactory.getLogger(NoopPushBuilder.class);
 
+       /**
+        * An instance of the push builder
+        */
        public static final NoopPushBuilder INSTANCE = new NoopPushBuilder();
 
+       /**
+        * Creates the noop push builder
+        */
        private NoopPushBuilder()
-       {}
+       {
+               // NOOP
+       }
 
+       /**
+        * Warns the dev to provide a vendor specific push builder API
+        * 
+        * @see {@link org.apache.wicket.http2.markup.head.PushBuilder}
+        */
        @Override
        public void push(HttpServletRequest httpServletRequest, String... paths)
        {
-               LOG.warn("This PushBuilder does nothing. Please use one of the 
other implementations - Jetty9 or Tomcat8.5+");
+               LOG.warn(
+                       "This PushBuilder does nothing. Please use one of the 
other implementations - Jetty9 or Tomcat8.5+");
        }
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushBuilder.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushBuilder.java
 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushBuilder.java
index 07f31b2..75a4fd9 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushBuilder.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushBuilder.java
@@ -19,9 +19,19 @@ package org.apache.wicket.http2.markup.head;
 import javax.servlet.http.HttpServletRequest;
 
 /**
- *
+ * Used to delegate the push call to the vendor specific push builder API
+ * 
+ * @author Martin Grigorov
  */
 public interface PushBuilder
 {
+       /**
+        * Pushes the given paths with the push builder received from the http 
servlet request
+        * 
+        * @param httpServletRequest
+        *            the http servlet request to get the push builder from
+        * @param paths
+        *            the paths of the resources to be pushed
+        */
        void push(HttpServletRequest httpServletRequest, String... paths);
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java
 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java
index a9f3602..5e88a2f 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-core/src/main/java/org/apache/wicket/http2/markup/head/PushHeaderItem.java
@@ -87,6 +87,7 @@ public class PushHeaderItem extends HeaderItem
                // Check if the protocol is http/2 or http/2.0 to only push the 
resources in this case
                if (isHttp2(request))
                {
+                       // Receives the vendor specific push builder
                        Http2Settings http2Settings = 
Http2Settings.Holder.get(Application.get());
                        PushBuilder pushBuilder = 
http2Settings.getPushBuilder();
                        pushBuilder.push(request, urls.toArray(new 
String[urls.size()]));
@@ -114,7 +115,7 @@ public class PushHeaderItem extends HeaderItem
                                if (object == null)
                                {
                                        throw new WicketRuntimeException(
-                                           "Please provide an object to the 
items to be pushed, so that the url can be created for the given resource.");
+                                               "Please provide an object to 
the items to be pushed, so that the url can be created for the given 
resource.");
                                }
 
                                CharSequence url = null;
@@ -183,8 +184,8 @@ public class PushHeaderItem extends HeaderItem
         * {@link WicketRuntimeException} is thrown.
         * 
         * @param request
-        *            the request to get the container request from. The 
container request is checked if it
-        *            is instance of {@link HttpServletRequest}
+        *            the request to get the container request from. The 
container request is checked if
+        *            it is instance of {@link HttpServletRequest}
         * @return the container request get from the given request casted to 
{@link HttpServletRequest}
         * @throw {@link WicketRuntimeException} if the container request is 
not a
         *        {@link HttpServletRequest}
@@ -195,8 +196,8 @@ public class PushHeaderItem extends HeaderItem
                if (!(assumedHttpServletRequest instanceof HttpServletRequest))
                {
                        throw new WicketRuntimeException(
-                           "The request is not a HttpServletRequest - the 
usage of PushHeaderItem is not support in the current environment: "
-                               + request.getClass().getName());
+                               "The request is not a HttpServletRequest - the 
usage of PushHeaderItem is not support in the current environment: " +
+                                       request.getClass().getName());
                }
                return (HttpServletRequest)assumedHttpServletRequest;
        }

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/Initializer.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/Initializer.java
 
b/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/Initializer.java
index 2defabe..b2886b1 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/Initializer.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/Initializer.java
@@ -21,10 +21,16 @@ import org.apache.wicket.IInitializer;
 import org.apache.wicket.http2.markup.head.Jetty9PushBuilder;
 
 /**
- *
+ * Initializes the jetty specific push builder API and makes it available 
through the http2
+ * settings
+ * 
+ * @author Martin Grigorov
  */
 public class Initializer implements IInitializer
 {
+       /**
+        * Initializes the push builder API of jetty
+        */
        @Override
        public void init(Application application)
        {
@@ -35,5 +41,6 @@ public class Initializer implements IInitializer
        @Override
        public void destroy(Application application)
        {
+               // NOOP
        }
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/markup/head/Jetty9PushBuilder.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/markup/head/Jetty9PushBuilder.java
 
b/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/markup/head/Jetty9PushBuilder.java
index ef6f1bf..f5d34cf 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/markup/head/Jetty9PushBuilder.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-jetty/src/main/java/org/apache/wicket/http2/markup/head/Jetty9PushBuilder.java
@@ -22,10 +22,16 @@ import org.apache.wicket.request.Request;
 import org.apache.wicket.request.cycle.RequestCycle;
 
 /**
- *
+ * Allows to push resources with the jetty specific push builder API
+ * 
+ * @author Martin Grigorov
+ * @author Tobias Soloschenko
  */
 public class Jetty9PushBuilder implements PushBuilder
 {
+       /**
+        * @see {@link org.apache.wicket.http2.markup.head.PushBuilder}
+        */
        @Override
        public void push(HttpServletRequest httpServletRequest, String... paths)
        {

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/Initializer.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/Initializer.java
 
b/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/Initializer.java
index b1ad6d7..9ba9ded 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/Initializer.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/Initializer.java
@@ -21,10 +21,16 @@ import org.apache.wicket.IInitializer;
 import org.apache.wicket.http2.markup.head.Tomcat85PushBuilder;
 
 /**
- *
+ * Initializes the tomcat specific push builder API and makes it available 
through the http2
+ * settings
+ * 
+ * @author Martin Grigorov
  */
 public class Initializer implements IInitializer
 {
+       /**
+        * Initializes the push builder API of tomcat
+        */
        @Override
        public void init(Application application)
        {
@@ -35,5 +41,6 @@ public class Initializer implements IInitializer
        @Override
        public void destroy(Application application)
        {
+               // NOOP
        }
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/markup/head/Tomcat85PushBuilder.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/markup/head/Tomcat85PushBuilder.java
 
b/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/markup/head/Tomcat85PushBuilder.java
index 1f1da5d..9a27c73 100644
--- 
a/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/markup/head/Tomcat85PushBuilder.java
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-tomcat/src/main/java/org/apache/wicket/http2/markup/head/Tomcat85PushBuilder.java
@@ -22,10 +22,15 @@ import org.apache.wicket.request.Request;
 import org.apache.wicket.request.cycle.RequestCycle;
 
 /**
- *
+ * Allows to push resources with the tomcat specific push builder API
+ * 
+ * @author Martin Grigorov
  */
 public class Tomcat85PushBuilder implements PushBuilder
 {
+       /**
+        * @see {@link org.apache.wicket.http2.markup.head.PushBuilder}
+        */
        @Override
        public void push(HttpServletRequest httpServletRequest, String... paths)
        {

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-undertow/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-http2/wicket-http2-undertow/pom.xml 
b/wicket-experimental/wicket-http2/wicket-http2-undertow/pom.xml
new file mode 100644
index 0000000..ba505d3
--- /dev/null
+++ b/wicket-experimental/wicket-http2/wicket-http2-undertow/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.apache.wicket.experimental.wicket8</groupId>
+               <artifactId>wicket-http2</artifactId>
+               <version>0.1-SNAPSHOT</version>
+               <relativePath>../pom.xml</relativePath>
+       </parent>
+       <artifactId>wicket-http2-undertow</artifactId>
+       <packaging>jar</packaging>
+       <name>Wicket Http/2 Tomcat 8.5+</name>
+       <description>
+               Wicket’s implementation to use the PushBuilder API
+               to serve resource via http/2 with less requests. This
+               is the Apache Tomcat 8.5+ implementation to resolve the 
PushBuilder API and
+               provide the IInitializer.
+       </description>
+       <dependencies>
+               <dependency>
+                       
<groupId>org.apache.wicket.experimental.wicket8</groupId>
+                       <artifactId>wicket-http2-core</artifactId>
+                       <version>0.1-SNAPSHOT</version>
+               </dependency>
+               <dependency>
+                   <groupId>io.undertow</groupId>
+                   <artifactId>undertow-servlet</artifactId>
+                   <version>2.0.0.Alpha1</version>
+                   <scope>provided</scope>
+               </dependency>
+       </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/Initializer.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/Initializer.java
 
b/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/Initializer.java
new file mode 100644
index 0000000..ae3eb51
--- /dev/null
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/Initializer.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.http2;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.IInitializer;
+import org.apache.wicket.http2.markup.head.UndertowPushBuilder;
+
+/**
+ * Initializes the undertow specific push builder API and makes it available 
through the http2
+ * settings
+ * 
+ * @author Tobias Soloschenko
+ */
+public class Initializer implements IInitializer
+{
+       /**
+        * Initializes the push builder API of undertow
+        */
+       @Override
+       public void init(Application application)
+       {
+               Http2Settings http2Settings = 
Http2Settings.Holder.get(application);
+               http2Settings.setPushBuilder(new UndertowPushBuilder());
+       }
+
+       @Override
+       public void destroy(Application application)
+       {
+               // NOOP
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/markup/head/UndertowPushBuilder.java
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/markup/head/UndertowPushBuilder.java
 
b/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/markup/head/UndertowPushBuilder.java
new file mode 100644
index 0000000..6f308fe
--- /dev/null
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/java/org/apache/wicket/http2/markup/head/UndertowPushBuilder.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.http2.markup.head;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.cycle.RequestCycle;
+
+/**
+ * Allows to push resources with the undertow specific push builder API
+ * 
+ * @author Tobias Soloschenko
+ */
+public class UndertowPushBuilder implements PushBuilder
+{
+       /**
+        * @see {@link org.apache.wicket.http2.markup.head.PushBuilder}
+        */
+       @Override
+       public void push(HttpServletRequest httpServletRequest, String... paths)
+       {
+               Request request = RequestCycle.get().getRequest();
+               HttpServletRequest httpRequest = (HttpServletRequest) 
request.getContainerRequest();
+               io.undertow.servlet.spec.HttpServletRequestImpl undertowRequest 
= (io.undertow.servlet.spec.HttpServletRequestImpl) httpRequest;
+               // Added explicit cast here to ensure this is the 
implementation of undertow
+               io.undertow.servlet.spec.PushBuilderImpl pushBuilder = 
(io.undertow.servlet.spec.PushBuilderImpl)undertowRequest.getPushBuilder();
+               for (String path : paths)
+               {
+                       pushBuilder.path(path);
+               }
+               pushBuilder.push();
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/fd2ce6b3/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/resources/META-INF/services/org.apache.wicket.IInitializer
----------------------------------------------------------------------
diff --git 
a/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/resources/META-INF/services/org.apache.wicket.IInitializer
 
b/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/resources/META-INF/services/org.apache.wicket.IInitializer
new file mode 100644
index 0000000..f721b3e
--- /dev/null
+++ 
b/wicket-experimental/wicket-http2/wicket-http2-undertow/src/main/resources/META-INF/services/org.apache.wicket.IInitializer
@@ -0,0 +1 @@
+org.apache.wicket.http2.Initializer

Reply via email to