how to send request to 'https' urls in google app engine ? how to send authentication details and body in java.net.HttpURLConnection ?
i tried using java.net api code as shown below. but i got the exception :- java.security.AccessControlException: access denied (java.net.NetPermission setDefaultAuthenticator) import java.net.Authenticator; import java.net.HttpURLConnection; import java.net.InetAddress; import java.net.PasswordAuthentication; import java.net.URL; public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { Authenticator.setDefault(new MyAuthenticator()); try { URL url = new URL("https://.........."); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("GET"); System.out.println("Response Code : " + connection.getResponseCode ()); System.out.println("Response Message :\n " + connection.getResponseMessage()); if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { //OK } else { //Error code } } catch (Exception e) { } } class MyAuthenticator extends Authenticator { protected PasswordAuthentication getPasswordAuthentication() { String username = "username"; String password = "password"; return new PasswordAuthentication(username, password.toCharArray ()); } } -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=.