更换rpconly和automapping大小写
This commit is contained in:
@@ -155,7 +155,7 @@ public final class ApiDocCommand {
|
||||
if (HttpScope.class.isAssignableFrom(action.result())) {
|
||||
continue; //忽略模板引擎的方法
|
||||
}
|
||||
if (action.rpconly() && skipRPC) {
|
||||
if (action.rpcOnly() && skipRPC) {
|
||||
continue; //不生成RPC接口
|
||||
}
|
||||
final List<Map<String, Object>> swaggerParamsList = new ArrayList<>();
|
||||
@@ -347,7 +347,7 @@ public final class ApiDocCommand {
|
||||
}
|
||||
swaggerOperatMap.put("parameters", swaggerParamsList);
|
||||
String actiondesc = action.comment();
|
||||
if (action.rpconly()) {
|
||||
if (action.rpcOnly()) {
|
||||
actiondesc = "[Only for RPC API] " + actiondesc;
|
||||
}
|
||||
swaggerOperatMap.put("responses", Utility.ofMap("200", Utility.ofMap("description", actiondesc, "content", Utility.ofMap("application/json", respMap))));
|
||||
|
||||
@@ -2547,7 +2547,7 @@ public final class Application {
|
||||
+ " restart restart one process\r\n"
|
||||
+ " --conf-file=[file] application config file, eg. application.xml、application.properties\r\n"
|
||||
+ " apidoc generate apidoc\r\n"
|
||||
+ " --api-skiprpc=[true|false] skip @RestService(rpconly=true) service or @RestMapping(rpconly=true) method, default is true\r\n"
|
||||
+ " --api-skiprpc=[true|false] skip @RestService(rpcOnly=true) service or @RestMapping(rpcOnly=true) method, default is true\r\n"
|
||||
+ " --api-host=[url] api root url, default is http://localhost\r\n"
|
||||
+ " help, -h, --help show this help\r\n";
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public @interface HttpMapping {
|
||||
*
|
||||
* @return 默认false
|
||||
*/
|
||||
boolean rpconly() default false;
|
||||
boolean rpcOnly() default false;
|
||||
|
||||
/**
|
||||
* 是否鉴权,默认需要鉴权 <br>
|
||||
|
||||
@@ -55,7 +55,7 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
|
||||
@Override
|
||||
public void execute(HttpRequest request, HttpResponse response) throws IOException {
|
||||
ActionEntry entry = request.actionEntry;
|
||||
if (entry.rpconly) {
|
||||
if (entry.rpcOnly) {
|
||||
if (!request.rpc) {
|
||||
finish404(request, response);
|
||||
return;
|
||||
@@ -387,19 +387,19 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
|
||||
protected static final class ActionEntry {
|
||||
|
||||
ActionEntry(int moduleid, int actionid, String name, String[] methods, Method method, HttpServlet servlet) {
|
||||
this(moduleid, actionid, name, methods, method, rpconly(method), auth(method), cacheSeconds(method), servlet);
|
||||
this(moduleid, actionid, name, methods, method, rpcOnly(method), auth(method), cacheSeconds(method), servlet);
|
||||
this.annotations = annotations(method);
|
||||
}
|
||||
|
||||
//供Rest类使用,参数不能随便更改
|
||||
public ActionEntry(int moduleid, int actionid, String name, String[] methods, Method method, boolean rpconly, boolean auth, int cacheSeconds, HttpServlet servlet) {
|
||||
public ActionEntry(int moduleid, int actionid, String name, String[] methods, Method method, boolean rpcOnly, boolean auth, int cacheSeconds, HttpServlet servlet) {
|
||||
this.moduleid = moduleid;
|
||||
this.actionid = actionid;
|
||||
this.name = name;
|
||||
this.methods = methods;
|
||||
this.method = method; //rest构建会为null
|
||||
this.servlet = servlet;
|
||||
this.rpconly = rpconly;
|
||||
this.rpcOnly = rpcOnly;
|
||||
this.auth = auth;
|
||||
this.cacheSeconds = cacheSeconds;
|
||||
if (Utility.contains(name, '*', '{', '[', '(', '|', '^', '$', '+', '?', '\\') || name.endsWith("/")) { //是否是正则表达式
|
||||
@@ -432,9 +432,9 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
|
||||
return mapping == null || mapping.auth();
|
||||
}
|
||||
|
||||
protected static boolean rpconly(Method method) {
|
||||
protected static boolean rpcOnly(Method method) {
|
||||
HttpMapping mapping = method.getAnnotation(HttpMapping.class);
|
||||
return mapping == null || mapping.rpconly();
|
||||
return mapping == null || mapping.rpcOnly();
|
||||
}
|
||||
|
||||
protected static int cacheSeconds(Method method) {
|
||||
@@ -467,7 +467,7 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
|
||||
|
||||
final int cacheSeconds;
|
||||
|
||||
final boolean rpconly;
|
||||
final boolean rpcOnly;
|
||||
|
||||
final boolean nonBlocking;
|
||||
|
||||
|
||||
@@ -1128,7 +1128,7 @@ public final class Rest {
|
||||
if (controller != null && controller.ignore()) {
|
||||
throw new RestException(serviceType + " is ignore Rest Service Class"); //标记为ignore=true不创建Servlet
|
||||
}
|
||||
final boolean serRpcOnly = controller != null && controller.rpconly();
|
||||
final boolean serRpcOnly = controller != null && controller.rpcOnly();
|
||||
final Boolean parentNonBlocking = parentNon0;
|
||||
|
||||
ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader;
|
||||
@@ -1207,7 +1207,7 @@ public final class Rest {
|
||||
}
|
||||
|
||||
RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class);
|
||||
if (!controller.automapping() && mappings.length < 1) {
|
||||
if (!controller.autoMapping() && mappings.length < 1) {
|
||||
continue;
|
||||
}
|
||||
boolean ignore = false;
|
||||
@@ -1706,7 +1706,7 @@ public final class Rest {
|
||||
}
|
||||
|
||||
RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class);
|
||||
if (!controller.automapping() && mappings.length < 1) {
|
||||
if (!controller.autoMapping() && mappings.length < 1) {
|
||||
continue;
|
||||
}
|
||||
boolean ignore = false;
|
||||
@@ -1889,7 +1889,7 @@ public final class Rest {
|
||||
if ((rcs != null && rcs.length > 0) || (rcc != null && rcc.length > 0)) {
|
||||
restConverts.add(new Object[]{rcs, rcc});
|
||||
}
|
||||
if (dynsimple && entry.rpconly) { //需要读取http header
|
||||
if (dynsimple && entry.rpcOnly) { //需要读取http header
|
||||
dynsimple = false;
|
||||
}
|
||||
|
||||
@@ -2278,7 +2278,7 @@ public final class Rest {
|
||||
av0.visit("url", url);
|
||||
av0.visit("name", (defmodulename.isEmpty() ? "" : (defmodulename + "_")) + entry.name);
|
||||
av0.visit("example", entry.example);
|
||||
av0.visit("rpconly", entry.rpconly);
|
||||
av0.visit("rpcOnly", entry.rpcOnly);
|
||||
av0.visit("auth", entry.auth);
|
||||
av0.visit("cacheSeconds", entry.cacheSeconds);
|
||||
av0.visit("actionid", entry.actionid);
|
||||
@@ -2314,7 +2314,7 @@ public final class Rest {
|
||||
|
||||
av0.visitEnd();
|
||||
mappingMap.put("url", url);
|
||||
mappingMap.put("rpconly", entry.rpconly);
|
||||
mappingMap.put("rpcOnly", entry.rpcOnly);
|
||||
mappingMap.put("auth", entry.auth);
|
||||
mappingMap.put("cacheSeconds", entry.cacheSeconds);
|
||||
mappingMap.put("actionid", entry.actionid);
|
||||
@@ -3417,7 +3417,7 @@ public final class Rest {
|
||||
mv.visitInsn(AASTORE);
|
||||
}
|
||||
mv.visitInsn(ACONST_NULL); //method
|
||||
mv.visitInsn(entry.rpconly ? ICONST_1 : ICONST_0); //rpconly
|
||||
mv.visitInsn(entry.rpcOnly ? ICONST_1 : ICONST_0); //rpcOnly
|
||||
mv.visitInsn(entry.auth ? ICONST_1 : ICONST_0); //auth
|
||||
Asms.visitInsn(mv, entry.cacheSeconds); //cacheSeconds
|
||||
mv.visitTypeInsn(NEW, newDynName + "$" + entry.newActionClassName);
|
||||
@@ -3736,7 +3736,7 @@ public final class Rest {
|
||||
this.mappingMethod = method;
|
||||
this.methods = mapping.methods();
|
||||
this.auth = mapping.auth();
|
||||
this.rpconly = serRpcOnly || mapping.rpconly();
|
||||
this.rpcOnly = serRpcOnly || mapping.rpcOnly();
|
||||
this.actionid = mapping.actionid();
|
||||
this.cacheSeconds = mapping.cacheSeconds();
|
||||
this.comment = mapping.comment();
|
||||
@@ -3790,7 +3790,7 @@ public final class Rest {
|
||||
|
||||
public final boolean nonBlocking;
|
||||
|
||||
public final boolean rpconly;
|
||||
public final boolean rpcOnly;
|
||||
|
||||
public final boolean auth;
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ public @interface RestMapping {
|
||||
String comment() default "";
|
||||
|
||||
/**
|
||||
* 是否只接收RPC请求, 对应@HttpMapping.rpconly
|
||||
* 是否只接收RPC请求, 对应@HttpMapping.rpcOnly
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
boolean rpconly() default false;
|
||||
boolean rpcOnly() default false;
|
||||
|
||||
/**
|
||||
* 是否鉴权,默认需要鉴权, 对应@HttpMapping.auth
|
||||
|
||||
@@ -44,18 +44,18 @@ public @interface RestService {
|
||||
int moduleid() default 0;
|
||||
|
||||
/**
|
||||
* 是否只接受RPC请求, 默认为false, 为true则覆盖所有@RestMapping的方法的rpconly值,都转为true
|
||||
* 是否只接受RPC请求, 默认为false, 为true则覆盖所有@RestMapping的方法的rpcOnly值,都转为true
|
||||
*
|
||||
* @return 默认false
|
||||
*/
|
||||
boolean rpconly() default false;
|
||||
boolean rpcOnly() default false;
|
||||
|
||||
/**
|
||||
* 没有标记@RestMapping的方法是否转换, 默认为false
|
||||
*
|
||||
* @return 默认false
|
||||
*/
|
||||
boolean automapping() default false;
|
||||
boolean autoMapping() default false;
|
||||
|
||||
/**
|
||||
* 是否屏蔽该类的转换
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.redkale.util.Utility;
|
||||
*
|
||||
* @author zhangjx
|
||||
*/
|
||||
@RestService(name = "test", automapping = true)
|
||||
@RestService(name = "test", autoMapping = true)
|
||||
public class RestSleepService extends AbstractService {
|
||||
|
||||
public String sleep200() {
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.redkale.util.*;
|
||||
* HelloBean: Hello模块实现FilterBean的过滤Bean类
|
||||
*
|
||||
*/
|
||||
@RestService(automapping = true)
|
||||
@RestService(autoMapping = true)
|
||||
public class HelloService implements Service {
|
||||
|
||||
private int nodeid;
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.redkale.util.Sheet;
|
||||
* HelloBean: Hello模块实现FilterBean的过滤Bean类
|
||||
*
|
||||
*/
|
||||
@RestService(name = "hello", moduleid = 0, automapping = true, repair = true, ignore = false, comment = "Hello服务模块")
|
||||
@RestService(name = "hello", moduleid = 0, autoMapping = true, repair = true, ignore = false, comment = "Hello服务模块")
|
||||
public class HelloService2 implements Service {
|
||||
|
||||
@Resource
|
||||
|
||||
Reference in New Issue
Block a user