Post

RESTful Redirect URL

1
2
3
String contextPath = request.getContextPath();  // e.g., "/AttendApply"
targetURL = contextPath + "/" + targetURL;
return Response.seeOther(URI.create(targetURL)).build();

Because root of api is /api:

1
2
3
@ApplicationPath("/api")
public class RestApplication extends Application {  
}

If just use Response.seeOther(targetURL).build() would be api/targetURL not just targetUrl.

This post is licensed under CC BY 4.0 by the author.