cfmcgrady commented on code in PR #2089:
URL:
https://github.com/apache/incubator-celeborn/pull/2089#discussion_r1414835784
##########
service/src/main/scala/org/apache/celeborn/server/common/http/HttpRequestHandler.scala:
##########
@@ -47,21 +47,34 @@ class HttpRequestHandler(
val uri = req.uri()
val (path, parameters) = HttpUtils.parseUri(uri)
val msg = HttpUtils.handleRequest(service, path, parameters)
- val response = msg match {
+ val textType = "text/plain; charset=UTF-8"
+ val jsonType = "application/json"
+ val (response, contentType) = msg match {
case Invalid.invalid =>
- if (prometheusHttpRequestHandler != null) {
- prometheusHttpRequestHandler.handleRequest(uri)
+ if (servletHttpRequestHandlers != null) {
+ val servletHttpRequestHandler =
servletHttpRequestHandlers.find(servlet =>
+ uri == servlet.getServletPath())
+ servletHttpRequestHandler match {
+ case Some(handler) => handler match {
+ case jsonHandler: JsonHttpRequestHandler =>
+ (jsonHandler.handleRequest(uri), jsonType)
+ case _ => (handler.handleRequest(uri), textType)
+ }
+ case _ => (s"Unknown path $uri!", textType)
+ }
Review Comment:
nit
```suggestion
servletHttpRequestHandlers.find(servlet => uri ==
servlet.getServletPath())
.map {
case jsonHandler: JsonHttpRequestHandler =>
(jsonHandler.handleRequest(uri), jsonType)
case handler: ServletHttpRequestHandler =>
(handler.handleRequest(uri), textType)
}.getOrElse((s"Unknown path $uri!", textType))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]