Skip to content

Commit 4cb230b

Browse files
committed
[WFLY-19465] refactoring the code
1 parent 98fc367 commit 4cb230b

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

spring-resteasy/src/main/java/org/jboss/as/quickstarts/resteasyspring/HelloSpringResource.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public class HelloSpringResource {
5050
@Produces("text/html")
5151
public Response getDefault(@Context UriInfo uriInfo) {
5252
String baseURI = uriInfo.getBaseUri().toString();
53-
baseURI = baseURI + "main";
5453
if (!baseURI.endsWith("/")) baseURI += '/';
54+
baseURI = baseURI + "main/";
5555
String msg = "Hello. <br> Please try <a href='"+baseURI+"hello?name=yourname'>spring-resteasy/main/hello?name=yourname</a>"
5656
+ "<br> Or try <a href='"+baseURI+"basic'>spring-resteasy/main/basic</a>"
5757
+ "<br> Or try <a href='"+baseURI+"queryParam?param=query'>spring-resteasy/main/queryParam?param=query</a>"
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
package org.jboss.as.quickstarts.resteasyspring;
22

3+
import jakarta.ws.rs.core.Context;
34
import jakarta.ws.rs.GET;
45
import jakarta.ws.rs.Path;
56
import jakarta.ws.rs.Produces;
7+
import jakarta.ws.rs.core.UriInfo;
68

79
@Path("/")
810
public class RootResource {
911

1012
@GET
1113
@Produces("text/html")
12-
public String getRootResponse() {
13-
String responsemsg = "Hello There! Welcome to WildFly! <br> Spring-resteasy quickstart has been deployed and running successfully. <br> You can find the available operations in the included README file.";
14+
public String getRootResponse(@Context UriInfo uriInfo) {
15+
String baseURI = uriInfo.getBaseUri().toString();
16+
if (!baseURI.endsWith("/")) baseURI += '/';
17+
baseURI = baseURI + "main/";
18+
String responsemsg = "Hello There! Welcome to WildFly!" +
19+
"<br>Spring-resteasy quickstart has been deployed and running successfully. " +
20+
"<br>You can find the available operations <a href='"+baseURI+"'>here</a> or in the included README file.";
1421
return responsemsg;
1522
}
1623
}

spring-resteasy/src/test/java/org/jboss/as/quickstarts/resteasyspring/test/BasicRuntimeIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class BasicRuntimeIT {
3838
@Test
3939
public void testHTTPEndpointIsAvailable() throws IOException, InterruptedException, URISyntaxException {
4040
final HttpRequest request = HttpRequest.newBuilder()
41-
.uri(new URI(getServerHost()+"/"))
41+
.uri(new URI(getServerHost()))
4242
.GET()
4343
.build();
4444
final HttpClient client = HttpClient.newBuilder()

spring-resteasy/src/test/java/org/jboss/as/quickstarts/resteasyspring/test/TestUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
public class TestUtils {
1919
static final String DEFAULT_SERVER_HOST = "http://localhost:8080/spring-resteasy";
20-
static final String MAINPAGE_PATH = "/main";
20+
static final String MAINPAGE_PATH = "/main/";
2121

2222
static String getServerHost() {
2323
String serverHost = System.getenv("SERVER_HOST");

0 commit comments

Comments
 (0)