Rest 泽西岛休息服务

Rest 泽西岛休息服务,rest,jersey,Rest,Jersey,我使用泽西1.19进行休息服务 web.xml中的URL模式是: <servlet-mapping> <servlet-name>Jersey REST Service</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping> 这应该重定向到: http://localhost:8084/userProfile/signup/i

我使用泽西1.19进行休息服务

web.xml
中的URL模式是:

<servlet-mapping>
    <servlet-name>Jersey REST Service</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
这应该重定向到:

http://localhost:8084/userProfile/signup/index.jsp
但它转向:

http://localhost:8084/userProfile/rest/signup/index.jsp
这通常是不存在的

Java类中的方法:

@Path("/user")
public class userProfile {

    @GET
    @Produces(MediaType.TEXT_HTML)
    public Response returnForm() throws URISyntaxException {
        URI uri = new URI("/signup/index.jsp");
        return Response.temporaryRedirect(uri).build();
    }
}

如何避免重定向到包含
/rest/
的URL?

解决方案非常简单。。。这条路应该退一步到 避免url模式/rest/*:

 ....
 URI uri = new URI("../signup/index.jsp");
 ...

谢谢

解决方案非常简单。。。这条路应该退一步到 避免url模式/rest/*:

 ....
 URI uri = new URI("../signup/index.jsp");
 ...

谢谢

您可以将其重定向到[http:''localhost:8084/userProfile/signup/index.jsp]从请求URL生成前缀吗?是的,我已经尝试过了,它工作正常。。但是我更愿意使用signup/index.jsp的相对路径。您能将其重定向到[http:''localhost:8084/userProfile/signup/index.jsp]根据请求URL生成前缀吗?是的,我已经尝试过了,它工作正常。。但是我更愿意使用signup/index.jsp的相对路径。谢谢