zoukankan      html  css  js  c++  java
  • 解决restlet主页路径为 "/" 的遇到的相关问题

    restlet 设置根目录为主页时 , 

    设置如下

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

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

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

    解决方案 :

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

    说明 , Template有两种模式 (一种是起始值匹配,另外一种是完全匹配 , 设置为 完全匹配就行了)

        /** 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;
  • 相关阅读:
    POJ -- 3468
    HDOJ--1698
    简单的API应用
    Linux引导流程
    Python 实现网络爬虫小程序
    codeforce
    Count the string -- HDOJ 3336
    初次运行 Git 前的配置
    leetcode244- Shortest Word Distance II- medium
    leetcode243- Shortest Word Distance- easy
  • 原文地址:https://www.cnblogs.com/hi-gdl/p/11425378.html
Copyright © 2011-2022 走看看