File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed
dss-commons/dss-common/src/main/scala/com/webank/wedatasphere/dss/common/utils Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change 1
- /*
2
- * Copyright 2019 WeBank
3
- * Licensed under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License.
5
- * You may obtain a copy of the License at
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- * Unless required by applicable law or agreed to in writing, software
8
- * distributed under the License is distributed on an "AS IS" BASIS,
9
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- * See the License for the specific language governing permissions and
11
- * limitations under the License.
12
- */
13
-
14
1
package com .webank .wedatasphere .dss .common .utils
15
2
16
3
import org .apache .linkis .server .Message
17
4
18
5
import javax .ws .rs .core .Response
19
6
20
-
21
7
object MessageUtils {
22
8
implicit def messageToResponse (message : Message ): Response =
23
9
Response .status(messageToHttpStatus(message)).entity(message).build()
10
+
24
11
implicit def responseToMessage (response : Response ): Message = response.readEntity(classOf [Message ])
12
+
25
13
def messageToHttpStatus (message : Message ): Int = message.getStatus match {
26
14
case - 1 => 401
27
15
case 0 => 200
@@ -31,4 +19,3 @@ object MessageUtils {
31
19
case 4 => 206
32
20
}
33
21
}
34
-
You can’t perform that action at this time.
0 commit comments