If you need a ReST endpoint which returns kind of a default page when a client accesses a unmapped path, you need an implementation like the one shown below.

Index.java
@ApplicationScoped @Path("/") @Produces(MediaType.TEXT_HTML)
 public class Index {

 @GET @Path("/{any : .*}")
 public Response root() {
     return Response.ok().entity("<!DOCTYPE html>\n" +
         "<html>\n" +
         "    <head>\n" +
         "        <title>Response</title>\n" +
     "    </head>\n" +
         "    <body>\n" +
     "        <h1>Catch All Response</h1>\n" +
         "    </body>\n" +
     "</html>").build();
 }

 }

Like this post? Share on: TwitterFacebookEmail


Jens Frey Avatar Jens Frey is the creator of the datapile blog.

Keep Reading


Published

Category

Programming

Tags

Stay in Touch