use of org.sonar.process.systeminfo.SystemInfoSection in project sonarqube by SonarSource.
the class SystemInfoHttpAction method serve.
@Override
public NanoHTTPD.Response serve(NanoHTTPD.IHTTPSession session) {
if (session.getMethod() != NanoHTTPD.Method.GET) {
return newFixedLengthResponse(METHOD_NOT_ALLOWED, MIME_PLAINTEXT, null);
}
ProtobufSystemInfo.SystemInfo.Builder infoBuilder = ProtobufSystemInfo.SystemInfo.newBuilder();
for (SystemInfoSection sectionProvider : sectionProviders) {
ProtobufSystemInfo.Section section = sectionProvider.toProtobuf();
infoBuilder.addSections(section);
}
byte[] bytes = infoBuilder.build().toByteArray();
return newFixedLengthResponse(OK, PROTOBUF_MIME_TYPE, new ByteArrayInputStream(bytes), bytes.length);
}
Aggregations