Re: [jnc-users] JNC + https
Status: Beta
Brought to you by:
soapy
From: Marco T. <ma...@mt...> - 2007-11-10 14:34:35
|
Eric C. wrote: > Hello, > > I have an app that breaks when I change from http to https when posting data > to a web app. What's the error message? What OS are you using? What JNC version? > Is it possible that JNC does not support https at this time? Yes, it's possible. I actually never tried it. But it could just as well be that a required object isn't pulled into the binary. Therefore it would be helpful to know the error message :-) Marco > Please let me know. > > Thanks, > Eric. > > > Here's my code: > > /** > * data type: > * 0 = ascii > * 1 = binary > */ > public static Object postToUrl(String myUrl, String data, int dataType) { > String line = ""; > byte[] content = null; > > System.out.println("called post TO URL: " + myUrl + " data tyhpe : " + > dataType); > > try { > // Send data > URL url = new URL(myUrl); > URLConnection conn = url.openConnection(); > conn.setDoOutput(true); > OutputStreamWriter wr = new > OutputStreamWriter(conn.getOutputStream()); > wr.write(data); > wr.flush(); > > > String ret = ""; > // Get the response > BufferedReader rd = new BufferedReader(new > InputStreamReader(conn.getInputStream())); > //System.out.println("rd: " + rd.); > > if(dataType == 0) { //sent back a send > code and the media and media send as string > while ((ret = rd.readLine()) != null) { > line += ret; > } > } else { > int clen = conn.getContentLength(); > System.out.println("content length: " + clen); > content = new byte[clen]; > > for(int i=0; i<content.length; i++) { > int r = rd.read(); > content[i] = (byte) r; > } > } > wr.close(); > rd.close(); > } catch (Exception e) { > } > System.out.println("line: " + line.trim()); > > if(dataType == 0) { > return line; > } else { > return content; > } > } > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > javaCompiler-users mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/javacompiler-users |