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

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.

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

Similar Messages

  • Copy a .swf file from server side to client using signed applet

    Hello All,
    I already have my applet signed and its working pretty well. However I want to know how can I import a .swf file into clients machine. The .swf file initially is on server side, my applet checks whether this .swf file exists already on client machine. If not it copies it to his machine.
    I know how to chk if the file already exits on client machine but I am not sure how to copy this .swf file to his machine if its missing.
    May be I need to set some input buffers from server side and then copy them to his machine.
    Can some one throw some light on this issue ??

    Hello to all Java Code Masters out thr,
    I am trying to copy a .swf file from server side to client side, however I am unsuccessful in writing the correct data. By correct data I mean that , the data does gets saved on the client side in the .swf file, and the size of the .swf file on client side is as expected, but some how I don't know why the data is not the same as expected.
    I tried opening up both the swf file, one which is on server side and the other which is on client side. And both looked different in the notepad.
    When I opens up the client side .swf file on browser it shows nothing while the .swf file on server side worked fine.
    Here is a snap shot of the two .swf files when opened in notepad:
    clientside.swf
    坃ࡓ죃鱸뷤瀉�ᡚ穸s歒斷뛉쭬ⶲ뉯緤░뉋쭬틲��毳띵뺤畮祮୹釯烉쉍‼➀Ƿℵ㼤ꦅ㼌⡉⁈ș㖩䈼ꦓɊጵꨘ妆ၸ쇠鳳ﯯ龜괯䪅�쿾칿칷컹緶履殖㋿罣쯻杬�懨�E�翂䶙幷鿠︡拡ﬦ댨꾖政ᯋὣꯤ糥䧩缿䨗捫嶺깼瘶羋⯞勹쪾癞ঞ頁韧୘롻ⱖ撯貊攗閩㫙↳萰Ⳁ⼈쳂荡᧰ﻶ顠꓈鸎싔㿄㰧柂䪄러䂀좹㏠ꕊ㌏힟䘜㦴⌙⍈㽾ꙴ㿯렑㽔serverside.swf
    CWS�� x���     p��ZxzS�Rk�e��l��-o��}�%K�l�������]��ku���nu��nyy���pM�< �'�5!$����I
    (H �
    5<B
    ��J5��Yx��������/����J������w����}���
    k�2c��lg���a��\�%��serverside.swf is what I expect to be saved, but clientside.swf is what i get.
    Below is a code snippet which I am trying :
      public void writeswftoclient(String swfcontent) {
        String userHome = System.getProperty("user.home" );
        String ImoracleDirectory = userHome + "\\MyFolder";
        File fdirectory = new File(ImoracleDirectory);
        if(!fdirectory.isDirectory()) {
          fdirectory.mkdir();
        String playlist = ImoracleDirectory + "\\clientside.swf";
        File fplaylist = new File(playlist);
        try {
          Writer output = null;
          output = new BufferedWriter(new FileWriter(fplaylist,true));
          *System.out.println(swfcontent);*
          *output.write(swfcontent);*
          output.close();
        catch (Exception e) {
          System.out.println("Cannot create or write to the playlist");
      }In above code I am trying to write the string swfcontent, which contains the data shown above in serverside.swf, to clientside.swf.
    Interesting thing is that I am doing System.out.println(swfcontent); just before writing the data to clientside.swf using output.write(swfcontent);. And System.out.println does print the write data on the java console. However I dont know out of what reason the data doesnt get written correctly on the client's computer.
    Kindly help me in this plzzzzzzzzzz.

  • Drive Redirection virtual channel hangs when copying a file from server to client over RDP 8.1

    Problem Summary:
    A UTF-8 without BOM Web RoE XML file output from a line of business application will not drag and drop copy nor copy/paste from a Server 2012 R2 RD Session Host running RD Gateway to a Windows 7 Remote Desktop client over an RDP 8.1 connection and the Drive
    Redirection virtual channel hangs.  The same issue affects a test client/server with only Remote Desktop enabled on the server.
    Other files copy with no issue.  See below for more info.
    Environment:
    Server 2012 R2 Standard v6.3.9600 Build 9600
    the production server runs RDS Session Host and RD Gateway roles (on the same server).  BUT,
    the issue can be reproduced on a test machine running this OS with simply Remote Desktop enabled for Remote Administration
    Windows 7 Pro w SP1v6.1.7601 SP1 Build 7601 running updates to support RDP 8.1
    More Information:
    -the file is a UTF-8 w/o BOM (Byte Order Marker) file containing XML data and has a .BLK extension.  It is a Web Record of Employment (RoE) data file exported from the Maestro accounting application.
    -the XML file that does not copy does successfully validate against CRA's validation XML Schema for Web RoE files
    -Video redirection is NOT AFFECTED and continues to work
    -the Drive Redirection virtual channel can be re-established by disconnecting/reconnecting
    -when the copy fails, a file is created on the client and is a similar size to the original.  However, the contents are incomplete.  The file appears blank but CTRL-A shows whitespace
    -we can copy the contents into a file created with Notepad and then that file, which used to copy, will then NOT copy
    -the issue affects another Server 2012 R2 test installation, not just the production server
    -it also affects other client Win7 Pro systems against affected server
    -the issue is uni-directional i.e. copy fails server to client but succeeds client to server
    -I don't notice any event log entries at the time I attempt to copy the file.
    What DOES WORK
    -downgrading to RDP 7.1 on the client WORKS
    -modifying the file > 2 characters -- either changing existing characters or adding characters (CRLFs) WORKS
    -compressing the file WORKS e.g. to a ZIP file
    -copying OTHER files of smaller, same, and larger sizes WORKS
    What DOES NOT WORK?
    -changing the name and/or extension does not work
    -copying and pasting affected content into a text file that used to have different content and did copy before, then does not work
    -Disabling SMB3 and SMB2 does not work
    -modifying TCP auto-tuning does not work
    -disabling WinFW on both client and server does not work
    As noted above, if I modify the affected file to sanitize it's contents, it will work, so it's not much help.  I'm going to try to get a sample file exported that I can upload since I can't give you the original.
    Your help is greatly appreciated!
    Thanks.
    Kevin

    Hi Dharmesh,
    Thanks for your reply!
    The issue does seem to affect multiple users.  I'm not fully clear on whether it's multiple users and the same employee's file, but I suspect so.
    The issue happens with a specific XML file and I've since determined that it seems to affect the exported RoE XML file for one employee (record?) in the software.  Other employees appear to work.
    The biggest issue is that there's limited support from the vendor in this scenario.  Their app is supported on 2012 R2 RDS.
    What I can't quite wrap my head around are
    why does it work in RDP 7.1 but not 8.1?  What differences between the two for drive redirection would have it work in 7.1 and not 8.1?
    when I examine the affected file, it really doesn't appear any different than one that works.  I used Notepad++ and it shows the encoding as the same and there doesn't appear to be any invalid characters in the affected file.  I wondered
    if there was some string of characters that was being misinterpreted by RDP or some other operation and blocked somehow but besides having disabled AV and firewall software on both ends, I'm not sure what else I could change to test that further
    Since it seems to affect only the one employee's XML file AND since modifying that file to change details in order to post it online would then make that file able to be copied, it seems I won't be able to post a sample.  Too bad.
    Kevin

  • How to download a file from server machine to client machine using jsp

    Hi,
    In my application, I have an excel file stored on my server machine. How can I download that excel file on to my client machine using jsp. Is there any other way I can open that file from my machine and save it in my machine using jsp/java?
    Its an emergency for me to do this.
    Can anyone provide me the full code to download a file from server machine as I don't have
    time to browse through various sites.
    thanks in advance,
    Tiijnar

    Please post your code using code tags (click on CODE above the text area, when posting)
    response.setContentType("application/octet-stream");Why octet-stream? Set the correct mime-type.
    String disHeader = "Attachment; Filename=\"filename\"";The filename should just be the file's name. Not the complete path to the file! This will tell anyone where the file is located on the server. It's also inconvenient because by default,the browser will suggest it as the name for the download.
    Your way of writing to the output stream is just plain wrong. See this snippet (picked from [http://balusc.blogspot.com/2007/07/fileservlet.html])
            BufferedInputStream input = null;
            BufferedOutputStream output = null;
            try {
                // Open streams.
                input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE);
                output = new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
                // Write file contents to response.
                byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
                int length;
                while ((length = input.read(buffer)) > 0) {
                    output.write(buffer, 0, length);
                // Finalize task.
                output.flush();
            } finally {
                // Gently close streams.
                close(output);
                close(input);
            }

  • Copying design files from server to Synology NAS

    We have moved the Design files from one server to another - Now the links are broken. How can I fix that automatically, so all the files would find their links again? Indesign finds the links automatically, so everything works with indesign, but adobe Illustrator doesn't find the links. The path of the both servers are exactly the same(shown in illustrator).

    Drive letters are user specific. When you run jboss it runs as you, with your shared drives. When you run it as a service, it runs as guest or another user so your drive letters are meaningless.
    Either setup the user or use UNC

  • Move files from server to client

    I have create txt file in server directory using UTL_FILE package,
    and I put in the directory in server.
    Server platform is linux. and client platform in Windows.
    What I want to ask is there any possibilities to copy that file from server to client using pl/sql ? could all of you "The Gurus" give me a script example ?
    Thanks a lot.
    regards,
    indra

    > What I want to ask is there any possibilities to copy that file from server
    to client using pl/sql
    No. Not really.
    Think about it.. the file is on the server. PL/SQL code executes inside the Oracle server session that is servicing the client.
    Just how is PL/SQL (on the server) suppose to reach out and push that file to a client's file system and directory?
    PL/SQL cannot do this. You need something on the client that will accept the file. You need something in-between the client and PL/SQL that will handle the transfer of the file. This something can be ftp, scp, tftp, NetBIOS etc.
    Anyway you look at this, it does not make sense. You are turning the server into the client that needs to push the file. You are turning the client into a server that needs to accept the file.
    Why? This is contrary to the basic client-server RDBMS architecture. You are adding more complexities and more moving parts to the architecture by forcing a swap of client and server roles. The are now a far greater likelihood of errors and bugs and failures.
    It does not make sense to do it this way.
    What is the business requirement you are trying to satisfy? Instead of us trying to help you to hack a flawed solution, let us rather assist you in determining the correct and proper solution.

  • How to copy file from server to another machine in network through JSP

    Hello!
    any body can solve my problem.
    i m working in JSP. i want to copy a file from server on which JSP engine is running to another computer in the same network.
    i used Java File Object to copy file from one machine to another in network. and its working fine on network. but the problem is when i used the same code in web page there is exception which is Access is Denied. what i should do now.
    i m writing the code i m using in my JSP page
    String fileToCopy = "C:/oracle/Apache/Apache/htdocs/FAO/FAO_MiddleFrame.jsp";
         String destinationDir = "\\\\af09\\c";
    File source = new File(fileToCopy);
    String fileName1 = source.getName();
    if ((!destinationDir.endsWith("\\")) && (!destinationDir.endsWith("/"))) {
    destinationDir = destinationDir + "\\";
    File destination = new File(destinationDir + fileName1);
    if (!destination.exists()) {
    if (!destination.createNewFile()) {
    //throw new IOException("Unable to create file. May be you don't have permissions.");
    byte[] buffer = new byte[1024];
    FileInputStream in = new FileInputStream(source);
    FileOutputStream outStream = new FileOutputStream(destination);
    int bytesRead = 0;
    while ((bytesRead = in.read(buffer)) != -1) {
    outStream.write(buffer, 0, bytesRead);
    out.println("File copied successfully ....");
    plz reply me as soon as possible.
    i will be very thankful
    Saad

    Thats the way it works. Cause servlet contaner doesnot allow other machines in the network to access other than machine which it came from as in case of applets. What you can do is if the other machine is also based on webserver or app server .. you can upload the file as it gets to that page do the process.
    I would like to hear more on my comments..
    Suggestions ??
    Ban

  • TS1402 I can not copy any files from the server & from the Finder. System MAC OS 10.7.5

    I can not copy any files from the server & from the Finder. System MAC OS 10.7.5
    <Email Edited by Host>

    Hi, what is the no boot directory found about???
    Can you give details step by step of what you're trying?

  • OS X 10.4.7 server: Samba leaking ram when copying large files from windows

    Hi.
    I'm having problems with:
    Copying files from windows clients to OS X Server 10.4.7 uses up the RAM needed for the files to be copied.
    If I copy a 3GB file, it uses 3GB of RAM
    If I copy a 5GB file, it uses its 4GB of RAM, plus VM.
    If I copy 11GB of files (that is several little files, plus some big by dropping a folder to the share), it consumes all the RAM the machine has, and because of VM paging, whatever other clients are reading from the disk (XRaid) start to have hiccups.
    The RAM of the machine NEVER gets flushed after the copying has finished. So Samba is unusable as it is. I have four Xserves with 4GB of RAM, with 4 XRaids connected each one to each Xserve with its Apple Fiber Channel card and cables.
    I already did the ack=0 thing, got the size of inet.tcp.sendspace and rcvspace to 8388608 and the buffer to 16777216.
    The transfers rates are up to 70MB/s with 2 channel 1gb trunking, and at very sustained rates..
    We are using these to edit video content (DV 25) in Sony Vegas with 2 or 3 clients for each server.
    Any suggestions?
    Thanks very much.
    XServe G5 cluster node (4) / XRaid 7TB (4)   Mac OS X (10.4.7)  

    Michael, I occasionally notice anomolous behaviour when files get dragged between volumes. Mostly the copying window shows an accurate and immediate indication of what's going on, but other times it just looks like nothing's happening, the display never changes, yet, it is in fact copying the files over. Now, if you're copying 2gb files from DVD to HD, it's gonna take some time, more than 5 minutes, so I'm wondering how long you've left it before forcing it to quit?

  • First boot copy files from server

    My computers set themselves up from a netboot image (i know, i'm still using monolithic imaging, but plan to learn deploy studio, I swear).
    Anyway, it would help me a ton if I could figure out how to have my first boot script copy some directories off the server onto the client, but i'm not sure how to build that command.  Can anyone help point me in the right direction?

    It's might be easiest inside an action in Deploy Studio - it configures a startup script to do tasks for you after the image is restored, then it cleans the scripts up & reports success to the server. There is no problem with using monolithic images with Deploy Studio either (last time I checked).
    Otherwise make a launchd job that runs your own script. Make the job delete the script and launchd plist on completion.
    You need to take into account any authentication on the server (don't leave passwords in plaintext) - I assume these files are not on a public/ guest share? Work out how to handle failures so you know which machines need attention. curl or scp could work from shell scripts. Copy it to the image before any deployment is done.
    See what others say, but I think Deploy Studio may be worth learning. Apple's System Image Utility had features for doing this too, but Deploy Studio seemed better to me.

  • How can i transfer more than one file from server to client

    Hi,
    our requirement is transfer more than one files from server to client using the
    webutil_file_transfer.as_to_client_with_progress.One file transfer is already working in our system.If anybody know the solution please inform
    regards
    mat

    just an idea ...
    for this purpose let us put aside security concerns and other potential problems....
    -- Get the content of a server directory with Filter and create zip file
    1) create a class that implements java.io.FilenameFilter ...
    2) define accept() method ...
    3) call File.list() with the filter as a parameter. The returned array of strings will have all the names that passed through the accept() filter
    4) use java.util.Zip to create ZIP file on the server side
    -- I think it is better to create this functionality as a separate Java class, put it in required folder and after it
    -- use Forms->Program->"Import Java class" to create pl/sql wrappers, than to create wrappers for all classes and code in pl/sql
    5) use webutil to transfer file on the client
    6) use Java on client side to unzip transferred file
    if you think this is not too complicated, you should try ...
    Regards,
    Vladimir

  • How to download file from server to client's local ??

    How to download a file from the server to the client's local machine in a particular folder without users intervention ie. 'Save As" prompt of the browser should be avoided and if the client clicks on "Download" button, the file should get automaticaly downloaded to say, "c:/reports/' on his/her local machine. This is for Java based web appliaction.

    http://jguru.com/faq/view.jsp?EID=10646

  • How to copy a file from application server to local system

    Guys,
    Need to copy a file from application server to local system.Is there an FM for the same.
    Tried searching for it but couldn't find anything useful.
    Code snippets will be highly appreciated.
    Warm Regards,
    P.
    Moderator message: very frequently asked and answered question, obviously you did not search thoroughly, all points removed.
    Edited by: Thomas Zloch on Dec 3, 2010 4:48 PM

    hi,
    You can use the transactions CG3Y or through program u can do like this..
    DATA: BEGIN OF IT_FILE OCCURS 0,
                    LINE TYPE STRING,
               END OF IT_FILE.
    OPEN DATASET <file_name>  FOR INPUT IN TEXT MODE ENCODING DEFAULT.
            IF SY-SUBRC IS INITIAL.
              DO.
                READ DATASET<file_name> INTO IT_FILE-LINE.
                IF SY-SUBRC = 0.
                  APPEND IT_FILE.
                  CLEAR IT_FILE.
                ELSE.
                  EXIT.
                ENDIF.
              ENDDO.
            ENDIF.
    CLOSE DATASET <file_name>.
    Download it to local system using  FM - GUI_DOWNLOAD

  • Out of disk space when copying files from server to server

    Servers: NW 5.1.7
    Workstation: Windows 98SE with client32 v3.4
    There is a batch file that copies files from server A to server B. At certain point, the copying gets stuck and message is displayed on the workstation: ""Network Status. Client32: out of disk space writing file to server B." Unless I press OK, the copying will not continue. There's plenty of space and memory, no quotes or user restrictions on server B. This procedure worked for years without any problem and nothing was altered on the servers or workstation at time of occurrence.

    Did you purge the volumes ?
    How high is ratio between compressed and noncompressed data on volumes?
    I assume, that for this usage (copy one server to another) you should
    seek the different way (program), which transfer the compressed data
    with untouched state of compression.
    Jindrich Kovar
    Marty Fox napsal(a):
    > Servers: NW 5.1.7
    > Workstation: Windows 98SE with client32 v3.4
    > There is a batch file that copies files from server A to server B. At certain point, the copying gets stuck and message is displayed on the workstation: ""Network Status. Client32: out of disk space writing file to server B." Unless I press OK, the copying will not continue. There's plenty of space and memory, no quotes or user restrictions on server B. This procedure worked for years without any problem and nothing was altered on the servers or workstation at time of occurrence.

  • Need to copy .txt file from FTP server and downloaded on local server directory.

    I need to figure out a way to copy .txt file from ftp server in local server directory using sql jobs.

    Below links will help achieving it:
    https://www.virtualobjectives.com.au/sqlserver/ftp_scripts.htm
    http://www.mssqltips.com/sqlservertip/2884/sql-server-integration-services-ssis-ftp-task-for-data-exchange/

Maybe you are looking for

  • Could I use iBook to upgrade iMac with dead CD/DVD drive?

    I don't speak computer very well.......I was wondering if I could upgrade my old iMac by using the iBook as an external Hard drive. I tried using a firewire connection and holding down the T key. It worked for file transfer, but not upgrading the OS.

  • How to use lookup in xquery(OSB)

    Hi In xquery , I have hardcoded the value and compare the hard coded value against input payload and fetch the corresponding value for hard coded value . In this way, I have hardcoded around 35 values in Xquery . But the client wants to use lookup or

  • WebForm isn´t availble!

    Hi Guys!                    I´m with problems to access the WebForm at my BPM 12c environment.                    When I go to my frevvo deployment test link, i get the response : "Permission denied"                   My log when i try to start a new

  • Black MacBook cursor/selection problems

    Having a few problems. When I hover the cursor over a link or application, the item will be selected very quickly before I actually click on it myself. Other times when I click on a tab or link the cursor will drag the item around as if I was holding

  • JavaServer Faces Support

    Are there plans/timeline to support JavaServer Faces in Workshop?