Issue #737
This commit is contained in:
parent
5afbcd4c6a
commit
9f825dadef
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
<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>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-webapp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<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.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>artifact-jar</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-jar</id>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
</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>
|
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
<h1>FRAGMENT</h1>
|
||||
</body>
|
||||
</html>
|
|
@ -372,6 +372,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>
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue