<commit_before>struts2-freeroute-plugin [![Build Status](https://travis-ci.org/bastengao/struts2-freeroute.png?branch=master)](https://travis-ci.org/bastengao/struts2-freeroute)
===========

自由的映射路由，像 Spring MVC 那样。

- [API doc](http://bastengao.github.com/struts2-freeroute/1.0.1/apidocs/)
- [引用](#引用)
- [例子](#例子)
- [配置](#配置)
- [说明](#说明)
    - [路由映射](#路由映射)
        * [路径](#路径)
        * [绑定 cookie](#绑定-cookie)
        * [HTTP method](#http-method)
        * [HTTP 参数](#http-参数)
    - [返回结果](#返回结果)
        * 方式
        * [绝对路径](#绝对路径)
        * [相对路径](#相对路径)

# 引用

当前最新版本 1.0.3

```xml
<dependency>
    <groupId>com.bastengao.freeroute</groupId>
    <artifactId>struts2-freeroute-plugin</artifactId>
    <version>1.0.3</version>
</dependency>
```

如果你需要与 struts2-spring-plugin 结合使用，只需要以下依赖
```xml
<dependency>
    <groupId>com.bastengao.freeroute</groupId>
    <artifactId>struts2-freeroute4spring</artifactId>
    <version>1.0.3</version>
</dependency>
```

# 例子

struts.xml
```xml
<struts>
    <constant name="struts.freeroute.controllerPackage" value="org.example"/>
</struts>
```

org.example.BookController.java
```java
public class BookController{
    private int id;
    private Book book;

    @Route("/books/{id}")
    public String show(){
        book = bookDao.find(id);
        return Results.jsp("/book.jsp");
    }

    //setter, getter
}
```

webapp/book.jsp
```jsp<commit_msg>version to 1.0.4<commit_after>struts2-freeroute-plugin [![Build Status](https://travis-ci.org/bastengao/struts2-freeroute.png?branch=master)](https://travis-ci.org/bastengao/struts2-freeroute)
===========

自由的映射路由，像 Spring MVC 那样。

- [API doc](http://bastengao.github.com/struts2-freeroute/1.0.1/apidocs/)
- [引用](#引用)
- [例子](#例子)
- [配置](#配置)
- [说明](#说明)
    - [路由映射](#路由映射)
        * [路径](#路径)
        * [绑定 cookie](#绑定-cookie)
        * [HTTP method](#http-method)
        * [HTTP 参数](#http-参数)
    - [返回结果](#返回结果)
        * 方式
        * [绝对路径](#绝对路径)
        * [相对路径](#相对路径)

# 引用

当前最新版本 1.0.4

```xml
<dependency>
    <groupId>com.bastengao.freeroute</groupId>
    <artifactId>struts2-freeroute-plugin</artifactId>
    <version>1.0.4</version>
</dependency>
```

如果你需要与 struts2-spring-plugin 结合使用，只需要以下依赖
```xml
<dependency>
    <groupId>com.bastengao.freeroute</groupId>
    <artifactId>struts2-freeroute4spring</artifactId>
    <version>1.0.4</version>
</dependency>
```

# 例子

struts.xml
```xml
<struts>
    <constant name="struts.freeroute.controllerPackage" value="org.example"/>
</struts>
```

org.example.BookController.java
```java
public class BookController{
    private int id;
    private Book book;

    @Route("/books/{id}")
    public String show(){
        book = bookDao.find(id);
        return Results.jsp("/book.jsp");
    }

    //setter, getter
}
```

webapp/book.jsp
```jsp
{'fraction_non_alphanumeric': 0.20092956739363604, 'fraction_numerical': 0.015373614587057561, 'mean_word_length': 3.3245749613601236, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '996088', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1204, 'n_words': 149}