-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workaround for a missing 'Resource' implementation with a no-arg …
…constructor Signed-off-by: Steffen Nießing <[email protected]>
- Loading branch information
Showing
4 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. | ||
This program and the accompanying materials are made available under the | ||
terms of the Eclipse Public License v. 2.0, which is available at | ||
http://www.eclipse.org/legal/epl-2.0. | ||
This Source Code may also be made available under the following Secondary | ||
Licenses when the conditions for such availability set forth in the | ||
Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
version 2 with the GNU Classpath Exception, which is available at | ||
https://www.gnu.org/software/classpath/license.html. | ||
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.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"> | ||
<parent> | ||
<artifactId>project</artifactId> | ||
<groupId>org.glassfish.jersey.tests.integration</groupId> | ||
<version>3.1.99-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>test-utils</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-util</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
73 changes: 73 additions & 0 deletions
73
...-utils/src/main/java/org/glassfish/jersey/tests/integration/utils/JerseyPathResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package org.glassfish.jersey.tests.integration.utils; | ||
|
||
import org.eclipse.jetty.util.resource.Resource; | ||
|
||
import java.io.File; | ||
import java.net.URI; | ||
import java.nio.file.Path; | ||
|
||
/** | ||
* A {@link Resource} implementation with a default constructor to support using it in Maven {@code implementation} attributes. | ||
* This is obsolete from Jetty >12.0.0.beta3. | ||
* | ||
* TODO: remove this | ||
*/ | ||
public class JerseyPathResource extends Resource { | ||
private String path; | ||
|
||
@Override | ||
public Path getPath() { | ||
return new File(path).toPath(); | ||
} | ||
|
||
@Override | ||
public boolean isContainedIn(Resource r) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isDirectory() { | ||
return new File(path).isDirectory(); | ||
} | ||
|
||
@Override | ||
public boolean isReadable() { | ||
return new File(path).canRead(); | ||
} | ||
|
||
@Override | ||
public URI getURI() { | ||
return new File(path).toURI(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return path; | ||
} | ||
|
||
@Override | ||
public String getFileName() { | ||
return path; | ||
} | ||
|
||
@Override | ||
public Resource resolve(String subUriPath) { | ||
return null; | ||
} | ||
} |