Note that there are some explanatory texts on larger screens.

plurals
  1. POset proxy in java
    primarykey
    data
    text
    <p>I create a service that post something through the internet and everything's fine. But when I deploy it to our server I get connection status:403, forbidden. I think it is because our server won't allow direct access to the internet without login first. We have to login first in the browser with our username/password to access the internet.</p> <p>I notice that if I have login and access the internet in the server, the service I deploy run alright. But I don't think it's practical because in that case my service won't run if someone or I don't login first.</p> <p>I have tried setting the proxy in the java code but to no avail. Could someone help me with this problem? Here is I post my service snippet.</p> <pre><code>System.getProperties().put("http.proxySet", "true"); System.getProperties().put("http.proxyHost", myHost); System.getProperties().put("http.proxyPort", "8080"); System.getProperties().put("http.proxyUser", myUser); System.getProperties().put("http.proxyPassword", myPassword); System.getProperties().put("http.nonProxyHosts", "localhost|127.0.0.1"); try { URL url = new URL(urlAddress); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("POST"); con.setDoOutput(true); con.setDoInput(true); ... if (con.getResponseCode() == HttpURLConnection.HTTP_OK) { System.out.println("connection OK"); istrm = con.getInputStream(); if (istrm == null) { System.out.println("istrm == null"); } ... } else { System.out.println("Response: " + con.getResponseCode() + ", " + con.getResponseMessage()); } } </code></pre> <p>And my process goes to else block and gets response message 403 </p>
    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.
 

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