Note that there are some explanatory texts on larger screens.

plurals
  1. POHttps Post : MalformedURLException on App Engine
    primarykey
    data
    text
    <p>When I am sending POST request to an url with authentication from GAE, I am getting MalformedURLException on urlConn.getResponseCode() function. </p> <p>This problem arises only on the deployment server and does not arise when I run the code on local server.</p> <pre><code>Invalid URL specified: https://user:passtoken@twilix.exotel.in/v1/Accounts/user/Sms/send java.net.MalformedURLException: Invalid URL specified: https://user:passtoken@twilix.exotel.in/v1/Accounts/user/Sms/send at com.google.appengine.api.urlfetch.URLFetchServiceImpl.convertApplicationException(URLFetchServiceImpl.java:120) at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:43) at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:417) at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:296) </code></pre> <p>My code:</p> <pre><code>String urlString = "https://user:passtoken@twilix.exotel.in/v1/Accounts/user/Sms/send"; URL url = new URL(urlString.toString()); String userpass = "user:passtoken"; String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes()); urlConn = (HttpURLConnection) url.openConnection(); urlConn.setRequestMethod("POST"); urlConn.setRequestProperty ("Authorization", basicAuth); urlConn.connect(); responseCode = urlConn.getResponseCode(); //Throws Exception </code></pre> <p>Everything works fine when I try to set my url as <a href="https://httpbin.org/post" rel="nofollow">https://httpbin.org/post</a></p> <p>Is this a bug of GAE or some problem with my code?</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.
    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