commit 0a046e1d8747f987c0510f501b4d70124d9a0732
Author: Michal Srb <msrb(a)redhat.com>
Date: Wed Sep 3 15:04:15 2014 +0200
Initial import
.gitignore | 1 +
0001-Remove-AJP-support.patch | 35 ++++++++++++++
0002-Fix-Java-8-compatibility.patch | 87 +++++++++++++++++++++++++++++++++++
jenkins-winstone.spec | 75 ++++++++++++++++++++++++++++++
sources | 1 +
5 files changed, 199 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..9fa9a68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/winstone-2.3.tar.gz
diff --git a/0001-Remove-AJP-support.patch b/0001-Remove-AJP-support.patch
new file mode 100644
index 0000000..eb8bc01
--- /dev/null
+++ b/0001-Remove-AJP-support.patch
@@ -0,0 +1,35 @@
+From 6b232dc0844cf389d61a4dad54474207428acc27 Mon Sep 17 00:00:00 2001
+From: Michal Srb <msrb(a)redhat.com>
+Date: Tue, 2 Sep 2014 04:59:31 +0200
+Subject: [PATCH 1/2] Remove AJP support
+
+---
+ src/java/winstone/Launcher.java | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/src/java/winstone/Launcher.java b/src/java/winstone/Launcher.java
+index aacce18..e2217a7 100644
+--- a/src/java/winstone/Launcher.java
++++ b/src/java/winstone/Launcher.java
+@@ -48,7 +48,6 @@ public class Launcher implements Runnable {
+
+ static final String HTTP_LISTENER_CLASS =
"winstone.HttpConnectorFactory";
+ static final String HTTPS_LISTENER_CLASS =
"winstone.HttpsConnectorFactory";
+- static final String AJP_LISTENER_CLASS =
"winstone.Ajp13ConnectorFactory";
+
+ public static final byte SHUTDOWN_TYPE = (byte) '0';
+ public static final byte RELOAD_TYPE = (byte) '4';
+@@ -143,9 +142,8 @@ public class Launcher implements Runnable {
+ this.hostGroup = new HostGroup(server, commonLibCL,
+ commonLibCLPaths.toArray(new File[0]), args);
+
+- // Create connectors (http, https and ajp)
++ // Create connectors (http, https)
+ spawnListener(HTTP_LISTENER_CLASS);
+- spawnListener(AJP_LISTENER_CLASS);
+ spawnListener(HTTPS_LISTENER_CLASS);
+
+ server.setThreadPool(new ExecutorThreadPool(threadPool));
+--
+1.9.3
+
diff --git a/0002-Fix-Java-8-compatibility.patch b/0002-Fix-Java-8-compatibility.patch
new file mode 100644
index 0000000..37c9fcd
--- /dev/null
+++ b/0002-Fix-Java-8-compatibility.patch
@@ -0,0 +1,87 @@
+From e0768719adcd2896b0fdf8184dd1e577f3f1bcd2 Mon Sep 17 00:00:00 2001
+From: Michal Srb <msrb(a)redhat.com>
+Date: Tue, 2 Sep 2014 05:02:59 +0200
+Subject: [PATCH 2/2] Fix Java 8 compatibility
+
+---
+ src/java/winstone/HttpsConnectorFactory.java | 34 ++++++++++++++++++++--------
+ 1 file changed, 25 insertions(+), 9 deletions(-)
+
+diff --git a/src/java/winstone/HttpsConnectorFactory.java
b/src/java/winstone/HttpsConnectorFactory.java
+index af747a6..403efe3 100644
+--- a/src/java/winstone/HttpsConnectorFactory.java
++++ b/src/java/winstone/HttpsConnectorFactory.java
+@@ -11,14 +11,15 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector;
+ import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
+ import org.eclipse.jetty.util.B64Code;
+ import org.eclipse.jetty.util.ssl.SslContextFactory;
++
+ import sun.security.util.DerInputStream;
+ import sun.security.util.DerValue;
+-import sun.security.x509.CertAndKeyGen;
+ import sun.security.x509.X500Name;
+ import winstone.cmdline.Option;
+
+ import javax.net.ssl.KeyManagerFactory;
+ import javax.net.ssl.SSLContext;
++
+ import java.io.BufferedReader;
+ import java.io.ByteArrayOutputStream;
+ import java.io.File;
+@@ -26,6 +27,9 @@ import java.io.FileInputStream;
+ import java.io.FileReader;
+ import java.io.IOException;
+ import java.io.Reader;
++import java.lang.reflect.Constructor;
++import java.lang.reflect.InvocationTargetException;
++import java.lang.reflect.Method;
+ import java.math.BigInteger;
+ import java.security.GeneralSecurityException;
+ import java.security.KeyFactory;
+@@ -36,6 +40,7 @@ import java.security.cert.CertificateFactory;
+ import java.security.cert.X509Certificate;
+ import java.security.spec.RSAPrivateKeySpec;
+ import java.text.MessageFormat;
++import java.util.Date;
+ import java.util.Enumeration;
+ import java.util.Map;
+
+@@ -98,16 +103,27 @@ public class HttpsConnectorFactory implements ConnectorFactory {
+ this.password = "changeit".toCharArray();
+ System.out.println("Using one-time self-signed certificate");
+
+- CertAndKeyGen ckg = new CertAndKeyGen("RSA",
"SHA1WithRSA", null);
+- ckg.generate(1024);
+- PrivateKey privKey = ckg.getPrivateKey();
++ try {
++ Class<?> clazz =
Class.forName("sun.security.tools.keytool.CertAndKeyGen");
++ Constructor<?> constructor =
clazz.getConstructor(String.class, String.class, String.class);
+
+- X500Name xn = new X500Name("Test site", "Unknown",
"Unknown", "Unknown");
+- X509Certificate cert = ckg.getSelfCertificate(xn, 3650L * 24 * 60 *
60);
++ Object ckg = constructor.newInstance("RSA",
"SHA1WithRSA", null);
+
+- keystore = KeyStore.getInstance("JKS");
+- keystore.load(null);
+- keystore.setKeyEntry("hudson", privKey, password, new
Certificate[]{cert});
++ Method generateMethod =
clazz.getDeclaredMethod("generate", int.class);
++ Method getPrivateKeyMethod =
clazz.getDeclaredMethod("getPrivateKey");
++ Method getSelfCertificateMethod =
clazz.getDeclaredMethod("getSelfCertificate", X500Name.class, Date.class,
long.class);
++ generateMethod.invoke(ckg, 1024);
++ PrivateKey privKey = (PrivateKey) getPrivateKeyMethod.invoke(ckg);
++
++ X500Name xn = new X500Name("Test site",
"Unknown", "Unknown", "Unknown");
++ X509Certificate cert = (X509Certificate)
getSelfCertificateMethod.invoke(ckg, xn, 3650L * 24 * 60 * 60);
++
++ keystore = KeyStore.getInstance("JKS");
++ keystore.load(null);
++ keystore.setKeyEntry("hudson", privKey, password, new
Certificate[] { cert });
++ } catch (ReflectiveOperationException e) {
++ throw new GeneralSecurityException(e);
++ }
+ }
+ } catch (GeneralSecurityException e) {
+ throw (IOException)new IOException("Failed to handle
keys").initCause(e);
+--
+1.9.3
+
diff --git a/jenkins-winstone.spec b/jenkins-winstone.spec
new file mode 100644
index 0000000..e27b47b
--- /dev/null
+++ b/jenkins-winstone.spec
@@ -0,0 +1,75 @@
+%global shortname winstone
+
+Name: jenkins-winstone
+Version: 2.3
+Release: 1%{?dist}
+Summary: Jenkins Winstone servlet container
+
+License: LGPLv2+ or CDDL
+URL:
https://github.com/jenkinsci/winstone
+Source0:
https://github.com/jenkinsci/%{shortname}/archive/%{shortname}-%{version}...
+
+# missing dep jetty-ajp
+Patch0: 0001-Remove-AJP-support.patch
+# make it work with Java 8
+Patch1: 0002-Fix-Java-8-compatibility.patch
+
+BuildArch: noarch
+
+BuildRequires: maven-local
+BuildRequires: mvn(org.eclipse.jetty:jetty-servlet:8.1.14.v20131031)
+
+%description
+Winstone is a servlet container that was written out of a desire to
+provide servlet functionality without the bloat that full J2EE
+compliance introduces.
+
+%package javadoc
+Summary: Javadoc for %{name}
+
+%description javadoc
+This package contains the API documentation for %{name}.
+
+
+%prep
+%setup -q -n %{shortname}-%{shortname}-%{version}
+
+%patch0 -p1
+%patch1 -p1
+
+# we don't need support for AJP (and we don't have jetty-ajp)
+rm src/java/winstone/Ajp13ConnectorFactory.java
+%pom_remove_dep org.eclipse.jetty:jetty-ajp
+
+# no support for SPDY
+%pom_remove_dep org.eclipse.jetty.spdy:spdy-jetty-http
+
+# build with jetty 8
+%pom_change_dep org.eclipse.jetty: ::8.1.14.v20131031
+
+%pom_remove_plugin :maven-antrun-plugin
+%pom_remove_plugin :maven-shade-plugin
+
+# utf8 ftw
+for file in LICENSE-CDDL.txt LICENSE-LGPL.txt; do
+ iconv --from-code=ISO-8859-1 --to-code=UTF-8 ${file} > ${file}.utf8
+ mv ${file}.utf8 ${file}
+done
+
+%build
+# missing test dep org.kohsuke:ajp-client
+%mvn_build -f
+
+%install
+%mvn_install
+
+%files -f .mfiles
+%dir %{_javadir}/%{name}
+%doc LICENSE-CDDL.txt LICENSE-LGPL.txt
+%files javadoc -f .mfiles-javadoc
+%doc LICENSE-CDDL.txt LICENSE-LGPL.txt
+
+%changelog
+* Tue Sep 02 2014 Michal Srb <msrb(a)redhat.com> - 2.3-1
+- Initial packaging
+
diff --git a/sources b/sources
index e69de29..8ae7e90 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+31774c424d072b18b2e6159cc38fbbab winstone-2.3.tar.gz