类 AbstractLogger
java.lang.Object
org.coodex.jaxrs.logging.AbstractLogger
- 所有已实现的接口:
javax.ws.rs.ext.WriterInterceptor
- 直接已知子类:
ClientLogger,ServerLogger
参考jersey实现编写
-
嵌套类概要
嵌套类修饰符和类型类说明protected static classHelper class used to log an entity to the output stream up to the specified maximum number of bytes. -
字段概要
字段修饰符和类型字段说明protected final AtomicLongprotected static final StringThe entity stream propertyprotected static final StringLogging record id propertyprotected static final intprotected static final StringPrefix will be printed before requestsprotected static final StringPrefix will be printed before response -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaroundWriteTo(javax.ws.rs.ext.WriterInterceptorContext writerInterceptorContext) protected static CharsetgetCharset(javax.ws.rs.core.MediaType m) protected booleanprotected static booleanisReadable(javax.ws.rs.core.MediaType mediaType) Returnstrueif specifiedMediaTypeis considered textual.protected voidlog(StringBuilder b) Logs aStringBuilderparameter at required level.protected InputStreamlogInboundEntity(StringBuilder b, InputStream stream, Charset charset) protected static booleanprintEntity(javax.ws.rs.core.MediaType mediaType) Returnstrueif entity has to be printed.protected voidprintPrefixedHeaders(StringBuilder b, long id, String prefix, javax.ws.rs.core.MultivaluedMap<String, String> headers) protected voidprintRequestLine(StringBuilder b, String note, long id, String method, URI uri) protected voidprintResponseLine(StringBuilder b, String note, long id, int status)
-
字段详细资料
-
REQUEST_PREFIX
Prefix will be printed before requests- 另请参阅:
-
RESPONSE_PREFIX
Prefix will be printed before response- 另请参阅:
-
ENTITY_LOGGER_PROPERTY
The entity stream property -
LOGGING_ID_PROPERTY
Logging record id property -
MAX_ENTITY_SIZE
protected static final int MAX_ENTITY_SIZE- 另请参阅:
-
_id
-
-
构造器详细资料
-
AbstractLogger
-
-
方法详细资料
-
isReadable
protected static boolean isReadable(javax.ws.rs.core.MediaType mediaType) Returnstrueif specifiedMediaTypeis considered textual.See
READABLE_APP_MEDIA_TYPES.- 参数:
mediaType- the media type of the entity- 返回:
trueif specifiedMediaTypeis considered textual.
-
printEntity
protected static boolean printEntity(javax.ws.rs.core.MediaType mediaType) Returnstrueif entity has to be printed.- 参数:
mediaType- the media type of the payload.- 返回:
trueif entity has to be printed.
-
getCharset
-
isEnabled
protected boolean isEnabled() -
log
Logs aStringBuilderparameter at required level.- 参数:
b- message to log
-
printRequestLine
-
printResponseLine
-
printPrefixedHeaders
protected void printPrefixedHeaders(StringBuilder b, long id, String prefix, javax.ws.rs.core.MultivaluedMap<String, String> headers) -
logInboundEntity
protected InputStream logInboundEntity(StringBuilder b, InputStream stream, Charset charset) throws IOException - 抛出:
IOException
-
aroundWriteTo
public void aroundWriteTo(javax.ws.rs.ext.WriterInterceptorContext writerInterceptorContext) throws IOException, javax.ws.rs.WebApplicationException - 指定者:
aroundWriteTo在接口中javax.ws.rs.ext.WriterInterceptor- 抛出:
IOExceptionjavax.ws.rs.WebApplicationException
-