如何从Spring Boot Rest Controller获取状态描述

huangapple go评论79阅读模式
英文:

How to get status description from spring boot rest controller

问题

我在Spring Boot中有一个带有内嵌Tomcat的REST控制器该控制器从ASP .NET应用程序调用他们会检查StatusDescription是否为OK”。我的响应数据是正常的但Status Description始终为空字符串

是否有任何方法可以获取StatusDescription

示例API

@GetMapping(value = "/updateStatus", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<CheckStatusResponse> updateStatusResponse(@RequestParam(value = "TransactionId", required = false) String transactionID,
                                                @RequestParam(value = "VenderId", required = false) String vendorId,
                                                @RequestParam(value = "Status", required = false) String transactionStatus,
                                                @RequestParam(value = "BcCode", required = false) String bcId,
                                                @RequestParam(value = "rrn", required = false) String rrn) {
    AepsTransaction transaction = new AepsTransaction();
    transaction.setTransactionId(transactionID);
    transaction.setTransactionStatus(transactionStatus);
    transaction.setRrn(rrn);
    transaction.setBcId(bcId);
    return new ResponseEntity<>(aepsService.upDateStatusCallBackHandeling(transaction), HttpStatus.OK);
}
英文:

I have a rest controller in springboot with embedded tomcat. the controller is calling from ASP .NET application where they are checking StatusDescription is "OK" or not. My response is ok with data but Status Description is always empty String.

is there any way to get StatusDescription?

example api:

@GetMapping(value = &quot;/updateStatus&quot;, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity&lt;CheckStatusResponse&gt; updateStatusResponse(@RequestParam(value = &quot;TransactionId&quot;, required = false) String transactionID,
                                                    @RequestParam(value = &quot;VenderId&quot;, required = false) String vendorId,
                                                    @RequestParam(value = &quot;Status&quot;, required = false) String transactionStatus,
                                                    @RequestParam(value = &quot;BcCode&quot;, required = false) String bcId,
                                                    @RequestParam(value = &quot;rrn&quot;, required = false) String rrn) {
        AepsTransaction transaction = new AepsTransaction();
        transaction.setTransactionId(transactionID);
        transaction.setTransactionStatus(transactionStatus);
        transaction.setRrn(rrn);
        transaction.setBcId(bcId);
        return new ResponseEntity&lt;&gt;(aepsService.upDateStatusCallBackHandeling(transaction), HttpStatus.OK);
    }

答案1

得分: 0

我找到了答案。这个问题出现在Tomcat版本大于8.5的情况下。如果你将Tomcat降级到8.0,问题就会解决。

英文:

i found the answer. This problem occur for tomcat version greater than 8.5. if you downgrade your tomcat to 8.0, the problem is solved

huangapple
  • 本文由 发表于 2020年8月20日 00:29:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/63491260.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定