URLConnection.getouputstream inside applet not working with SUN JVM...
843807Jul 19 2005 — edited Jul 26 2005Hi,
URLConnection.getouputstream inside applet not working with SUN JVM... same works with MSJVM
We are trying to migrate an application to Sun JVM from MSJVM. In this process application is working fine except for functionality this application is Content(document) Management application in this document view, checkout are working fine but when we are trying to checkIn a file it is not working.
CheckIn of a document is done in 2 steps in this application
1. Document is uploaded to shared folder on of document server (which is different from Application server) - UploadAction class
2. checkIn method is called on copied file.- CheckIn class
Flow should be is as follows.
JSP -> Applet -> Upload -> ChekIn
In case of MS JVM it working fine because flow as mentioned above. But in case of Sun JVM it doesn�t because flow is as follows
JSP-> Applet -> CheckIn
When we debugged we found that call to Upload class is not happening through forward/redirect but it is creating an URL which refers Upload class so we are assuming call to these Action class is happening through this URL/URLconnection.
And further investigation shown that when we are executing with Sun JVM, if you open InputStream of URLConnection both the action classes are getting executed but when you�re opening OutputStream of URLConnection these action classes are not getting invoked.
Also went through forum where its mentioned use HttpURLConnection tried that as well it didnot work tried different content type as well.
We are trying to investigate why call to action class is failing when URLconnection is opened for writing and same works fine with MSJVM and when we open URLConnetion for reading, do we need any special privileges?
JDK we are using is jdk1.4.2
In case anyone has any idea please let us know.
code:
where targetURL is url to action class.
URLConnection urlConnection =
targetURL.openConnection();
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setUseCaches(false);
urlConnection.setRequestProperty("Content-Type",
"application/x-java-serialized-object");
OutputStream outStream = urlConnection.getOutputStream();
to this ourputstream I am uploading the local drive file then the action class will pick this content and write to the server then on this file checkin method is called.
Thanks
Nagaraj