Skip to content

Commit

Permalink
[WFLY-19465] refactoring the code
Browse files Browse the repository at this point in the history
  • Loading branch information
sudeshnas93 committed Jun 27, 2024
1 parent 98fc367 commit 4cb230b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public class HelloSpringResource {
@Produces("text/html")
public Response getDefault(@Context UriInfo uriInfo) {
String baseURI = uriInfo.getBaseUri().toString();
baseURI = baseURI + "main";
if (!baseURI.endsWith("/")) baseURI += '/';
baseURI = baseURI + "main/";
String msg = "Hello. <br> Please try <a href='"+baseURI+"hello?name=yourname'>spring-resteasy/main/hello?name=yourname</a>"
+ "<br> Or try <a href='"+baseURI+"basic'>spring-resteasy/main/basic</a>"
+ "<br> Or try <a href='"+baseURI+"queryParam?param=query'>spring-resteasy/main/queryParam?param=query</a>"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package org.jboss.as.quickstarts.resteasyspring;

import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.UriInfo;

@Path("/")
public class RootResource {

@GET
@Produces("text/html")
public String getRootResponse() {
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.";
public String getRootResponse(@Context UriInfo uriInfo) {
String baseURI = uriInfo.getBaseUri().toString();
if (!baseURI.endsWith("/")) baseURI += '/';
baseURI = baseURI + "main/";
String responsemsg = "Hello There! Welcome to WildFly!" +
"<br>Spring-resteasy quickstart has been deployed and running successfully. " +
"<br>You can find the available operations <a href='"+baseURI+"'>here</a> or in the included README file.";
return responsemsg;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class BasicRuntimeIT {
@Test
public void testHTTPEndpointIsAvailable() throws IOException, InterruptedException, URISyntaxException {
final HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(getServerHost()+"/"))
.uri(new URI(getServerHost()))
.GET()
.build();
final HttpClient client = HttpClient.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

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

static String getServerHost() {
String serverHost = System.getenv("SERVER_HOST");
Expand Down

0 comments on commit 4cb230b

Please sign in to comment.