You are not logged in.
Pages: 1
Hi folks,
I am facing very strange problem thats may be concerning to OS. Actually I have piece of code that perfectly working in Windows environment but failed in UNIX.
When I called the method getContentType(), its returning null in UNIX but retruned "text/comma-separated-values" in windows.
For have a look:-
URL url = URLUtil.makeURL(strUrl);
HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
httpURLConnection.usingProxy();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setAllowUserInteraction(false);
httpURLConnection.setDoInput(true);
httpURLConnection.setRequestProperty("Content-type","text/comma-separated-values");
Log.customer.debug("HttpURLConnection" + httpURLConnection);
Log.customer.debug("HttpURLConnection Content Type" + httpURLConnection.getContentType());
InputStream fromServer = httpURLConnection.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(fromServer));
Log.customer.debug("InputStream Return Value" + in);
Here also I am not able to get any value for getInputStream() method also in UNIX environment.
Please help me, I need it's very soon.
Thanks in advance.
httpURLConnection.setRequestProperty("Content-type","text/comma-separated-values");
Just a pure guess: could it possibly be a case-sensitive/insensitive issue where it
varies by platform? Because, the true proper HTTP header is "Content-Type", with
capital "C" and "T", both... Of course, I believe it's either a requirement or at least a
recommendation that you be case-insensitive regarding header fields... But, maybe
on whatever platform you're on, they don't for some reason... *shrug*
Alternatively, perhaps "text/comma-separated-values" isn't recognized as a valid
content type on one platform, while it is valid on the other... Not sure if Java cares
about configured MIME types from "/etc/mime.types" or "~/.mime.types" or wherever
your particular Unix system configures such things... But, perhaps it's something
to consider, anyway... Try adding "text/comma-separated-values" and see if that
helps...
Offline
Hi,
Was any solution, found for this. Facing the same issue. Happens for secured protocol (https) URL. The versions of Java on both machines is the same.
Pages: 1