jurlmapJava的URL映射类库
jurlmap是一个Java类库,能够让你的Web应用程序拥有简洁,类似于REST的URL。
主要特点:
1. URL参数能够直接绑定至Bean的属性或方法的参数。
2. 配置直接采用Java编码或注释,不需要额外配置文件。
3. URL映射匹配规则简单。
4. 能够很方便集成到Web应用程序中,只要将jurlmap提供的过滤器 Filter加到项目就可以。
URL 配置方法:
protected void configure() {
    // In this pattern $ means a string, which when matched 
    // is bound to parameter `Username` and control forwarded to profile.jsp
    // Parameter will be accessible via request.getParameter()
    forward("/profile.jsp", "/profile/$Username");
    // Here % means integer pattern and * means until end of the pattern.
    // Binds integers to parameter ArticleId and forwards to article.jsp
    forward("/article.jsp", "/article/%ArticleId/*");
    // When matched will send a redirect back to browser and parameters
    // are appended to query string so in this case the target will
    // be `/servlets/profileservlet?Username=...`
    redirect("/servlets/profileservlet", "/member/$Username");
    // On match creates an instanc eof LoginPage and calls it's service method
    // LoginPage class implements com.pagegoblin.jurlmap.Page.
    // If it is annotated with a @Deploy(url) annotation
    // the we don't need to pass a url to the deploy method.
    // In this case parameters are bound to bean properties or fields 
    // of the newly created LoginPage instance.
    deploy(LoginPage.class);
}
评论
