com.bastengao.struts2.freeroute
类 RouteUtil

java.lang.Object
  继承者 com.bastengao.struts2.freeroute.RouteUtil

public class RouteUtil
extends Object

路由工具类

从以下版本开始:
1.0
作者:
bastengao

字段摘要
static Pattern PATH_VARIABLE_PATTERN
           
 
构造方法摘要
private RouteUtil()
           
 
方法摘要
static String flatRoutePath(String routePath)
          如果 routePath 中有 pathVariable, 例如 "/persons/{id}" 那么将路由转化为 "/persons/__id__" "/persons/{id}/edit" 转化为 "/persons/__id__/edit"
static boolean hasPathVariables(String routePath)
          是否有 pathVariable
static List<String> pathVariableNames(String routePath)
          返回路由中的变量名
static String toRoutePathPattern(String routePath)
          将路由路径转化为能够匹配此路径请求的正则表达式

static MethodType valueOfMethod(String method)
          根据 http method 返回对应的枚举 如果没有匹配的返回 MethodType.NONE
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

PATH_VARIABLE_PATTERN

public static final Pattern PATH_VARIABLE_PATTERN
构造方法详细信息

RouteUtil

private RouteUtil()
方法详细信息

hasPathVariables

public static boolean hasPathVariables(String routePath)
是否有 pathVariable

参数:
routePath -
返回:

toRoutePathPattern

public static String toRoutePathPattern(String routePath)
将路由路径转化为能够匹配此路径请求的正则表达式

参数:
routePath -
返回:

pathVariableNames

public static List<String> pathVariableNames(String routePath)
返回路由中的变量名

参数:
routePath -
返回:

flatRoutePath

public static String flatRoutePath(String routePath)
如果 routePath 中有 pathVariable, 例如 "/persons/{id}" 那么将路由转化为 "/persons/__id__" "/persons/{id}/edit" 转化为 "/persons/__id__/edit"

参数:
routePath -
返回:

valueOfMethod

public static MethodType valueOfMethod(String method)
根据 http method 返回对应的枚举 如果没有匹配的返回 MethodType.NONE

参数:
method -
返回:


Copyright © 2013 bastengao. All Rights Reserved.