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-
141package com .webank .wedatasphere .dss .common .utils
152
163import org .apache .linkis .server .Message
174
185import javax .ws .rs .core .Response
196
20-
217object MessageUtils {
228 implicit def messageToResponse (message : Message ): Response =
239 Response .status(messageToHttpStatus(message)).entity(message).build()
10+
2411 implicit def responseToMessage (response : Response ): Message = response.readEntity(classOf [Message ])
12+
2513 def messageToHttpStatus (message : Message ): Int = message.getStatus match {
2614 case - 1 => 401
2715 case 0 => 200
@@ -31,4 +19,3 @@ object MessageUtils {
3119 case 4 => 206
3220 }
3321}
34-
You can’t perform that action at this time.
0 commit comments