cancel
Showing results for 
Search instead for 
Did you mean: 

Copy a file from server to the client - URLConnection to a Portal page

Former Member
0 Kudos

Hello:

I have an application running on the client side. When the app startup it must open a file which is at the server side, to be more specific, the file is at KM content of the portal.

I try to read it with URLConnection to copy the file from the server to the client, the app will do it, but "Server returned HTTP response code: 401 for URL:"

If you copy&paste the url's file directly on the browser (http://host:port/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/ImagenesIM/file.txt) a login popup (look and feel windows) is display. After entering the user and psw the file is open without problem.

Any idea what can I use or how do it ?.

I think that probably I have to move the app to a was directory instead of portal directory.

The app is execute via *.jnlp with a link at a portal page.

Thanks a lot for your time.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Javier,

401 means authentication error, i.e. your application is not authenticated to KM.

What you can do? Actually, it depends. Check current cookies in your application, probably there are SSO coockie or J2EE authentication cookie. You may try to set this cookies in URLConnection (via addHeader). Otherwise you have to supply authentication creadentials to URLConnection (also via addHeader, most probably, via Basic HTTP authentication scheme).

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Thanks Valery Silaev:

I don't program any SSO cookie or J2EE authentication cookie so I think that my app doesn't have them, am I wrong?

It's a desktop app (java applet) which is execute at the client and needs some file which are inside of KM content.

Thanks a lot.