- java.lang.Object
-
- org.redkale.net.http.Rest
-
public final class Rest extends Object
详情见: https://redkale.org- 作者:
- zhangjx
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interface
Rest.RestDyn
用于标记由Rest.createRestServlet 方法创建的RestServletstatic interface
Rest.RestDynSourceType
用于标记由Rest.createRestServlet 方法创建的RestServlet
-
字段概要
字段 修饰符和类型 字段 说明 static String
REST_HEADER_CURRUSERID
static String
REST_HEADER_REQ_CONVERT
static String
REST_HEADER_RESNAME
static String
REST_HEADER_RESP_CONVERT
static String
REST_HEADER_RPC
static String
REST_HEADER_TRACEID
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static JsonFactory
createJsonFactory(int features, RestConvert[] converts, RestConvertCoder[] coders)
static JsonFactory
createJsonFactory(RestConvert[] converts, RestConvertCoder[] coders)
static <T extends HttpServlet>
TcreateRestServlet(ClassLoader classLoader, Class userType0, Class<T> baseServletType, Class<? extends Service> serviceType, String serviceResourceName)
static <T extends WebSocketServlet>
TcreateRestWebSocketServlet(ClassLoader classLoader, Class<? extends WebSocket> webSocketType, MessageAgent messageAgent)
static String
generateHttpReqTopic(String module, String nodeid)
static String
generateHttpReqTopic(String module, String resname, String nodeid)
static String
generateHttpReqTopic(Service service, String nodeid)
static String
getHttpReqTopicPrefix()
static String
getHttpRespTopicPrefix()
static String
getRestModule(Service service)
static Service
getService(HttpServlet servlet)
获取Rest动态生成HttpServlet里的Service对象,若不是Rest动态生成的HttpServlet,返回nullstatic Map<String,Service>
getServiceMap(HttpServlet servlet)
static boolean
isRestDyn(HttpServlet servlet)
判断HttpServlet是否为Rest动态生成的static <T> T
orElse(T t, T defValue)
static void
setRequestAnnotations(HttpRequest request, Annotation[] annotations)
static void
setServiceMap(HttpServlet servlet, Map<String,Service> map)
-
-
-
方法详细资料
-
createJsonFactory
public static JsonFactory createJsonFactory(RestConvert[] converts, RestConvertCoder[] coders)
-
createJsonFactory
public static JsonFactory createJsonFactory(int features, RestConvert[] converts, RestConvertCoder[] coders)
-
isRestDyn
public static boolean isRestDyn(HttpServlet servlet)
判断HttpServlet是否为Rest动态生成的- 参数:
servlet
- 检测的HttpServlet- 返回:
- 是否是动态生成的RestHttpServlet
-
getService
public static Service getService(HttpServlet servlet)
获取Rest动态生成HttpServlet里的Service对象,若不是Rest动态生成的HttpServlet,返回null- 参数:
servlet
- HttpServlet- 返回:
- Service
-
getServiceMap
public static Map<String,Service> getServiceMap(HttpServlet servlet)
-
setServiceMap
public static void setServiceMap(HttpServlet servlet, Map<String,Service> map)
-
generateHttpReqTopic
public static String generateHttpReqTopic(String module, String resname, String nodeid)
-
getHttpReqTopicPrefix
public static String getHttpReqTopicPrefix()
-
getHttpRespTopicPrefix
public static String getHttpRespTopicPrefix()
-
setRequestAnnotations
@ClassDepends public static void setRequestAnnotations(HttpRequest request, Annotation[] annotations)
-
orElse
@ClassDepends public static <T> T orElse(T t, T defValue)
-
createRestWebSocketServlet
public static <T extends WebSocketServlet> T createRestWebSocketServlet(ClassLoader classLoader, Class<? extends WebSocket> webSocketType, MessageAgent messageAgent)
-
createRestServlet
public static <T extends HttpServlet> T createRestServlet(ClassLoader classLoader, Class userType0, Class<T> baseServletType, Class<? extends Service> serviceType, String serviceResourceName)
-
-