diff --git a/plugin_rest.html b/plugin_rest.html index 11576f900..537751579 100644 --- a/plugin_rest.html +++ b/plugin_rest.html @@ -148,22 +148,28 @@
@RestParam :

/**
- * 只能依附在Service类的方法的参数上, http请求的参数名
+ * 只能依附在Service类的方法的参数上
  */
 @Target({PARAMETER})
 public @interface RestParam {
 
     String value(); //参数名
 
+    /**
+     * 参数是否从header取, 默认使用 request.getJsonParameter, 设置为true则使用 request.getJsonHeader 取值
+     *
+     * @return 是否从header取
+     */
+    boolean header() default false;
 }
-                
+

        REST的设置方式有两大种: 一种是采用默认REST注解,一种是显式的设置。
第一种方式需要开发者对Service中的方法命名需要遵循一定规则, 如下范例,模块为Hello,Service类命名为HelloService,增删改查的方法采用createHello、deleteHello、updateHello、queryHello或其他xxxHello命名。REST插件加载任何没有标记@RestController、@RestMapping、@RestParam 的Service将按照一定规则生成默认值:
        1、@RestController.value() 默认值为Service类名的小写化并去掉service及后面字样, 视为模块名
        2、@RestMapping.name() 默认值为Service的方法名小写化并去掉模块名字样
-         2、@RestParam.value() 如果方法名以find、delete开头且方法的参数只有一个且参数类型是基本数据类型或String,则默认值为"#";若使用Java 8中带上 -parameters 编译项的新特性,默认值为参数名, 若没使用新特性则采用bean、bean2、bean3...的命名规则。
+         3、@RestParam.value() 如果方法名以find、delete开头且方法的参数只有一个且参数类型是基本数据类型或String,则默认值为"#";若使用Java 8中带上 -parameters 编译项的新特性,默认值为参数名, 若没使用新特性则采用bean、bean2、bean3...的命名规则。

/**
  * 类说明:
@@ -304,7 +310,7 @@
     }
 
     //修改记录
-    @RestMapping(name = "partupdate")  //不能使用updatepart,因为存在update,是updatepart的开头部分,不符合BasedHttpServlet的WebAction规则
+    @RestMapping(name = "partupdate")  
     public void updateHello(HelloEntity entity, @RestParam("cols") String[] columns) { //通过 /hello/update?bean={...} 修改对象
         entity.setUpdatetime(System.currentTimeMillis());
         source.updateColumns(entity, columns);