From 1341e81361c7de828f9c0b4fba5e2d6fffbb159c Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Thu, 8 Sep 2016 09:18:18 +0800 Subject: [PATCH] --- src/org/redkale/net/http/Rest.java | 14 +++++++------- src/org/redkale/net/http/RestCookie.java | 6 +++--- src/org/redkale/net/http/RestHeader.java | 6 +++--- src/org/redkale/net/http/RestParam.java | 6 +++--- src/org/redkale/net/http/RestService.java | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/org/redkale/net/http/Rest.java b/src/org/redkale/net/http/Rest.java index fcc3f1307..b8833282b 100644 --- a/src/org/redkale/net/http/Rest.java +++ b/src/org/redkale/net/http/Rest.java @@ -59,7 +59,7 @@ public final class Rest { final RestService controller = serviceType.getAnnotation(RestService.class); if (controller == null) return serviceType.getSimpleName().replaceAll("Service.*$", "").toLowerCase(); if (controller.ignore()) return null; - return (!controller.value().isEmpty()) ? controller.value() : serviceType.getSimpleName().replaceAll("Service.*$", "").toLowerCase(); + return (!controller.name().isEmpty()) ? controller.name() : serviceType.getSimpleName().replaceAll("Service.*$", "").toLowerCase(); } static T createRestServlet(final Class baseServletClass, final Class serviceType, final boolean sncp) { @@ -119,7 +119,7 @@ public final class Rest { { //注入 @WebServlet 注解 String urlpath = "/" + defmodulename + "/*"; - int moduleid = controller == null ? 0 : controller.module(); + int moduleid = controller == null ? 0 : controller.moduleid(); boolean repair = controller == null ? true : controller.repair(); String comment = controller == null ? "" : controller.comment(); av0 = cw.visitAnnotation(webServletDesc, true); @@ -252,7 +252,7 @@ public final class Rest { if (!sncp) { //SNCP协议中忽略参数中特定的注解,此处获取的只是SNCP请求端信息,并不是真实用户请求端的信息 annhead = param.getAnnotation(RestHeader.class); if (annhead != null) { - n = annhead.value(); + n = annhead.name(); radix = annhead.radix(); comment = annhead.comment(); if (n.isEmpty()) throw new RuntimeException("@RestHeader.value is illegal in " + method); @@ -261,7 +261,7 @@ public final class Rest { if (anncookie != null) { if (annhead != null) throw new RuntimeException("@RestCookie and @RestHeader cannot on the same Parameter in " + method); if (ptype != String.class) throw new RuntimeException("@RestCookie must on String Parameter in " + method); - n = anncookie.value(); + n = anncookie.name(); radix = anncookie.radix(); comment = anncookie.comment(); if (n.isEmpty()) throw new RuntimeException("@RestCookie.value is illegal in " + method); @@ -283,7 +283,7 @@ public final class Rest { RestParam annpara = param.getAnnotation(RestParam.class); if (annpara != null) radix = annpara.radix(); if (annpara != null) comment = annpara.comment(); - if (n == null) n = (annpara == null || annpara.value().isEmpty()) ? null : annpara.value(); + if (n == null) n = (annpara == null || annpara.name().isEmpty()) ? null : annpara.name(); if (n == null && ptype == userType) n = "&"; //用户类型特殊处理 if (n == null) { if (param.isNamePresent()) { @@ -555,10 +555,10 @@ public final class Rest { String restname = ""; if (rh != null) { attrFieldName = "_redkale_attr_header_" + restAttributes.size(); - restname = rh.value(); + restname = rh.name(); } else if (rc != null) { attrFieldName = "_redkale_attr_cookie_" + restAttributes.size(); - restname = rc.value(); + restname = rc.name(); } else if (rs != null) { attrFieldName = "_redkale_attr_sessionid_" + restAttributes.size(); restname = rs.create() ? "1" : ""; //用于下面区分create值 diff --git a/src/org/redkale/net/http/RestCookie.java b/src/org/redkale/net/http/RestCookie.java index cd3e69f5f..7623506ba 100644 --- a/src/org/redkale/net/http/RestCookie.java +++ b/src/org/redkale/net/http/RestCookie.java @@ -22,9 +22,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Retention(RUNTIME) public @interface RestCookie { - String value(); //cookie名 - - String comment() default ""; //备注描述 + String name(); //cookie名 int radix() default 10; //转换数字byte/short/int/long时所用的进制数, 默认10进制 + + String comment() default ""; //备注描述 } diff --git a/src/org/redkale/net/http/RestHeader.java b/src/org/redkale/net/http/RestHeader.java index d9296fb35..c8edb4c47 100644 --- a/src/org/redkale/net/http/RestHeader.java +++ b/src/org/redkale/net/http/RestHeader.java @@ -22,9 +22,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Retention(RUNTIME) public @interface RestHeader { - String value(); //参数名 - - String comment() default ""; //备注描述 + String name(); //参数名 int radix() default 10; //转换数字byte/short/int/long时所用的进制数, 默认10进制 + + String comment() default ""; //备注描述 } diff --git a/src/org/redkale/net/http/RestParam.java b/src/org/redkale/net/http/RestParam.java index 0ebb8357b..6e44acd39 100644 --- a/src/org/redkale/net/http/RestParam.java +++ b/src/org/redkale/net/http/RestParam.java @@ -22,9 +22,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Retention(RUNTIME) public @interface RestParam { - String value(); //参数名 - - String comment() default ""; //备注描述 + String name(); //参数名 int radix() default 10; //转换数字byte/short/int/long时所用的进制数, 默认10进制 + + String comment() default ""; //备注描述 } diff --git a/src/org/redkale/net/http/RestService.java b/src/org/redkale/net/http/RestService.java index 9e3cde676..190e22e6d 100644 --- a/src/org/redkale/net/http/RestService.java +++ b/src/org/redkale/net/http/RestService.java @@ -23,13 +23,13 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; @Retention(RUNTIME) public @interface RestService { - boolean ignore() default false; //是否屏蔽该类的转换 + String name() default ""; //模块名, 只能是模块名,不能含特殊字符 - String value() default ""; //模块名, 只能是模块名,不能含特殊字符 + int moduleid() default 0; //模块ID值,鉴权时用到, 对应@WebServlet.moduleid + + boolean ignore() default false; //是否屏蔽该类的转换 boolean repair() default true; //同@WebServlet的repair属性 - int module() default 0; //模块ID值,鉴权时用到, 对应@WebServlet.module - String comment() default ""; //备注描述 }