use of com.navercorp.pinpoint.io.request.DefaultServerRequest in project pinpoint by naver.
the class DefaultServerRequestFactory method newServerRequest.
@Override
public <T> ServerRequest<T> newServerRequest(Message<T> message) throws StatusException {
final Context current = Context.current();
final Header header = ServerContext.getAgentInfo(current);
if (header == null) {
throw Status.INTERNAL.withDescription("Not found request header").asException();
}
final TransportMetadata transportMetadata = ServerContext.getTransportMetadata(current);
if (transportMetadata == null) {
throw Status.INTERNAL.withDescription("Not found transportMetadata").asException();
}
InetSocketAddress inetSocketAddress = transportMetadata.getRemoteAddress();
ServerRequest<T> request = new DefaultServerRequest<>(message, inetSocketAddress.getHostString(), inetSocketAddress.getPort());
return request;
}
Aggregations