Need help to download csv file in application by writting to outputstream.

HI All,
Requirment of my client is donloading CSV file from portal.
My approach  is:
On clicking "Download" button in JSP I am calling an action in controller and from here I am redirecting call to DownloadCSV.jsp where i am writing to output stream of response.
Action called in controller:
     @Jpf.Action(forwards = { @Jpf.Forward(name = StaticConstants.SUCCESS, redirect = true, path = "DownloadCSV.jsp") })
     public Forward gotoReports() {
          Forward forward = new Forward(StaticConstants.SUCCESS);
          return forward;
Download jsp:
response.resetBuffer();
     response.reset();
     response.setContentType("application/vnd.ms-excel");
     response.addHeader("Content-Disposition", "attachment;filename="+ companyId +"_Audit_Report.csv");
     ServletOutputStream os = response.getOutputStream();
          os .println();
          os .print("DATE");
          os .print("USER");
os .println();
os.flush();
os.close();
I am able to download the csv file in excel. But after that i am not able to perform any operation in portal page. Mouser pointer becomes busy and cant click on anything.
Second approach followed:
I wrote the code for writting to outputstream of outputresponse in controller action itself and forwarded to the same jsp where my download button resides.
Problem:
Download happens perfectly but the excel in csv format contains the portal framework generated content also other than content i wrote to response.
If u have any other approach to download an excel without redirecting to JSP plz let me know. Coing is being done in 10.2 weblogic portal.
Please help. Its very urgent.
Plz let me know how a file can be downloded in portal context without keeping a file at server side. I need to download file by writting to outputstream.
If it is possible plz attach one small example project also.
Thanks a ton in advance.
It is very important plz do reply.

Hi Srinivas,
For downloading binary content that is not text/html, the Oracle WebLogic Portal content management tools use javascript in an onclick event handler to set the window URL to the URL of a download pageflow controller: window.location = url. The content management tools are in a portal so it should be possible for you to do the same thing.
The url is a custom pageflow controller that streams the bytes to the response. It sounds like you already have a pageflow you could recycle to use in that way. You don't want to stay within your portlet pageflow because then you will be streaming bytes into the middle of a portal response. You want a separate download pageflow that you invoke directly, outside of the portal framework (in other words, don't invoke it by rendering a portlet that invokes the pageflow).
You can set the url to invoke the pageflow directly by giving the path to the pageflow controller from the web root (remember the pageflow path matches the package name of the pageflow controller class) like this: "/content/node/nodeSelected/download/DownloadContentController.jpf"
By the way, for the case of text/html, the tools uses a standalone portlet URL so that the text/html is not rendered in the browser window, which would replace the portal markup (because the browser renders text/html by default, instead of giving you a download widget or opening some other application to deal with the bytes).

Similar Messages

  • How to save CSV file in application server while making infospoke

    How to save CSV file in application server to be used as destination while making infospoke.
    Please give the steps.........

    Hi
    If you want to load your flatfile from Application server,then you need to trasfer your file from your desktop(Computer) to Application server by using FTP.
    Try using ARCHIVFILE_CLIENT_TO_SERVER Function module.
    You Just need to give thesource path and the target path
    goto SE37 t-code , which is Function module screen, give the function name ARCHIVFILE_CLIENT_TO_SERVER, on click F8 Execute button.
    for path variable give the file path where it resides like C:\users\xxx\desktop\test.csv
    for target path give the directory path on Application server: /data/bi_data
    remember the directory in Server starts with /.
    U have to where to place the file.
    Otherwise use 3rd party tools to connect to ur appl server like : Core FTP and Absolute FTP in google.
    Otherwise...
    Goto the T.code AL11. From there, you can find the directories available in the Application Server.
    For example, if you wanna save the file in the directory "DIR_HOME", then you can find the path of the directories in the nearby column. With the help of this, you can specify the target path. Specify the target path with directory name followed by the filename with .CSV extension.
    Hope this helps
    regards
    gaurav

  • I need help in Downloading Adobe Elements for my Mac & Adobe Acrobat for my laptop...I have been battling for the last day.

    I need help in Downloading Adobe Elements for my Mac & Adobe Acrobat for my laptop...I have been battling for the last day.

    ~graffiti wrote:
    PjonesCET wrote:
    I know if you attempt to download and exe file to Mac from a Mac Partition you'll get something like. Cannot not understand file format octet-stream. This means it does not recognize MS execute files.
    Not necesarily. I've done it a few times.
    PjonesCET wrote:
    I'm not sure you can download a PC copy of Acrobat 9 unless you operating from bootcamp or other such application and running the PC partition.
    Yes. You can.
    I've learned something. New. This must be recently changed. That last time I clicked on a Link I though was a dmg file and turned out it was and exe file my Macs wouldn't allow me to do so. But haven't tried recently everytime and exe file comes up I cancel. I gues I am used to the time everytime a Virus or some other nasty was downloaded it was packaged in and exe file and Macs owuldn't allow it. I suppose with the INtel guts now they can no longer refuse to download.

  • I need help in downloading my ringtones

    I need help in downloading my ringtones back to my phone from itunes

    ~graffiti wrote:
    PjonesCET wrote:
    I know if you attempt to download and exe file to Mac from a Mac Partition you'll get something like. Cannot not understand file format octet-stream. This means it does not recognize MS execute files.
    Not necesarily. I've done it a few times.
    PjonesCET wrote:
    I'm not sure you can download a PC copy of Acrobat 9 unless you operating from bootcamp or other such application and running the PC partition.
    Yes. You can.
    I've learned something. New. This must be recently changed. That last time I clicked on a Link I though was a dmg file and turned out it was and exe file my Macs wouldn't allow me to do so. But haven't tried recently everytime and exe file comes up I cancel. I gues I am used to the time everytime a Virus or some other nasty was downloaded it was packaged in and exe file and Macs owuldn't allow it. I suppose with the INtel guts now they can no longer refuse to download.

  • Download csv file with strange file name.

    hi, guys:
    We installed Oracle APEX 4.2, and APEX listener 2.0 and Oracle 11g standard edition for our application. But sometimes when user tried to download csv file from an interactive report, the file name was a very strange one, sometimes even no .csv extension. could anyone give me a hint to find documentation about it?
    Thanks.
    Sam

    lxiscas wrote:
    a little more information about it:
    I found the file name is "&P16_DIP_START_DATE NOA", which we expect to generate a file named as " some date NOA.csv", but APEX does not recognize the value of variable. For example, if teh value of P16_DIP_START_DATE is 11/15/2012, we expect the file name as "11/15/2012 NOA.csv", but APEX will give us very strange file name replaceing every "/" with / I appreciate anyone who could help me on this issue. But We did not encounter this [roblem on APEX 4.1, OC4J and Oracle 11g R2 enterprise.
    Thanks.
    I just used to_char to output date without "/" and soleved it. The other way is to set application property-->security-->browser security with basic level. This only applies to APEX 4.2. I am lucky for that I am using Apex 4.2.
    Sam
    Edited by: lxiscas on Jan 14, 2013 10:08 AM
    Edited by: lxiscas on Jan 14, 2013 10:10 AM
    Edited by: lxiscas on Jan 14, 2013 10:20 AM
    Edited by: lxiscas on Jan 14, 2013 1:36 PM
    Edited by: lxiscas on Jan 21, 2013 6:50 AM
    Edited by: lxiscas on Jan 21, 2013 6:52 AM
    I can has editing?Suspect you are trying to explain that "/"s are being rendered as <tt>&amp;#x2F</tt>? If you want to include character entities in forum posts then you have to type the ampersand ("&amp;") as an entity itself, thus: <tt>&amp;amp;#x2F</tt>.Windows or *NIX filenames can't contain "/"s anyway, so you can't use them regardless of how APEX is rendering them. Using a <tt>YYYYMMDD</tt> format is also recommended as it follows date order when using character comparison semantics.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error loading csv file from application server

    Hi all,
    While uploading a csv file from the application server to psa we are getting the following error,
    Error 2 while splitting CSV data record
    Message no. RSDS_ACCESS011
    Diagnosis
    Error 2 occurred while splitting the CSV data record 1
    1 = Could not find a closing escape character
    2 = Invalid escape character
    3 = Conversion error
    4 = Other error
    System Response
    The function was terminated.
    Procedure
    Check the values of the data separator and escape sign, and try again.
    But i've checked the file and the escape sign, data seperator in it also. Everything is fine.  The same file we are able to load successfully in quality system.
    How to solve this error??
    Thanks in advance.

    Hi BI consultant:
       Could you please provide more details?
    For example:
    1.Is your P application server a UNIX flavor? (Solaris, AIX, UX, Linux)
       If yes..
             2. Are you able to see the contents of the file correctly with a "cat" or "vi" command? (at operating system level).
                   If no...
                         3. Did you upload the csv flat file to the server via FTP?
                                If yes...
                                     4. Did you use the "binary" or the "ascii" parameter on the FTP command used to upload the file?
    Probably you need to upload the CSV file again to your application server and make sure you can se the file contents ("cat" or "vi" command) before trying to execute the InfoPackage.
    Regards,
    Francisco Milán.
    Edited by: Francisco Milan on Jun 3, 2010 11:13 AM

  • How to download a file from application server to presentation server

    Hi experts,
    I want to download a file from application server to presentaion server, file contaims three fields customer name, customer email id and status..
    help me out i m new into sap.

    Dear Aditya,
    Please check below thread
    http://scn.sap.com/thread/1010164
    it will help you.
    BR
    Atul

  • Help! Downloading a file from remote Server

    I am currently doing a program for downloading a specified file from the remote server i.e from any website. If the downloading process stops in between due to some problem in the internet connection, then my program needs to start the downloading the file again to the local directory from where it was left.
    My idea is that, getting the size of the remote file initially when the downloading process starts and if the connection is interrupted, i will check the size of the downloaded file in the local directory with the remote file size. If the remote file size is greater than the localfile size, i need to start downloading the file where it was left i.e start downloading the next bit from the remote file.
    Is there any way to get the contents of the remote file from the specified point say 50th byte from a total file size of 100 kb using java?
    which concept to use FtpClient or sockets?
    iam a little bit confused!!!!
    Please help me.
    Thanks in advance.

    For HTTP you can use this function to open the stream with offset:
    InputStream openStream(URL url, long offset) {
        try {
            URLConnection uc = url.openConnection();
            uc.setRequestProperty("Authorization", "Basic " + (new BASE64Encoder()).encode("username:password".getBytes()));
            if (offset != 0 && url.openConnection().getHeaderField(0).toUpperCase().startsWith("HTTP/1.1"))
                uc.setRequestProperty("Range", "bytes=" + offset + "-");
            return new BufferedInputStream(uc.getInputStream());              
        } catch (MalformedURLException mfURLe) {
            System.err.println("Malformed URL in Client Updater. Unable to receive update list: " + mfURLe.getMessage());
        } catch (IOException ioe) {
            System.err.println("Unable to open input stream: " + ioe.getMessage());
        return null;
    }

  • Download text file from application server to client server.

    Hi all,
    I am facing a format issue while downloading text file from application server to the client machine.
    The issue is that, say I have 6 to 10 lines in my text file in application server. but when i store it on the hard drive,
    it shoes all the data in a single line. Where as i need to download data in same format as in application server.
    Awaiting for your responses.
    Regards,
    Jose

    Hi,
    If we want to upload file data from the application server to the internal table, there is no function module or class static method which we can use, we must wirte the code by ourselves.
    1. For the file data which has no seperator between field columns.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET p_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_data.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.2. For the file data which has tab separator between field columns.
    DATA: gds_field_split type gts_data.
    FIELD-SYMBOLS: <fs_field> TYPE gts_data.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET prf_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_field.
        SPLIT gds_field  AT cl_abap_char_utilities=>horizontal_tab
             INTO TABLE gdt_field_split.
       LOOP AT gdt_field_split  into gds_field_split.
           gdf_index = gdf_index + 1.
           ASSIGN COMPONENT gdf_index OF STRUCTURE
                 gds_data to <fs_field>.
          IF sy-subrc = 0.
              <fs_field> = gds_field_split.
          ENDIF.
       ENDLOOP.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.
    Thanks & regards,
    ShreeMohan

  • I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    I need help with a PDF file that is an image, the "Read Out Loud' option does not work, please help!

    You mean an image such as a scanned document?
    If that is the case, the file doesn't contain any text for Reader Out Loud to read. In order to fix that, you would need an application such as Adobe Acrobat that does Optical Character Recognition to convert the images to actual text.
    You can also try to export the file as a Word document or something else using ExportPDF which I believe offers OCR and is cheaper than Acrobat.

  • I need help in downloading lr5 as a free trial. Currently I have lr4

    i need help in downloading lr5 as a free trial. Currently I have lr4

    Thanks for quick response.  Firstly, let me say that I am not computer savvy.
    I have Lr4 which does not open my raw file from a D4s (on loan).  So I thought, its about time that I subscribe to Lr5 and CS6 via CC.  Adobe is checking my educational credential.
    Meanwhile, an idea came to me about a freetrial whilst I wait for them to check me out!  Secondly, can you convert these files to DNG in Lr4.  I tried but does not work for me.
    Hope you understand my problem/question.

  • Need Help in download data frm APP..server

    Hi all,
    Im trying to download a file frm Application server..
    Till to internal table its ok..but Im not able to download data to excel file..
    Following is the code..Pls help where it is going wrong..
    CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
       EXPORTING
    *   WINDOW_TITLE            =
         default_extension       = 'XLS'
    *   DEFAULT_FILE_NAME       =
       WITH_ENCODING           = 'X'
    *   FILE_FILTER             =
    *   INITIAL_DIRECTORY       =
    *   DEFAULT_ENCODING        = 'X'
       IMPORTING
    *   FILENAME                =
    *   PATH                    =
         fullpath                = p_path
    *   USER_ACTION             =
    *   FILE_ENCODING           =
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *   BIN_FILESIZE                    =
          filename                        = p_path
          filetype                        = 'DAT'
    *   APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
    * IMPORTING
    *   FILELENGTH                      =
        TABLES
          data_tab                        = it_final
    *   FIELDNAMES                      =
       EXCEPTIONS
         file_write_error                = 1
         no_batch                        = 2
         gui_refuse_filetransfer         = 3
         invalid_type                    = 4
         no_authority                    = 5
         unknown_error                   = 6
         header_not_allowed              = 7
         separator_not_allowed           = 8
         filesize_not_allowed            = 9
         header_too_long                 = 10
         dp_error_create                 = 11
         dp_error_send                   = 12
         dp_error_write                  = 13
         unknown_dp_error                = 14
         access_denied                   = 15
         dp_out_of_memory                = 16
         disk_full                       = 17
         dp_timeout                      = 18
         file_not_found                  = 19
         dataprovider_exception          = 20
         control_flush_error             = 21
         OTHERS                          = 22
    Thanks.
    Priya

    Hi,
    Use below code.
      DATA:lv_filename TYPE string,
           lv_wnd_tit TYPE string VALUE 'File Download Dialog: ',
           lv_def_extn TYPE string VALUE 'xls',
           lv_init_dir TYPE string VALUE 'C:\',
           filename TYPE string,
           path TYPE string,
           fullpath TYPE string,
           action TYPE i.
      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          window_title      = lv_wnd_tit
          default_extension = lv_def_extn
          default_file_name = lv_filename
          initial_directory = lv_init_dir
        IMPORTING
          filename          = filename
          path              = path
          fullpath          = fullpath
          user_action       = action.
    if action = 0 or action = 1 or action = 2.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = fullpath
         filetype                        = 'ASC'
         write_field_separator           = 'X'
        TABLES
          data_tab                        = it_final
    ELSE.
        MESSAGE 'Action is canceled' type 'E'.
    endif.
    regards,
    muralii

  • BEA 9.2 Portal issue: downloaded CSV file contains embedded html code

    We have J2EE application using BEA 9.2 Portal framework, and one of the page has feature to generate report( in pop up window) in CSV file format. As per the history from previous developer, BEA 8.1 didn't have this issue but, after mirgration to 9.2, they started having file download error( incomplete contents ..). To overcome this issue they commented out setting content length to HttpServletResponse as attached below, but this, now, causes html page source code of the parent page( where submit button is clicked to generate csv file report) being rendered along with actual report in the downloaded CSV file. Has anyone have this sort of issue? If so, can you please share your thoughts? or any thoughts in general?
    BEA 9.2 with Portal framework, JDK 15, JSP, Beehive NetUI, Sun Microsystem Solaris server
    Here is the source code that avoids setting content length and reasoning behind it..
    private static void setResponseHeadersForCSVFile(HttpServletResponse response, String filename, int contentLength)
    String mimeType = mimeTypes.getContentType(filename);
    response.reset();
    response.setContentType(mimeType);
    // DON'T explicitly set the content length, since the length of the String or StringBuffer that contains
    // the contents of the CSV file will be character encoded when it is actually written to the output stream, based
    // upon the character encoding of this JVM App Server's settings. So let the JVM App Server framework apply the character
    // encoding AND set the final and truly correct content length header at the time the contents of the String or StringBuffer are truly
    // streamed back to the user.
    //response.setContentLength(contentLength);
    response.addHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"; size=" + contentLength);
    }

    1) Yes, the old content.tld is available as part of a web library module as a taglib.tld file. The module is: wlp-services-web-lib.war, which can be found in your bea/weblogic92/portal/lib/modules directory.
    2) The new API is accessible from the ContentManagerFactory class. This provides access to INodeManager, ITypeManager, ISearchManager, etc. The new API is contained within the com.bea.content.federated package. The 8.1.x API in the com.bea.content.manager package including RepositoryManager, NodeOps, SearchOps, etc. has been deprecated with 9.2.
    3) Yes, via the new I*Manager implementations. The entitlement support is for application-scoped visitor roles. Make sure you're using the ISearchManager when performing search operations. This will ensure secure results are returned.

  • This Adobe muse site file requires a newer version of Adobe Muse. I want to comeback to old version Adobe muse i need help to open my file thanks

    This Adobe muse site file requires a newer version of Adobe Muse. I want to comeback to old version Adobe muse i need help to open my file thanks

    Hi,
    You may need to design the site again in older version OR may be copy and paste in place from new to old except what is new in the latest version.
    Hope that helps!
    Kind Regards,

  • Gui_download function to download the file in application server in bdc

    Can we use gui_download function to download the file in application server in bdc?
    Regards,
    pandu.

    for downloading the file on application sever you use the concept of Dataset. GUI_DOWNLOAD is for presentaion server.
    regards
    Abhi

Maybe you are looking for

  • Website issue with osx server and hosting

    so i had a website hosted from my osx server and i had bought the domain name from godaddy it worked great but i desided to instead of hosting it on my osx server to just host it on  godaddy so i turned to server off and added the domain to my godadd

  • How do I retain the formatting (i.e. tables or graphics) while saving a pdf as an html?

    How do I retain the formatting (i.e. tables or graphics) while saving a pdf as an html?

  • There are gray lines across my mac book, what do I do?

    there are gray vertical lines across my mac book, what do I do?

  • Service Call Related

    Hi Experts, I have one question, 1. While creating Service call, as per my knowledge one Execute Method will create in Web dynpro side, any another action or anothing thing wil happen in webdynpro side??? 2. Can we create Context node while creating

  • Ear Bud Mic problem?

    Ok I thought a week ago I had bad ear buds since the Mic/remote rutton on the right ear cord doesnt work. I used my apple care to get them replaced and these new ones out of the box of are doing the same thing. Both Ear Buds sound great but for some