伪静态问题:未知原因

先看下请求,上为第一次请求:/sitemap/xml,下为第二次请求:/sitemap.xml

无标题.jpg

相关代码如下:

@RequestMapping(value = "/sitemap", viewPath = "/view/website/sitemap")
public class SiteMapController extends Controller {
    @Inject SiteMapService service;

    public void xml(){
        System.out.println("[SiteMapController] xml: " + 111);
        renderText(getByCache("/sitemap/xml", () ->
            renderToString("sitemap.xml", getAttrs())
        ), "xml");
        System.out.println("[SiteMapController] xml: " + 222);
    }
}

Handler映射关系:

    SITE_MAP_MAPPING.put("/sitemap.xml", "/sitemap/xml");
    SITE_MAP_MAPPING.put("/sitemap.txt", "/sitemap/txt");
    SITE_MAP_MAPPING.put("/sitemap.html", "/sitemap/html");

控制台输出如下:

JFinal-4.9.09 action report -------- 2021-04-27 17:15:36 --------------------------
Url         : GET /sitemap/xml
Controller  : cn.yuum.sitemap.SiteMapController.(SiteMapController.java:1)
Method      : xml
Interceptor : com.jfinal.ext.interceptor.ExceptionInterceptor.(ExceptionInterceptor.java:1)
              com.jfinal.ext.interceptor.PermissionInterceptor.(PermissionInterceptor.java:1)
              cn.yuum.common.interceptor.UserInterceptor.(UserInterceptor.java:1)
--------------------------------------------------------------------------------
[SiteMapController] xml: 111
[SiteMapController] xml: 222
com.jfinal.core.ActionException

JFinal-4.9.09 action report -------- 2021-04-27 17:15:37 --------------------------
Url         : GET /sitemap/xml
Controller  : cn.yuum.sitemap.SiteMapController.(SiteMapController.java:1)
Method      : xml
Interceptor : com.jfinal.ext.interceptor.ExceptionInterceptor.(ExceptionInterceptor.java:1)
              com.jfinal.ext.interceptor.PermissionInterceptor.(PermissionInterceptor.java:1)
              cn.yuum.common.interceptor.UserInterceptor.(UserInterceptor.java:1)


评论区

BTMTimor

2021-04-27 17:30

BTMTimor

2021-04-27 17:40

handle里面的逻辑,这个应该没影响:

if (target.startsWith("/sitemap")){
mapping = handleSiteMapRoute(target);
}
next.handle(mapping, request, response, booleans);

热门反馈

扫码入社