This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package org.redkale.boot.watch;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import org.redkale.boot.Application;
|
|
||||||
import org.redkale.net.TransportFactory;
|
|
||||||
import org.redkale.net.http.RestService;
|
|
||||||
import org.redkale.watch.WatchService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 详情见: https://redkale.org
|
|
||||||
*
|
|
||||||
* @author zhangjx
|
|
||||||
*/
|
|
||||||
@RestService(name = "watch", repair = false)
|
|
||||||
public class AppWatchService implements WatchService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private Application application;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private TransportFactory transportFactory;
|
|
||||||
|
|
||||||
}
|
|
||||||
41
src/org/redkale/boot/watch/ServiceWatchService.java
Normal file
41
src/org/redkale/boot/watch/ServiceWatchService.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.boot.watch;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.redkale.boot.Application;
|
||||||
|
import org.redkale.net.TransportFactory;
|
||||||
|
import org.redkale.net.http.*;
|
||||||
|
import org.redkale.service.RetResult;
|
||||||
|
import org.redkale.watch.WatchService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 详情见: https://redkale.org
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
@RestService(name = "service", catalog = "watch", repair = false)
|
||||||
|
public class ServiceWatchService implements WatchService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private Application application;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TransportFactory transportFactory;
|
||||||
|
|
||||||
|
@RestMapping(name = "load", auth = false, comment = "动态增加Service")
|
||||||
|
public RetResult loadService(String type, @RestUploadFile(maxLength = 10 * 1024 * 1024, fileNameReg = "\\.jar$") byte[] jar) {
|
||||||
|
//待开发
|
||||||
|
return RetResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RestMapping(name = "stop", auth = false, comment = "动态停止Service")
|
||||||
|
public RetResult stopService(String name, String type) {
|
||||||
|
//待开发
|
||||||
|
return RetResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
41
src/org/redkale/boot/watch/ServletWatchService.java
Normal file
41
src/org/redkale/boot/watch/ServletWatchService.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package org.redkale.boot.watch;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.redkale.boot.Application;
|
||||||
|
import org.redkale.net.TransportFactory;
|
||||||
|
import org.redkale.net.http.*;
|
||||||
|
import org.redkale.service.RetResult;
|
||||||
|
import org.redkale.watch.WatchService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 详情见: https://redkale.org
|
||||||
|
*
|
||||||
|
* @author zhangjx
|
||||||
|
*/
|
||||||
|
@RestService(name = "servlet", catalog = "watch", repair = false)
|
||||||
|
public class ServletWatchService implements WatchService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private Application application;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TransportFactory transportFactory;
|
||||||
|
|
||||||
|
@RestMapping(name = "load", auth = false, comment = "动态增加Servlet")
|
||||||
|
public RetResult loadServlet(String type, @RestUploadFile(maxLength = 10 * 1024 * 1024, fileNameReg = "\\.jar$") byte[] jar) {
|
||||||
|
//待开发
|
||||||
|
return RetResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RestMapping(name = "stop", auth = false, comment = "动态停止Servlet")
|
||||||
|
public RetResult stopServlet(String type) {
|
||||||
|
//待开发
|
||||||
|
return RetResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -751,6 +751,7 @@ public final class Rest {
|
|||||||
if (anncookie != null) throw new RuntimeException("@RestAddress and @RestCookie cannot on the same Parameter in " + method);
|
if (anncookie != null) throw new RuntimeException("@RestAddress and @RestCookie cannot on the same Parameter in " + method);
|
||||||
if (annsid != null) throw new RuntimeException("@RestAddress and @RestSessionid cannot on the same Parameter in " + method);
|
if (annsid != null) throw new RuntimeException("@RestAddress and @RestSessionid cannot on the same Parameter in " + method);
|
||||||
if (ptype != String.class) throw new RuntimeException("@RestAddress must on String Parameter in " + method);
|
if (ptype != String.class) throw new RuntimeException("@RestAddress must on String Parameter in " + method);
|
||||||
|
comment = annaddr.comment();
|
||||||
}
|
}
|
||||||
RestBody annbody = param.getAnnotation(RestBody.class);
|
RestBody annbody = param.getAnnotation(RestBody.class);
|
||||||
if (annbody != null) {
|
if (annbody != null) {
|
||||||
@@ -759,6 +760,7 @@ public final class Rest {
|
|||||||
if (annsid != null) throw new RuntimeException("@RestBody and @RestSessionid cannot on the same Parameter in " + method);
|
if (annsid != null) throw new RuntimeException("@RestBody and @RestSessionid cannot on the same Parameter in " + method);
|
||||||
if (annaddr != null) throw new RuntimeException("@RestBody and @RestAddress cannot on the same Parameter in " + method);
|
if (annaddr != null) throw new RuntimeException("@RestBody and @RestAddress cannot on the same Parameter in " + method);
|
||||||
if (ptype.isPrimitive()) throw new RuntimeException("@RestBody cannot on primitive type Parameter in " + method);
|
if (ptype.isPrimitive()) throw new RuntimeException("@RestBody cannot on primitive type Parameter in " + method);
|
||||||
|
comment = annbody.comment();
|
||||||
}
|
}
|
||||||
RestUploadFile annfile = param.getAnnotation(RestUploadFile.class);
|
RestUploadFile annfile = param.getAnnotation(RestUploadFile.class);
|
||||||
if (annfile != null) {
|
if (annfile != null) {
|
||||||
@@ -771,6 +773,7 @@ public final class Rest {
|
|||||||
if (annaddr != null) throw new RuntimeException("@RestUploadFile and @RestAddress cannot on the same Parameter in " + method);
|
if (annaddr != null) throw new RuntimeException("@RestUploadFile and @RestAddress cannot on the same Parameter in " + method);
|
||||||
if (annbody != null) throw new RuntimeException("@RestUploadFile and @RestBody cannot on the same Parameter in " + method);
|
if (annbody != null) throw new RuntimeException("@RestUploadFile and @RestBody cannot on the same Parameter in " + method);
|
||||||
if (ptype != byte[].class && ptype != File.class && ptype != File[].class) throw new RuntimeException("@RestUploadFile must on byte[] or File or File[] Parameter in " + method);
|
if (ptype != byte[].class && ptype != File.class && ptype != File[].class) throw new RuntimeException("@RestUploadFile must on byte[] or File or File[] Parameter in " + method);
|
||||||
|
comment = annfile.comment();
|
||||||
}
|
}
|
||||||
|
|
||||||
RestURI annuri = param.getAnnotation(RestURI.class);
|
RestURI annuri = param.getAnnotation(RestURI.class);
|
||||||
@@ -782,6 +785,7 @@ public final class Rest {
|
|||||||
if (annbody != null) throw new RuntimeException("@RestURI and @RestBody cannot on the same Parameter in " + method);
|
if (annbody != null) throw new RuntimeException("@RestURI and @RestBody cannot on the same Parameter in " + method);
|
||||||
if (annfile != null) throw new RuntimeException("@RestURI and @RestUploadFile cannot on the same Parameter in " + method);
|
if (annfile != null) throw new RuntimeException("@RestURI and @RestUploadFile cannot on the same Parameter in " + method);
|
||||||
if (ptype != String.class) throw new RuntimeException("@RestURI must on String Parameter in " + method);
|
if (ptype != String.class) throw new RuntimeException("@RestURI must on String Parameter in " + method);
|
||||||
|
comment = annuri.comment();
|
||||||
}
|
}
|
||||||
|
|
||||||
RestParam annpara = param.getAnnotation(RestParam.class);
|
RestParam annpara = param.getAnnotation(RestParam.class);
|
||||||
|
|||||||
@@ -25,4 +25,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
public @interface RestAddress {
|
public @interface RestAddress {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注描述, 对应@HttpParam.comment
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
String comment() default "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,10 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
public @interface RestBody {
|
public @interface RestBody {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注描述, 对应@HttpParam.comment
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
String comment() default "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||||||
@Target({PARAMETER, FIELD})
|
@Target({PARAMETER, FIELD})
|
||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
public @interface RestURI {
|
public @interface RestURI {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注描述, 对应@HttpParam.comment
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
String comment() default "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,4 +45,11 @@ public @interface RestUploadFile {
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
String contentTypeReg() default "";
|
String contentTypeReg() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注描述, 对应@HttpParam.comment
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
String comment() default "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user