on 10-18-2008 12:31 PM
Hi All
When I am trying to read a URL I am getting the following error.
u201CServer redirected too many times (20)u201D
I get the error only when I run the code from a server application. When I execute the code locally in a java class, the code works with out any errors.
I printed the the Response code which was 401 (Unauthorized).
When i give the URL in the browser, the file opens without any problems.
This is the code that I have used
URL url = new URL( "http://hydhtc137407d/Test/Pdf1.pdf" );
URLConnection urlc = url.openConnection();
if (urlc instanceof HttpURLConnection) {
System.out.println("This is HttpURLConnection");
((HttpURLConnection)urlc).setRequestMethod("GET");
}
// urlc.setDoOutput(true);
urlc.setDoInput(true);
urlc.setUseCaches(false);
// ((HttpURLConnection)urlc).setRequestMethod("GET");
bis = new BufferedInputStream( urlc.getInputStream());
BufferedReader br = new BufferedReader( new InputStreamReader(bis));
String line;
while ((line = br.readLine()) != null)
{
wdComponentAPI.getMessageManager().reportSuccess(line);
}
Any help is appreciated
Deepu
Hi
That becouse of when you are accessing that URL from local it is directiong it to the server....that's fine..but whenever you start accessing it form Server..ance again it is redirecting to the server. ie why it is giving the problem,
Put the candition whenever you accessing it from server not to redirect to sever.
http://help.sap.com/SAPHELP_NW04S/helpdata/EN/2f/e7574174c58547e10000000a1550b0/frameset.htm
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.