Jersey的请求通过ContainerServlet,调用ServerRunTime来进行分发处理
ContainerRequest,ContainerResponse是其包装的请求和响应
MessageBodyFactory 输入输出的核心工厂,MessageBodyReader和MessageBodyWriter分别对应处理类。
final Set<MessageBodyReader> customMbrs = Providers.getCustomProviders(locator, MessageBodyReader.class);
final Set<MessageBodyReader> mbrs = Providers.getProviders(locator, MessageBodyReader.class);
final Set<MessageBodyWriter> customMbws = Providers.getCustomProviders(locator, MessageBodyWriter.class);
final Set<MessageBodyWriter> mbws = Providers.getProviders(locator, MessageBodyWriter.class);
Consumers 配置请求处理器,在ReaderInterceptorExecutor的第210行根据注解查找请求reader
final MessageBodyReader bodyReader = workers.getMessageBodyReader(
context.getType(),
context.getGenericType(),
context.getAnnotations(),
context.getMediaType(),
ReaderInterceptorExecutor.this);
Produces 配置响应处理器,在WriterInterceptorExecutor的第241行来根据注解查找响应writer
final MessageBodyWriter writer = workers.getMessageBodyWriter(context.getType(), context.getGenericType(),
context.getAnnotations(), context.getMediaType(), WriterInterceptorExecutor.this);