Note that there are some explanatory texts on larger screens.

plurals
  1. POJersey seemingly adding port onto url in client request
    primarykey
    data
    text
    <p>I'm using some basic Java code to send a RESTful request through Jersey and for some reason Jersey is appending the :443 port to the end of all of my URLs which causes CAS to fail (proxy tickets are generated elsewhere for a specific URL; adding in port breaks this).</p> <p>Is there a way to tell Jersey to NOT send the 443 port as part of the URL?</p> <p>Edit: fyi I deleted my previous ticket before realizing that the issue is truly inside of Jersey.</p> <p>Edit2: Added code below; I had to strip out a few items but this is essentially what I'm using. It's in a generic method to work with a specific API we're working with; I added the doNotSend mode stuff in to test the url; the url gets returned from that without :443 but when it executes through Jersey it has :443 added which throws CAS authentication off.</p> <pre><code>// Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager(){ public X509Certificate[] getAcceptedIssuers(){return null;} public void checkClientTrusted(X509Certificate[] certs, String authType){} public void checkServerTrusted(X509Certificate[] certs, String authType){} }}; try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } catch (Exception e) { ; } Client client = Client.create(); String url = Configuration.getOption(CONFIG_REST_URL) + actionPath; if (dontSendMode) { GGResponse r = new GGResponse(); r.setUrl(url); return r; } if (StringUtils.isNotEmpty(proxy_ticket)) { if (url.contains("?")) { url += "&amp;"; } else { url += "?"; } url += String.format("ticket=%s", proxy_ticket); } WebResource.Builder resourceBuilder = client .resource(url) .accept("application/json"); ClientResponse response = null; if (method.equalsIgnoreCase("GET")) { response = resourceBuilder.get(ClientResponse.class); } if (method.equalsIgnoreCase("POST")) { response = resourceBuilder.post(ClientResponse.class, json); } if (method.equalsIgnoreCase("DELETE")) { response = resourceBuilder.delete(ClientResponse.class); } if (method.equalsIgnoreCase("PUT")) { response = resourceBuilder.put(ClientResponse.class, json); } String output = null; String etagResponse = null; String error = null; if (response != null &amp;&amp; response.getStatus() == 200) { output = response.getEntity(String.class); } else { System.out.println(error); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload