Repository: wicket Updated Branches: refs/heads/master 936b0336d -> 397840df5
WICKET-6194 - Create a server specific http/2 push support Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/397840df Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/397840df Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/397840df Branch: refs/heads/master Commit: 397840df5ec94358f3205e7a38f5917a60a459c8 Parents: 936b033 Author: Tobias Soloschenko <[email protected]> Authored: Mon Aug 1 18:27:24 2016 +0200 Committer: Tobias Soloschenko <[email protected]> Committed: Mon Aug 1 18:27:24 2016 +0200 ---------------------------------------------------------------------- .../src/docs/guide/http2push/http2push_2.gdoc | 55 ++++++++++++++++++++ wicket-user-guide/src/docs/guide/toc.yml | 1 + 2 files changed, 56 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/397840df/wicket-user-guide/src/docs/guide/http2push/http2push_2.gdoc ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/docs/guide/http2push/http2push_2.gdoc b/wicket-user-guide/src/docs/guide/http2push/http2push_2.gdoc new file mode 100644 index 0000000..2e1999e --- /dev/null +++ b/wicket-user-guide/src/docs/guide/http2push/http2push_2.gdoc @@ -0,0 +1,55 @@ +To create a server specific http/2 push support of the Wicket PushBuilder API just follow these steps: + +1. Add the following dependency to your projects pom.xml (and of course adjust the version) +{code} +<dependency> + <groupId>org.apache.wicket.experimental.wicket8</groupId> + <artifactId>wicket-http2-core</artifactId> + <version>0.X-SNAPSHOT</version> +</dependency> +{code} + +2. Add a text file called "org.apache.wicket.IInitializer" into the folder src/main/resources/META-INF/services/ + +3. Add a single line with the name of the IInitializer class example: "org.apache.wicket.http2.Initializer" to the created file + +4. Implement your own server specific PushBuilder class which implements the interface "org.apache.wicket.http2.markup.head.PushBuilder". This is an example how it was done for jetty: +{code} +public class Jetty9PushBuilder implements PushBuilder +{ + @Override + public void push(HttpServletRequest httpServletRequest, String... paths) + { + Request request = RequestCycle.get().getRequest(); + HttpServletRequest httpRequest = (HttpServletRequest) request.getContainerRequest(); + org.eclipse.jetty.server.PushBuilder pushBuilder = org.eclipse.jetty.server.Request.getBaseRequest(httpRequest).getPushBuilder(); + for (String path : paths) + { + pushBuilder.path(path); + } + pushBuilder.push(); + } +} +{code} + +5. Implement the class within the package "org.apache.wicket.http2.Initializer" and add your own server specific PushBuilder class to the Http2Settings. This is an example how it was done for jetty: +{code} +public class Initializer implements IInitializer +{ + /** + * Initializes the push builder API of Jetty 9.3+ + */ + @Override + public void init(Application application) + { + Http2Settings http2Settings = Http2Settings.Holder.get(application); + http2Settings.setPushBuilder(new Jetty9PushBuilder()); + } + + @Override + public void destroy(Application application) + { + // NOOP + } +} +{code} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/wicket/blob/397840df/wicket-user-guide/src/docs/guide/toc.yml ---------------------------------------------------------------------- diff --git a/wicket-user-guide/src/docs/guide/toc.yml b/wicket-user-guide/src/docs/guide/toc.yml index d72fb3d..04951e1 100644 --- a/wicket-user-guide/src/docs/guide/toc.yml +++ b/wicket-user-guide/src/docs/guide/toc.yml @@ -218,6 +218,7 @@ lambdas: http2push: title: Wicket HTTP/2 Support (Experimental) http2push_1: Example Usage + http2push_2: Create server specific http/2 push support monitoring: title: Wicket Metrics Monitoring (Experimental) monitoring_1: Example setup
