mirror of
https://gitee.com/BDWare/cp.git
synced 2025-01-09 17:34:08 +00:00
add packing logic of heaader.response
This commit is contained in:
parent
1a8cb9c2a7
commit
849e8b6601
@ -3,10 +3,7 @@ package org.bdware.sc.engine.hook;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.bdware.doip.codec.doipMessage.DoipMessage;
|
||||
import org.bdware.doip.codec.doipMessage.DoipMessageFactory;
|
||||
import org.bdware.doip.codec.doipMessage.DoipResponseCode;
|
||||
import org.bdware.doip.codec.doipMessage.MessageHeader;
|
||||
import org.bdware.doip.codec.doipMessage.*;
|
||||
import org.bdware.doip.codec.operations.BasicOperations;
|
||||
import org.bdware.sc.JSEngine;
|
||||
import org.bdware.sc.bean.ContractRequest;
|
||||
@ -76,6 +73,12 @@ public class DOOPAfterExecHandler implements AnnotationHook {
|
||||
// 和HTTP一样,所有需要的字段自己封装,校验规则也比较简单,这里只做简单的包装返回即可!!!
|
||||
if(header != null) {
|
||||
originDoipMsg.header = JsonUtil.fromJson(header, MessageHeader.class);
|
||||
// response字段根据白皮书上的规定,处于header下,人为包装到parameters的response中
|
||||
String headerRespCode = header.get("response") != null ? header.get("response").getAsString() : null;
|
||||
if(headerRespCode != null) {
|
||||
if (originDoipMsg.header.parameters == null) originDoipMsg.header.parameters = new HeaderParameter(null, null);
|
||||
originDoipMsg.header.parameters.response = DoipResponseCode.valueOf(headerRespCode);
|
||||
}
|
||||
}
|
||||
|
||||
if(body != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user