Zuul忽略空的Query参数

时间:2016-02-02 17:23:36

标签: spring-boot spring-cloud microservices netflix-zuul

以下是我的ZUUL配置的样子。

zuul:
  routes:
    UserCards-V1: 
         path: /user/v1/accountholders/*/cards/**
         service-id: usercards-v1
         strip-prefix: false
    UserTransactions-V1_1: 
         path: /user/v1/accountholders/*/transactions
         service-id: usertransactions-v1
         strip-prefix: false
    UserTransactions-V1_2:  
         path: /user/v1/accountholders/*/accounts/*/transactions
         service-id: usertransactions-v1
         strip-prefix: false
    UserAccounts-V1: 
         path: /user/v1/accountholders/*/accounts/**
         service-id: useraccounts-v1
         strip-prefix: false
    UserCardholders-V1: 
         path: /user/v1/accountholders/**
         service-id: usercardholders-v1
         strip-prefix: false 

我遇到的问题是当我点击这样的网址时http://localhost:8006/user/v1/accountholders/2/transactions?page= 我的API控制器中有一个地图,它读取查询参数但它以空{}

的形式出现

当我点击下面的网址时: - http://localhost:8006/user/v1/accountholders/2/transactions?page=123。地图以{page = [123]}的形式出现,效果很好。

任何人都可以帮助我吗我需要知道页面参数是空的,或者传递的任何其他参数都是空的。如果我在没有Zuul的情况下直接点击我的api,那么一切正常。我认为它的Zuul忽略了它而不是将它转发给api。

这是我的API控制器: -

 @RequestMapping(value = "/accountholders/{cardHolderId}/transactions", produces = "application/json; charset=utf-8", consumes = "application/json", method = RequestMethod.GET)
    @ResponseBody
    public TransactionsVO getTransactions(@PathVariable("cardHolderId") final String cardHolderId,

            @RequestParam final MultiValueMap<String, String> allRequestParams) {

        final String requestTimeStamp = DateUtil.getUTCDate();
        iUrlValidator.validate(cardHolderId, null, allRequestParams);
        return iTransactionService.getCardHolderTransactionsInfo(cardHolderId, requestTimeStamp, pageNumber, pageSize,
                allRequestParams);
    }

0 个答案:

没有答案