2016-08-05 91 views
1

我在發送GET請求到Java SAML url(https://en.wikipedia.org/wiki/SAML_2.0ApacheHttpClient4時出現問題。我從前一個請求中獲得的位置標題中獲取url,返回302.然後,我在url上執行GET,格式爲https://some.domain/?SAMLRequest=...&RelayState=...。 Jersey以某種方式卡住了它,並且從未發送實際的請求(我已經檢查了兩個Charles並啓用了日誌過濾器,但GET從未發生過,它甚至不嘗試)。它被貼在下面一行:澤西島客戶端卡在SAML GET請求

PoolingClientConnectionManager - Connection request: [route: {tls}->http://127.0.0.1:8888->https://some.domain][total kept alive: 3; route allocated: 2 of 2; total allocated: 7 of 20]

回答

0

這是一個艱難的,但是我終於設法解決它通過添加ClientFilter於只做以下客戶:

/** 
* This class is only used to solve cases where a Client gets stuck in a redirect process. 
*/ 
public class MyClientFilter extends ClientFilter { 

    @Override 
    public ClientResponse handle(ClientRequest clientRequest) throws ClientHandlerException { 
     return getNext().handle(clientRequest); 
    } 
} 

不知何故,它設法強制客戶端繼續遵循重定向。