Jersey URL forwarding

前端 未结 3 1167
心在旅途
心在旅途 2021-02-14 21:24

Inside a Jersey REST method I would like to forward to an another website. How can I achieve that?

@Path(\"/\")
public c         


        
3条回答
  •  春和景丽
    2021-02-14 21:59

    Try this, it worked for me:

    public String getForwardNews(
    
    @Context final HttpServletRequest request,
    
    @Context final HttpServletResponse response) throws Exception
    
    {
    
    System.out.println("CMSredirecting... ");
    
    response.sendRedirect("YourUrlSite");
    
    return "";
    
    }
    

提交回复
热议问题