类 AbstractLogger

java.lang.Object
org.coodex.jaxrs.logging.AbstractLogger
所有已实现的接口:
javax.ws.rs.ext.WriterInterceptor
直接已知子类:
ClientLogger, ServerLogger

public class AbstractLogger extends Object implements javax.ws.rs.ext.WriterInterceptor
参考jersey实现编写
  • 字段详细资料

    • REQUEST_PREFIX

      protected static final String REQUEST_PREFIX
      Prefix will be printed before requests
      另请参阅:
    • RESPONSE_PREFIX

      protected static final String RESPONSE_PREFIX
      Prefix will be printed before response
      另请参阅:
    • ENTITY_LOGGER_PROPERTY

      protected static final String ENTITY_LOGGER_PROPERTY
      The entity stream property
    • LOGGING_ID_PROPERTY

      protected static final String LOGGING_ID_PROPERTY
      Logging record id property
    • MAX_ENTITY_SIZE

      protected static final int MAX_ENTITY_SIZE
      另请参阅:
    • _id

      protected final AtomicLong _id
  • 构造器详细资料

    • AbstractLogger

      public AbstractLogger(org.slf4j.Logger log, Level level)
  • 方法详细资料

    • isReadable

      protected static boolean isReadable(javax.ws.rs.core.MediaType mediaType)
      Returns true if specified MediaType is considered textual.

      See READABLE_APP_MEDIA_TYPES.

      参数:
      mediaType - the media type of the entity
      返回:
      true if specified MediaType is considered textual.
    • printEntity

      protected static boolean printEntity(javax.ws.rs.core.MediaType mediaType)
      Returns true if entity has to be printed.
      参数:
      mediaType - the media type of the payload.
      返回:
      true if entity has to be printed.
    • getCharset

      protected static Charset getCharset(javax.ws.rs.core.MediaType m)
    • isEnabled

      protected boolean isEnabled()
    • log

      protected void log(StringBuilder b)
      Logs a StringBuilder parameter at required level.
      参数:
      b - message to log
    • printRequestLine

      protected void printRequestLine(StringBuilder b, String note, long id, String method, URI uri)
    • printResponseLine

      protected void printResponseLine(StringBuilder b, String note, long id, int status)
    • 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
      抛出:
      IOException
      javax.ws.rs.WebApplicationException