Skip to content

Commit aa779fa

Browse files
committed
Address deprecations
1 parent f00ed20 commit aa779fa

File tree

34 files changed

+213
-208
lines changed

34 files changed

+213
-208
lines changed

apps/openliberty/src/main/java/org/trellisldp/openliberty/WebApplication.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import jakarta.annotation.PostConstruct;
2222
import jakarta.enterprise.context.ApplicationScoped;
23-
import jakarta.inject.Inject;
2423
import jakarta.ws.rs.ApplicationPath;
2524
import jakarta.ws.rs.core.Application;
2625

@@ -32,26 +31,17 @@
3231
/**
3332
* Web Application wrapper.
3433
*/
35-
@ApplicationPath("/")
34+
@ApplicationPath("trellis")
3635
@ApplicationScoped
3736
public class WebApplication extends Application {
3837

39-
@Inject
40-
private TrellisHttpResource httpResource;
41-
42-
@Inject
43-
private TrellisHttpFilter httpFilter;
44-
45-
@Inject
46-
private CacheControlFilter cacheFilter;
47-
4838
@PostConstruct
4939
void init() {
5040
printBanner("Trellis Triplestore Application", "org/trellisldp/app/banner.txt");
5141
}
5242

5343
@Override
54-
public Set<Object> getSingletons() {
55-
return new HashSet<>(asList(httpResource, httpFilter, cacheFilter));
44+
public Set<Class<?>> getClasses() {
45+
return new HashSet<>(asList(TrellisHttpResource.class, TrellisHttpFilter.class, CacheControlFilter.class));
5646
}
5747
}

apps/openliberty/src/test/java/org/trellisldp/openliberty/TrellisApplicationIT.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,22 @@
2121

2222
import jakarta.ws.rs.client.Client;
2323

24-
import org.junit.jupiter.api.DisplayName;
25-
import org.junit.jupiter.api.Nested;
2624
import org.junit.jupiter.api.TestInstance;
2725
import org.trellisldp.test.AbstractApplicationLdpTests;
2826

2927
@TestInstance(PER_CLASS)
30-
class TrellisApplicationIT {
28+
class TrellisApplicationIT extends AbstractApplicationLdpTests {
3129

3230
private final Client CLIENT = newBuilder().build();
3331
private final String TRELLIS_URL = "http://localhost:" + getInteger("trellis.port", 9080) + "/trellis/";
3432

35-
@Nested
36-
@DisplayName("Trellis LDP Tests")
37-
class LdpTests extends AbstractApplicationLdpTests {
38-
39-
@Override
40-
public Client getClient() {
41-
return TrellisApplicationIT.this.CLIENT;
42-
}
33+
@Override
34+
public Client getClient() {
35+
return this.CLIENT;
36+
}
4337

44-
@Override
45-
public String getBaseURL() {
46-
return TrellisApplicationIT.this.TRELLIS_URL;
47-
}
38+
@Override
39+
public String getBaseURL() {
40+
return this.TRELLIS_URL;
4841
}
4942
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" version="1.1"
4-
bean-discovery-mode="annotated">
2+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
version="4.0"
6+
bean-discovery-mode="annotated">
57
</beans>

trellis-app/src/main/resources/META-INF/beans.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" version="1.1"
4-
bean-discovery-mode="annotated">
2+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
version="4.0"
6+
bean-discovery-mode="annotated">
57
</beans>
6-
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
5-
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
6-
version="1.1" bean-discovery-mode="annotated">
2+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
version="4.0"
6+
bean-discovery-mode="annotated">
77
</beans>

trellis-cdi/src/main/resources/META-INF/beans.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" version="1.1"
4-
bean-discovery-mode="annotated">
2+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
version="4.0"
6+
bean-discovery-mode="annotated">
57
</beans>
6-
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
5-
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
6-
version="1.1" bean-discovery-mode="annotated">
2+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
version="4.0"
6+
bean-discovery-mode="annotated">
77
</beans>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
5-
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
6-
version="1.1" bean-discovery-mode="annotated">
2+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
version="4.0"
6+
bean-discovery-mode="annotated">
77
</beans>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
5-
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
6-
version="1.1" bean-discovery-mode="annotated">
2+
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://jakarta.ee/xml/ns/jakartaee"
4+
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_4_0.xsd"
5+
version="4.0"
6+
bean-discovery-mode="annotated">
77
</beans>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) Aaron Coburn and individual contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.trellisldp.http;
17+
18+
import jakarta.ws.rs.WebApplicationException;
19+
import jakarta.ws.rs.core.Response;
20+
import jakarta.ws.rs.ext.ExceptionMapper;
21+
import jakarta.ws.rs.ext.Provider;
22+
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
25+
26+
@Provider
27+
public class WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> {
28+
29+
private static final Logger LOGGER = LoggerFactory.getLogger(WebApplicationExceptionMapper.class);
30+
31+
@Override
32+
public Response toResponse(final WebApplicationException err) {
33+
LOGGER.debug("Unhandled web application exception", err);
34+
35+
return err.getResponse();
36+
}
37+
}

0 commit comments

Comments
 (0)