R
RVic
I have an application that must run in windows which must post to a servletrunning on a secure server. I can WinSCP into that server, and I can use PuTTY to ssh into that server. But I am quite clueless how I can post to a servlet there? Is there something I can pass in posting, or something I do with my URLConnection or URL variable to allow me access as I get with WinSCP or PuTTY? Thank you.
URL postURL = new URL(servletURL);
HttpURLConnection conn = (HttpURLConnection) postURL.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.connect();
StringBuilder sb = new StringBuilder();
sb.append(vtkey+"="+ paramval);
out.write(sb.toString());
out.flush();
URL postURL = new URL(servletURL);
HttpURLConnection conn = (HttpURLConnection) postURL.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.connect();
StringBuilder sb = new StringBuilder();
sb.append(vtkey+"="+ paramval);
out.write(sb.toString());
out.flush();