Merge branch 'master' of ssh://git.eclipse.org/gitroot/jetty/org.eclipse.jetty.project

This commit is contained in:
Joakim Erdfelt 2015-04-28 15:28:49 -07:00
commit 8b41de3cb5
6 changed files with 10 additions and 262 deletions

View File

@ -1,103 +0,0 @@
<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.eclipse.jetty.dist</groupId>
<artifactId>dist-parent</artifactId>
<version>9.0.0-SNAPSHOT</version>
</parent>
<artifactId>jetty-deb</artifactId>
<name>Jetty :: Unix Distributions :: Debian</name>
<packaging>deb</packaging>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty.toolchain</groupId>
<artifactId>unix-maven-plugin</artifactId>
<version>1.0-alpha-6.1</version>
<extensions>true</extensions>
<configuration>
<contact>Jetty Project</contact>
<contactEmail>jetty-dev@eclipse.org</contactEmail>
<name>Core Jetty ${project.version} Distribution</name>
<description>Jetty provides an Web server and javax.servlet
container, plus support for Web Sockets, OSGi, JMX, JNDI,
JASPI, AJP and many other integrations. These components are
open source and available for commercial use and
distribution.</description>
<deb>
<useFakeroot>false</useFakeroot>
<priority>optional</priority>
<section>java</section>
</deb>
<packages>
<package>
<id>jetty-server</id>
<assembly>
<extractArtifact>
<artifact>org.eclipse.jetty:jetty-distribution:zip</artifact>
<to>/usr/share/jetty9</to>
<pattern>/jetty-distribution-${project.version}(.*)</pattern>
<replacement>$1</replacement>
<excludes>
<exclude>jetty-distribution-*/javadoc</exclude>
<exclude>jetty-distribution-*/javadoc/**</exclude>
<exclude>jetty-distribution-*/logs/**</exclude>
<exclude>jetty-distribution-*/bin/**</exclude>
<exclude>jetty-distribution-*/etc/**</exclude>
<exclude>jetty-distribution-*/webapps/**</exclude>
<exclude>jetty-distribution-*/*.html</exclude>
<exclude>jetty-distribution-*/*.txt</exclude>
</excludes>
</extractArtifact>
<extractArtifact>
<artifact>org.eclipse.jetty:jetty-distribution:zip</artifact>
<to>/usr/share/doc/jetty9</to>
<pattern>/jetty-distribution-${project.version}(.*)</pattern>
<replacement>$1</replacement>
<excludes>
<include>jetty-distribution-*/*.html</include>
<include>jetty-distribution-*/*.txt</include>
<exclude>jetty-distribution-*/**</exclude>
</excludes>
</extractArtifact>
<extractArtifact>
<artifact>org.eclipse.jetty:jetty-distribution:zip</artifact>
<to>/etc/jetty9</to>
<pattern>/jetty-distribution-${project.version}(.*)</pattern>
<replacement>$1</replacement>
<excludes>
<include>jetty-distribution-*/etc/**</include>
<!-- exclude>jetty-distribution-*/**</exclude-->
</excludes>
</extractArtifact>
</assembly>
</package>
<package>
<id>jetty-test-webapp</id>
<classifier>test-webapp</classifier>
<assembly>
<extractArtifact>
<artifact>org.eclipse.jetty:jetty-distribution:zip</artifact>
<to>/var/lib/jetty9/webapps</to>
<pattern>/jetty-distribution-${project.version}(.*)</pattern>
<replacement>$1</replacement>
<includes>
<include>jetty-distribution-*/webapps/**</include>
</includes>
</extractArtifact>
</assembly>
</package>
</packages>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-distribution</artifactId>
<version>${project.version}</version>
<type>zip</type>
</dependency>
</dependencies>
</project>

View File

@ -1,20 +0,0 @@
#!/bin/bash
LOG_DIR=/var/lib/jetty9/logs
WEBAPP_DIR=/var/lib/jetty9/webapps
# copy the jetty start script into place
cp /usr/share/jetty9/bin/jetty.sh /etc/init.d/jetty
# make it generally executable
chmod 755 /etc/init.d/jetty
# ensure we have a logging directory
if [ ! -d "$LOG_DIR" ]; then
mkdir $LOG_DIR
fi
# ensure we have a webapps directory
if [ ! -d "$WEBAPP_DIR" ]; then
mkdir $WEBAPP_DIR
fi

View File

@ -1,48 +0,0 @@
#!/bin/bash
#rm -f /etc/init.d/jetty
case "$1" in
purge)
[...]
# find first and last SYSTEM_UID numbers
for LINE in `grep SYSTEM_UID /etc/adduser.conf | grep -v "^#"`; do
case $LINE in
FIRST_SYSTEM_UID*)
FIST_SYSTEM_UID=`echo $LINE | cut -f2 -d '='`
;;
LAST_SYSTEM_UID*)
LAST_SYSTEM_UID=`echo $LINE | cut -f2 -d '='`
;;
*)
;;
esac
done
# Remove system account if necessary
CREATEDUSER="jetty"
if [ -n "$FIST_SYSTEM_UID" ] && [ -n "$LAST_SYSTEM_UID" ]; then
if USERID=`getent passwd $CREATEDUSER | cut -f 3 -d ':'`; then
if [ -n "$USERID" ]; then
if [ "$FIST_SYSTEM_UID" -le "$USERID" ] && \
[ "$USERID" -le "$LAST_SYSTEM_UID" ]; then
echo -n "Removing $CREATEDUSER system user.."
deluser --quiet $CREATEDUSER || true
echo "..done"
fi
fi
fi
fi
# Remove system group if necessary
CREATEDGROUP="jetty"
FIRST_USER_GID=`grep ^USERS_GID /etc/adduser.conf | cut -f2 -d '='`
if [ -n "$FIST_USER_GID" ] then
if GROUPGID=`getent group $CREATEDGROUP | cut -f 3 -d ':'`; then
if [ -n "$GROUPGID" ]; then
if [ "$FIST_USER_GID" -gt "$GROUPGID" ]; then
echo -n "Removing $CREATEDGROUP group.."
delgroup --only-if-empty $CREATEDGROUP || true
echo "..done"
fi
fi
fi
fi

View File

@ -1,61 +0,0 @@
#!/bin/bash
case "$1" in
install|upgrade)
# If the package has default file it could be sourced, so that
# the local admin can overwrite the defaults
[ -f "/etc/default/jetty9" ] && . /etc/default/jetty9
# Sane defaults:
[ -z "$SERVER_HOME" ] && SERVER_HOME=/usr/share/jetty9
[ -z "$SERVER_USER" ] && SERVER_USER=jetty
[ -z "$SERVER_NAME" ] && SERVER_NAME="Jetty-9 Http and Servlet Engine"
[ -z "$SERVER_GROUP" ] && SERVER_GROUP=jetty
# Groups that the user will be added to, if undefined, then none.
ADDGROUP=""
# create user to avoid running server as root
# 1. create group if not existing
if ! getent group | grep -q "^$SERVER_GROUP:" ; then
echo -n "Adding group $SERVER_GROUP.."
addgroup --quiet --system $SERVER_GROUP 2>/dev/null ||true
echo "..done"
fi
# 2. create homedir if not existing
test -d $SERVER_HOME || mkdir $SERVER_HOME
# 3. create user if not existing
if ! getent passwd | grep -q "^$SERVER_USER:"; then
echo -n "Adding system user $SERVER_USER.."
adduser --quiet \
--system \
--ingroup $SERVER_GROUP \
--no-create-home \
--disabled-password \
$SERVER_USER 2>/dev/null || true
echo "..done"
fi
# 4. adjust passwd entry
usermod -c "$SERVER_NAME" \
-d $SERVER_HOME \
-g $SERVER_GROUP \
$SERVER_USER
# 5. adjust file and directory permissions
if ! dpkg-statoverride --list $SERVER_HOME >/dev/null
then
chown -R $SERVER_USER:$SERVER_GROUP $SERVER_HOME
chmod u=rwx,g=rxs,o= $SERVER_HOME
fi
# 6. Add the user to the ADDGROUP group
if test -n $ADDGROUP
then
if ! groups $SERVER_USER | cut -d: -f2 | \
grep -qw $ADDGROUP; then
adduser $SERVER_USER $ADDGROUP
fi
fi
;;
configure)

View File

@ -1,26 +0,0 @@
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jetty-project</artifactId>
<groupId>org.eclipse.jetty</groupId>
<version>9.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.dist</groupId>
<artifactId>dist-parent</artifactId>
<packaging>pom</packaging>
<name>Jetty :: Distribution :: Parent</name>
<profiles>
<profile>
<id>linux-packaging</id>
<!-- activation>
<os>
<name>Linux</name>
</os>
</activation-->
<modules>
<module>jetty-deb</module>
<!--module>jetty-rpm</module-->
</modules>
</profile>
</profiles>
</project>

View File

@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Arrays;
import org.eclipse.jetty.server.HttpConfiguration;
@ -64,7 +65,12 @@ public class DataRateLimitedServletTest
context.setContextPath("/context");
context.setWelcomeFiles(new String[]{"index.html", "index.jsp", "index.htm"});
context.setBaseResource(Resource.newResource(testdir.getEmptyDir()));
File baseResourceDir = testdir.getEmptyDir();
// Use resolved real path for Windows and OSX
Path baseResourcePath = baseResourceDir.toPath().toRealPath();
context.setBaseResource(Resource.newResource(baseResourcePath.toFile()));
ServletHolder holder =context.addServlet(DataRateLimitedServlet.class,"/stream/*");
holder.setInitParameter("buffersize",""+BUFFER);
@ -106,9 +112,9 @@ public class DataRateLimitedServletTest
String response = connector.getResponses("GET /context/stream/content.txt HTTP/1.0\r\n\r\n");
long duration=System.currentTimeMillis()-start;
assertThat(response.length(),greaterThan(1024*1024));
assertThat(response,containsString("200 OK"));
assertThat(duration,greaterThan(PAUSE*1024L*1024/BUFFER));
assertThat("Response",response,containsString("200 OK"));
assertThat("Response Length",response.length(),greaterThan(1024*1024));
assertThat("Duration",duration,greaterThan(PAUSE*1024L*1024/BUFFER));
for (int i=0;i<10;i++)
assertThat(response,containsString(results[i]));