解决restlet主页路径为 "/" 的遇到的相关问题

restlet 设置根目录为主页时 , jquery

设置以下ide

component.getDefaultHost().attach("/", HomeResource.class )

使用下面的地址 , 后面的地址,响应的信息都是主页,致使 js 等没法使用spa

 

http://localhost:8080/          好使
http://localhost:8080           好使
http://localhost:8080/aaa         好使
http://localhost:8080/aaa/jquery.js   好使

解决方案 :rest

component.getDefaultHost().attach("/", HomeResource.class , Template.MODE_EQUALS);

说明 , Template有两种模式 (一种是起始值匹配,另一种是彻底匹配 , 设置为 彻底匹配就好了)code

    /** Mode where all characters must match the template and size be identical. */
    public static final int MODE_EQUALS = 2;

    /** Mode where characters at the beginning must match the template. */
    public static final int MODE_STARTS_WITH = 1;
相关文章
相关标签/搜索