Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x

This commit is contained in:
Jan Bartel 2016-07-20 12:33:39 +10:00
commit 6de88fcee9
10 changed files with 96 additions and 3 deletions

View File

@ -18,3 +18,5 @@ for the tests to all pass successfully.
Bypass tests by building with -Dmaven.test.skip=true but note
that this will not produce some test jars that are leveraged
in other places in the build.
See also README.md

View File

@ -33,8 +33,9 @@ Documentation
Project documentation is located on our Eclipse website.
- [http://www.eclipse.org/jetty/documentation](http://www.eclipse.org/jetty/documentation)
- README.TXT
Professional Services
---------------------
Expert advice and production support are available through [http://webtide.com](Webtide.com).
Expert advice and production support are available through [Webtide.com](http://webtide.com).

View File

@ -19,6 +19,8 @@
package org.eclipse.jetty.osgi.boot;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
@ -326,7 +328,16 @@ public class OSGiWebInfConfiguration extends WebInfConfiguration
+ "'");
}
url = BundleFileLocatorHelperFactory.getFactory().getHelper().getLocalURL(url);
URI uri;
try
{
uri = url.toURI();
}
catch (URISyntaxException e)
{
uri = new URI(url.toString().replaceAll(" ", "%20"));
}
String key = resourcePath.startsWith("/") ? resourcePath.substring(1) : resourcePath;
resourceMap.put(key + ";" + fragment.getSymbolicName(), Resource.newResource(url));
resourceMap.put(key + ";" + fragment.getSymbolicName(), Resource.newResource(uri));
}
}

View File

@ -25,6 +25,7 @@
<module>jetty-osgi-httpservice</module>
<module>test-jetty-osgi-webapp</module>
<module>test-jetty-osgi-context</module>
<module>test-jetty-osgi-fragment</module>
<module>jetty-osgi-alpn</module>
<module>test-jetty-osgi</module>
</modules>

View File

@ -0,0 +1,49 @@
<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">
<parent>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>jetty-osgi-project</artifactId>
<version>9.3.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-jetty-osgi-fragment</artifactId>
<name>Jetty :: OSGi :: WebApp Fragment</name>
<description>Test Jetty OSGi Webapp Fragment bundle</description>
<url>http://www.eclipse.org/jetty</url>
<properties>
<bundle-symbolic-name>${project.groupId}.webapp.fragment</bundle-symbolic-name>
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<!-- DO NOT DEPLOY (or Release) -->
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${bundle-symbolic-name}</Bundle-SymbolicName>
<Bundle-Name>Jetty OSGi Test WebApp Fragment</Bundle-Name>
<Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
<Fragment-Host>org.eclipse.jetty.tests.test-spec-webapp</Fragment-Host>
<Jetty-WarFragmentFolderPath>/</Jetty-WarFragmentFolderPath>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,5 @@
<html>
<body>
<h1>FRAGMENT</h1>
</body>
</html>

View File

@ -362,6 +362,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.osgi</groupId>
<artifactId>test-jetty-osgi-fragment</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-mock-resources</artifactId>

View File

@ -36,6 +36,7 @@ import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.options.extra.WorkingDirectoryOption;
import org.osgi.framework.BundleContext;
import static org.junit.Assert.assertEquals;
@ -76,6 +77,7 @@ public class TestJettyOSGiBootWithAnnotations
// options.addAll(TestJettyOSGiBootCore.consoleDependencies());
options.addAll(jspDependencies());
options.addAll(annotationDependencies());
options.add(mavenBundle().groupId("org.eclipse.jetty.osgi").artifactId("test-jetty-osgi-fragment").versionAsInProject().noStart());
return options.toArray(new Option[options.size()]);
}
@ -157,6 +159,10 @@ public class TestJettyOSGiBootWithAnnotations
response = req.send();
content = new String(response.getContent());
assertTrue(content.contains("<p><b>Result: <span class=\"pass\">PASS</span></p>"));
response = client.GET("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_HTTP_PORT + "/frag.html");
content = new String(response.getContent());
assertTrue(content.contains("<h1>FRAGMENT</h1>"));
}
finally
{

View File

@ -985,7 +985,7 @@ public class Response implements HttpServletResponse
if (isIncluding() || isWriting())
return;
if (_outputType == OutputType.NONE && !isCommitted())
if (_outputType != OutputType.WRITER && !isCommitted())
{
if (encoding == null)
{

View File

@ -359,6 +359,17 @@ public class ResponseTest
assertEquals("text/xml;charset=utf-8", response.getContentType());
response.setCharacterEncoding("iso-8859-1");
assertEquals("text/xml;charset=utf-8", response.getContentType());
response.recycle();
response.setCharacterEncoding("utf-16");
response.setContentType("foo/bar");
assertEquals("foo/bar;charset=utf-16", response.getContentType());
response.getOutputStream();
response.setCharacterEncoding("utf-8");
assertEquals("foo/bar;charset=utf-8", response.getContentType());
response.flushBuffer();
response.setCharacterEncoding("utf-16");
assertEquals("foo/bar;charset=utf-8", response.getContentType());
}
@Test