public interface Invoker extends MimeType
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
REQUEST_KEY
数据池中的key,request对象。
|
static String |
RESPONSE_KEY
数据池中的key,response对象。
|
static String |
RETURN_DATA_KEY
数据池中的key,该数据是表示请求方法的执行返回值。
|
static String |
ROOT_DATA_KEY
数据池中的key,数据池中的自关联,相当于 this的含义。
|
| 限定符和类型 | 方法和说明 |
|---|---|
default void |
computeIfAbsent(String key,
Function<String,Object> mappingFunction)
If the specified key is not already associated with a value (or is mapped
to
null), attempts to compute its value using the given mapping
function and enters it into this map unless null. |
String |
contentType()
设置内容类型类型,如果没有配置那么会通过 renderType 配置进行自动推断,若 @RenderType 也未配置,那么不会进行任何操作。
|
void |
contentType(String contentType)
设置内容类型类型,如果没有配置那么会通过 renderType 配置进行自动推断,若 @RenderType 也未配置,那么不会进行任何操作。
|
default <T> T |
fillForm(Class<? extends T> formType)
将Request中的参数填充到 formType 类型对象上,formType 的创建将会使用
AppContext.justInject(Object) 方法。 |
<T> T |
fillForm(Class<? extends T> formType,
T bean)
将Request中的参数填充到 formType 类型对象上,类型实例由参数指定
|
default void |
forEach(BiConsumer<String,Object> action)
Performs the given action for each entry in this map until all entries
have been processed or the action throws an exception.
|
default Object |
get(String key)
从数据池中获取数据
|
AppContext |
getAppContext()
获取当前
AppContext 对象。 |
javax.servlet.http.HttpServletRequest |
getHttpRequest()
获取
HttpServletRequest 对象。 |
javax.servlet.http.HttpServletResponse |
getHttpResponse()
获取
HttpServletResponse 对象。 |
default Object |
getOrDefault(String key,
Object defaultValue)
Returns the value to which the specified key is mapped, or
defaultValue if this map contains no mapping for the key. |
default <V> V |
getOrMap(String key,
Function<Object,V> defaultValue)
Returns the value to which the specified key is mapped, or
defaultValue if this map contains no mapping for the key. |
default String |
getRequestPath()
获取当前请求路径。
|
boolean |
isLockKey(String key)
判断一个 key 是否被 lock 了。
|
default Set<String> |
keySet()
获取数据容器中已经保存的数据 keys 。
|
void |
lockKey(String key)
将一个 key 进行锁定。
|
Mapping |
ownerMapping()
本次请求的 Action,如果没有命中任何 Mapping 那么会返回空。
|
default void |
put(String key,
Object value)
/**
将新的值设置到数据池中,如果尝试覆盖已经被锁定的key,会引发
UnsupportedOperationException 类型异常。 |
default void |
putIfAbsent(String key,
Object value)
If the specified key is not already associated with a value (or is mapped
to
null) associates it with the given value and returns
null, else returns the current value. |
default void |
remove(String key)
从数据池中删除数据,如果尝试删除已经被锁定的key,会引发
UnsupportedOperationException 类型异常。 |
getMimeTypeAppContext getAppContext()
AppContext 对象。javax.servlet.http.HttpServletRequest getHttpRequest()
HttpServletRequest 对象。javax.servlet.http.HttpServletResponse getHttpResponse()
HttpServletResponse 对象。String contentType()
void contentType(String contentType)
Mapping ownerMapping()
default <T> T fillForm(Class<? extends T> formType)
AppContext.justInject(Object) 方法。<T> T fillForm(Class<? extends T> formType, T bean)
default void remove(String key)
UnsupportedOperationException 类型异常。key - 数据keylockKey(String)default void put(String key, Object value)
UnsupportedOperationException 类型异常。key - 数据keyvalue - 数据 valuelockKey(String)boolean isLockKey(String key)
void lockKey(String key)
UnsupportedOperationException 类型异常。key - 要被锁定的key,大小写敏感。default String getRequestPath()
String contextPath = httpRequest.getContextPath();
String requestPath = httpRequest.getRequestURI();
if (requestPath.startsWith(contextPath)) {
requestPath = requestPath.substring(contextPath.length());
}
return requestPath;
default void forEach(BiConsumer<String,Object> action)
action - The action to be performed for each entryNullPointerException - if the specified action is nulldefault void putIfAbsent(String key, Object value)
null) associates it with the given value and returns
null, else returns the current value.key - key with which the specified value is to be associatedvalue - value to be associated with the specified keyUnsupportedOperationException - if the put operation is not supported by this mapdefault Object getOrDefault(String key, Object defaultValue)
defaultValue if this map contains no mapping for the key.key - the key whose associated value is to be returneddefaultValue - the default mapping of the keydefaultValue if this map contains no mapping for the keydefault <V> V getOrMap(String key, Function<Object,V> defaultValue)
defaultValue if this map contains no mapping for the key.key - the key whose associated value is to be returneddefaultValue - the default mapping of the keydefaultValue if this map contains no mapping for the keydefault void computeIfAbsent(String key, Function<String,Object> mappingFunction)
null), attempts to compute its value using the given mapping
function and enters it into this map unless null.
If the function returns null no mapping is recorded. If
the function itself throws an (unchecked) exception, the
exception is rethrown, and no mapping is recorded. The most
common usage is to construct a new object serving as an initial
mapped value or memoized result.
key - key with which the specified value is to be associatedmappingFunction - the function to compute a valueUnsupportedOperationException - if the put operation is not supported by this mapCopyright © 2020. All rights reserved.