我有以下代码:
template<class... Args>
using select = typename std::disjunction<Args...>::type;
template<bool V, class T>
struct when {
static constexpr bool value = V;
using type = T;
};
template<bool is_signed, std::size_t has_sizeof>
using find_int_type = select<
when<is_signed, select<
when<has_sizeof==4, int>,
when<has_sizeof==8, std::int64_t>,
when<false, void>
>>,
when<!is_signed, select<
when<has_sizeof==4, unsigned int>,
when<has_sizeof==8, std::uint64_t>,
when<false, void>
>>
>;
运行@Service
public class MyClient {
private AsyncRestTemplate rest;
private HttpHeaders headers;
public MyClient() {
this.rest = new AsyncRestTemplate();
}
@PostConstruct
private void updateHeaders() {
headers.add(RmpConstants.CONTENT_TYPE, RmpConstants.APPLICATION_JSON);
headers.add(RmpConstants.ACCEPT, RmpConstants.PREFIX_ALL);
}
public void send() {
......
.....
ListenableFuture<ResponseEntity<JsonNode>> exchange = rest.exchange(fullUrl, httpMethod,
requestEntity, JsonNode.class);
}
时出现以下错误:
rest.exchange
我正在从POSTMAN运行它。
如果我照原样复制该网址,并从我的浏览器中运行它,则它可以工作。
(例如:(GET),网址:javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1964)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:328)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:322)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1614)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:162)
at org.springframework.http.client.SimpleBufferingAsyncClientHttpRequest$1.call(SimpleBufferingAsyncClientHttpRequest.java:88)
at org.springframework.http.client.SimpleBufferingAsyncClientHttpRequest$1.call(SimpleBufferingAsyncClientHttpRequest.java:77)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.security.cert.CertificateException: No subject alternative names present
at sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:145)
at sun.security.util.HostnameChecker.match(HostnameChecker.java:94)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:436)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:200)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1596)
请问您该怎么办?