Closed zjpnju closed 9 years ago
I have a new bundle, create a new file WEB-INF and welcome.html in it I want http://localhost/services/hello to be redirected to welcome.html
@Path(''/hello"") @GET public void sendRedirect(@Context HttpServletRequest servletRequest, @Context HttpServletResponse servletResponse) { System.out.println("welcome"); URI uri = uriInfo.getAbsolutePathBuilder().build(); Response.created(uri).build(); try { servletResponse.sendRedirect("./welcome.html"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
The code above can't meet my requirement.. please help me
See Response.seeOther( .. )
Response.seeOther( .. )
@Path(''/hello"") @GET public void sendRedirect(@Context HttpServletRequest servletRequest, @Context HttpServletResponse servletResponse) { System.out.println("welcome"); URI uri = uriInfo.getAbsolutePathBuilder().build(); Response.created(uri).build(); try { servletResponse.sendRedirect("./welcome.html"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
The code above can't meet my requirement.. please help me