Sun JSC2 - How to download files to client

Hi, imagine a document management site.
I want to have a list of files with links that users can click to download them.
Users can upload files (with handy File Upload component), and they get saved as byte streams to a file or database or whatever.
Now, I have a page with a list of files the user can download. The file name, a link to save the file, and a link to download the file.
File1.pdf . . . DOWNLOAD IT! . . . SAVE IT!
The DOWNLOAD IT! link tries to use mime stuff to get the browser to open the file.
The SAVE IT! link tells the browser to not process the file and always bring up the save as dialog. In both cases, I don't want the browser to open a new page.
Starting with a byte[], what's the best way to do this? I searched the web, and these forums, but couldn't come up with anything that gave me a place to start from inside JSC2.
Any ideas on where to start? Thanks in advance!
Mike

Hey Winston, here is what I came up with... Very similar, but a little different.
Java Server Faces File Download Tutorial by Michael Cole
Java Server Faces, abstracts much of the monotonous detail of web programming, letting application developers develop applications, instead of programming servers.
This tutorial explains how to dip just a little under the covers to serve files to a browser. The browser can then interpret this binary data using MIME types. Some common MIME types are �text/plain�, �text/html�, or �application/pdf� or �application/x-unknown�.
How the browser behaves when interacting with these MIME types is based on the client browser's configuration. Because this configuration is different for every browser, let's create two different behaviors:
* First Behavior: When a link is clicked, the browser downloads and �opens� the file, either displaying the file itself, or choosing an appropriate program: zip file program, pdf program, etc.
* Second Behavior: The browser always offers to save the file, no matter what.
At the most basic level, we want to cause this chain of events:
1. Cause browser to send a request to the server.
2. Have the server create a response that sends the file to the client.
For my purposes, the browser should not navigate to a new page for this behavior.
A mockup might look like this:
Files you can download:
Secrets of the Universe.txt
Open it!
Save it!
Perfect love and happiness.pdf
Open it!
Save it!
Make a million dollars now.swf
Open it!
Save it!
To accomplish this, we will execute this code on the server:
// Find the HttpServletResponse object for this request.
// With this object, we can create a response that sends the file.
FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) faces.getExternalContext().getResponse();
// We can also get information about what the browser requested.
// This could tell us what data to send
HttpServletRequest request = (HttpServletRequest) faces.getExternalContext().getRequest();
// Your data can be stored in a database, generated at runtime, or whatever you choose.
// We getSomeData() from an arbitrary location. This depends on your application.
byte[] data = getSomeData(request);
// In the response, we will specify a file name to present to the user.
String filename = "myFile.txt";
// Now we have the data to send, and the response object to send it with.
// Next we give the browser some hints on what to do with the file.
// Note that different browsers will behave differently and you have no control over this.
// We'll use different mime types to implement the different "Open" and "Save" behaviors.
// "application/x-unknown" will be the MIME type used for the "Save" behavior.
response.setContentType(mimeType);
// We tell the browser how much data to expect.
response.setContentLength(data.length);
// Cross-browser hack for Firefox 1.0.7 and IE 6 compatibility.
// IE 6 ignores the MIME type and decides based on the "attachment" or "inline"
if (mimeType.equals("application/x-unknown")) {
// Show the "Save As..." dialog
response.setHeader( "Content-disposition", "attachment; filename=\"" + filename + "\"");
} else {
// attempt to "open" the file
response.setHeader( "Content-disposition", "inline; filename=\"" + filename + "\"");
// Now we start sending data with the response object.
// You might consider using a buffer if your data comes from a large file
// or a database.
try {
ServletOutputStream out;
out = response.getOutputStream();
out.write(data);
} catch (IOException e) {
e.printStackTrace();
// Lastly and very importantly, we tell Java Server Faces that
// the request has been handled and not to process it any more.
faces.responseComplete();
Now all we have to do is put this code somewhere.
Step 1: Build the page UI.
* Create a new page in Java Studio Creator. Let's call it �download.jsp�
* Make it the start page (right-click)
* Add a hyperlink component and call it �Open!�
* If you like, add a static text that describes your file.
Step 2: Tell Java Server Faces what to do when the hyperlink is clicked.
* Doubleclick the hyperlink and add this code to it's action:
public String hyperlink1_action() {
// TODO: Replace with your code
DownloadBean d = new DownloadBean();
d.sendFile("text/plain");
return null;
* Compile the download.java and get a �cannot find symbol for class DownloadBean�. Now we have a place to put our code to send the file!
Step 3: Build the DownloadBean that will serve the file.
* Go to your "Source Packages" folder and create a new Java class in the project's package. Call this class �DownloadBean�.
* Copy this code into the class:
public void sendFile(String mimeType) {
FacesContext faces = FacesContext.getCurrentInstance();
HttpServletResponse response = (HttpServletResponse) faces.getExternalContext().getResponse();
HttpServletRequest request = (HttpServletRequest) faces.getExternalContext().getRequest();
byte[] data = getSomeData(request);
String filename = "myFile.txt";
// Note that different browsers will behave differently and you have no control over this.
// We'll use different mime types to implement the different "Open" and "Save" behaviors.
// "application/x-unknown" will be the MIME type used for the "Save" behavior.
response.setContentType(mimeType);
response.setContentLength(data.length);
// Cross-browser hack for Firefox 1.0.7 and IE 6 compatibility.
// IE 6 ignores the MIME type and decides based on the "attachment" or "inline"
if (mimeType.equals("application/x-unknown")) {
// Show the "Save As..." dialog
response.setHeader( "Content-disposition", "attachment; filename=\"" + filename + "\"");
} else {
// attempt to "open" the file
response.setHeader( "Content-disposition", "inline; filename=\"" + filename + "\"");
// Now we start sending data with the response object.
try {
ServletOutputStream out;
out = response.getOutputStream();
out.write(data);
} catch (IOException e) {
e.printStackTrace();
faces.responseComplete();
* Hit Ctrl-Shift-F to make the code pretty.
* Try and compile DownloadBean.java. Build->Compile
* As expected, you will get a variety of �cannot find symbol� errors.
* Hit Ctrl-Alt-F to clean these up, by automatically adding the proper imports.
* Try and compile again and you will get a �cannot find symbol� error for the getSomeData() function. That's ok cause we didn't write it yet.
* Copy this code into the DownloadBean class:
public byte[] getSomeData(Object o) {
// ignore the HttpServletRequest object and return some data.
return "Hello World!".getBytes();
* Compile the file one last time to get a clean compile.
Why didn't we put this code directly in the hyperlink1_action() function? Because we are separating the �model� from the "view" and "controller". DownloadBean can be reused in any page of your application now.
Step 4: Test
1. Run the project and open the page in the Firefox web browser.
2. Click the �Open It!� hyperlink
3. A text file should appear in Firefox that says �Hello World!�
Great! We sent the file, Firefox interpreted the �text/plain� MIME type, and presented the text as a browser page. This covers our �Open It!� functionality.
To serve other kinds of files, pass a different MIME type in the sendFile() function.
For a list of MIME types, check out http://www.webmaster-toolkit.com/mime-types.shtml
Step 5: Save It! Functionality.
What if we always want the file to be saved, no matter what foolishness the browser wants to do with the file?
* Go back to the Design of download.jsp.
* Add another hyperlink to the page, label it �Save It!�
* Double click the hyperlink and JSC2 will take you to its action function.
* Add this code to the function
public String hyperlink2_action() {
// TODO: Replace with your code
DownloadBean d = new DownloadBean();
d.sendFile("application/x-unknown");
return null;
Notice the difference in the MIME type? We changed �text/plain� to �application/x-unknown�. Notice also in the sendFile() function the cross-browser hack to get IE 6.0 to save or open the file.
* Run the project one last time.
* Test with Firefox
* Test with Internet Explorer
Done!

Similar Messages

  • How to download file from application server

    Hi Experts,
                  I developed report and execute in background mode. for this i used Open dataset transfer and close dataset . i got the requried output . But in this case user want downloaded file on presentation server so can anyone tell me How to download file from application server?
    i know it is possible through Tcode CG3Y. but i want code in program.

    This code will download a file to your Client package by package, so it will also work for huge files.
    *& Report  ZBI_DOWNLOAD_APPSERVER_FILE
    REPORT  zbi_download_appserver_file.
    PARAMETERS: lv_as_fn TYPE sapb-sappfad
    DEFAULT '/usr/sap/WBP/DVEBMGS00/work/ZBSPL_R01.CSV'.
    PARAMETERS: lv_cl_fn TYPE string
    DEFAULT 'C:\Users\atsvioli\Desktop\Budget Backups\ZBSPL_R01.CSV'.
    START-OF-SELECTION.
      CONSTANTS blocksize TYPE i VALUE 524287.
      CONSTANTS packagesize TYPE i VALUE 8.
      TYPES ty_datablock(blocksize) TYPE x.
      DATA lv_fil TYPE epsf-epsfilnam.
      DATA lv_dir TYPE epsf-epsdirnam.
      DATA ls_data TYPE ty_datablock.
      DATA lt_data TYPE STANDARD TABLE OF ty_datablock.
      DATA lv_block_len TYPE i.
      DATA lv_package_len TYPE i.
      DATA lv_subrc TYPE sy-subrc.
      DATA lv_msgv1 LIKE sy-msgv1.
      DATA lv_processed_so_far TYPE p.
      DATA lv_append TYPE c.
      DATA lv_status TYPE string.
      DATA lv_filesize TYPE p.
      DATA lv_percent TYPE i.
      "Determine size
      SPLIT lv_as_fn AT '/' INTO lv_dir lv_fil.
      CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
        EXPORTING
          file_name      = lv_fil
          dir_name       = lv_dir
        IMPORTING
          file_size_long = lv_filesize.
      "Open the file on application server
      OPEN DATASET lv_as_fn FOR INPUT IN BINARY MODE MESSAGE lv_msgv1.
      IF sy-subrc <> 0.
        MESSAGE e048(cms) WITH lv_as_fn lv_msgv1 RAISING file_read_error.
        EXIT.
      ENDIF.
      lv_processed_so_far = 0.
      DO.
        REFRESH lt_data.
        lv_package_len = 0.
        DO packagesize TIMES.
          CLEAR ls_data.
          CLEAR lv_block_len.
          READ DATASET lv_as_fn INTO ls_data MAXIMUM LENGTH blocksize LENGTH lv_block_len.
          lv_subrc = sy-subrc.
          IF lv_block_len > 0.
            lv_package_len = lv_package_len + lv_block_len.
            APPEND ls_data TO lt_data.
          ENDIF.
          "End of file
          IF lv_subrc <> 0.
            EXIT.
          ENDIF.
        ENDDO.
        IF lv_package_len > 0.
          "Put file to client
          IF lv_processed_so_far = 0.
            lv_append = ' '.
          ELSE.
            lv_append = 'X'.
          ENDIF.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize         = lv_package_len
              filename             = lv_cl_fn
              filetype             = 'BIN'
              append               = lv_append
              show_transfer_status = abap_false
            TABLES
              data_tab             = lt_data.
          lv_processed_so_far = lv_processed_so_far + lv_package_len.
          "Status display
          lv_percent = lv_processed_so_far * 100 / lv_filesize.
          lv_status = |{ lv_percent }% - { lv_processed_so_far } bytes downloaded of { lv_filesize }|.
          CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
            EXPORTING          "percentage = lv_percent - will make it fash
              text = lv_status.
        ENDIF.
        "End of file
        IF lv_subrc <> 0.
          EXIT.
        ENDIF.
      ENDDO.
      "Close the file on application server
      CLOSE DATASET lv_as_fn.

  • TS1538 how to download files from laptop to ipad air

    how to download files from laptop to ipad air

    Sync them via iTunes as you would with any other iDevice.

  • How to move downloaded files from download folder to other relevant folder or how to download files in relevant folders other than download folder

    how to move downloaded files from download folder to other relevant folder or how to download files in relevant folders other than download folder

    Just drag the file from the Download folder to the folder of your choice in Finder. If you are using Safari you can designate a new default download destination in Safari>Preferences>General tab, 'Save Downloads to...'. Other browsers should have a similar option in their preferences.

  • 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 download the SAP client into text file

    Hi,
    I want to download a SAP client to a text file for backup and then upload it again for restoration when needed. Can this be done?

    Hi,
    Regarding which data you want to export, you have to select the corresponding profiles in SCC8:
    If you want to export transaction data & master data (this is together known as application data), then you have to select the appropriate profile. Alongwith application data, customizing data would also be there, because it cant be transferred alone. ALso, you can choose whether to export user data or not.
    But please note that repository data (programs etc) would not be part of this export.
    The transaction is SCC8 for client export.
    For importing you can import like any other transport request.
    For details you could refer to the below link:
    http://help.sap.com/saphelp_47x200/helpdata/en/69/c24c824ba111d189750000e8322d00/frameset.htm
    Thanks & Regards,
    Kunal.

  • How to download anyconnect vpn client 64 bit win 7

    Good day all,
    please i wanted to download anyconnect vpn client 64 bit win 7 from software.cisco.com and i was not able to do that after login in. please can someone help me on how or the steps i can take to get the download.
    secondly can i be able to install it using ASDM after the download because i do not have a tftp server for now. thanks

    Hi csco12434455 , 
    Try to go to the following link, the name of the file is: Web deployment package for Windows platforms.   
    This file does support W7 32 and 64 bits
    https://software.cisco.com/download/release.html?mdfid=286281272&flowid=72042&softwareid=282364313&release=3.1.06073&relind=AVAILABLE&rellifecycle=&reltype=latest
    Reference link:
    http://www.cisco.com/c/en/us/td/docs/security/asa/compatibility/asa-vpn-compatibility.html#47680
    And yes you can use ASDM to upload the file to the ASA flash , just go to  Tools > File managment. 
    Please rate helpful posts !
    Hope it helps
    - Randy - 

  • ADF: how to download files?

    good day,
    does anyone know what the best way is to download a file to the client side using ADF? is this a trivial thing to do? i can find docs online on how to upload files using ADF but nothing for downloading files using ADF.
    initially, my thought was to use the FacesContext ResponseStream; but quickly realized that facesContext.getResponseStream returns a null with in my backend bean. so, i decided to bypass ADF and use HttpServletResponse's ServletOutputStream and simply write to this object. this works fine but ran into another problem, this comletely bypasses the ADF framework. after downloading the file ADF does not know what state it is in (i.e. my pages do not get updated). nothing gets updated via ADF.
    a second approach was to to kick off writing the Servlet OutputStream in a separate thread and have the backend bean return first. well... ran into another problem: java.lang.IllegalStateException: getOutputStream() has already been called!. obviously, i do not understand how the response mechanism works for servlets :-( it appears that per request the ouputstream can be only written to/flushed once.
    so if anyone has a way to correctly download a file using ADF please share.
    thank you

    Lius,
    thank you for the link. i read through it.
    for a existing file on the server a redirect works. but what if i do not have a physical file on the server and i simply want to write it from memory to the client side. i would like to write an outputstream object from the server directly to the user's browser.
    from the backend bean i do the following:
    ServletOutputStream out = response.getOutputStream();
    ByteArrayOutputStream outputStream = getOutputStream();
    // Reading the bytes through buffered input stream and writing the
    // presentation to the servlet output stream in the form of bytes
    // using
    // buffered output stream\
    while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
    bos.write(buff, 0, bytesRead);
    // Flushing the buffers of Http Response. this is bad for ADF.
    response.flushBuffer();
    and once i flush the buffer here it returns to the client and the user can than download the file but it completely bypasses the ADF framework and i am unable to make any ADF callbacks (i.e. send messages or use adf progress bar) :-(
    is there a way to download a file to an ouputstream without having it on the server side as a file.
    thanks for you help,
    joon

  • How to delete file from client machine

    Hi all,
    we are using the DataBase: oracle:10g,
    and forms/reports 10g(developer suite 10g-10.1.2.2).
    can anybody help me how to delete the file from client machine in specified location using webutil or any
    (i tried with webutil_host & client_host but it is working for application server only)
    thank you.

    hi
    check this not tested.
    PROCEDURE OPEN_FILE (V_ID_DOC IN VARCHAR2)
    IS
    -- Open a stored document --
    LC$Cmd Varchar2(1280) ;
    LC$Nom Varchar2(1000) ;
    LC$Fic Varchar2(1280);
    LC$Path Varchar2(1280);
    LC$Sep Varchar2(1) ;
    LN$But Pls_Integer ;
    LB$Ok Boolean ;
    -- Current Process ID --
    ret WEBUTIL_HOST.PROCESS_ID ;
    V_FICHERO VARCHAR2(500);
    COMILLA VARCHAR2(4) := '''';
    BOTON NUMBER;
    MODO VARCHAR2(50);
    URL VARCHAR2(500);
    Begin
    V_FICHERO := V_ID_DOC;
    LC$Sep := '\';--WEBUTIL_FILE.Get_File_Separator ; -- 10g
    LC$Nom := V_FICHERO;--Substr( V_FICHERO, instr( V_FICHERO, LC$Sep, -1 ) + 1, 100 ) ;
    --LC$Path := CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
    LC$Path := 'C:';
    LC$Fic := LC$Path || LC$Sep || LC$Nom ;
    If Not webutil_file_transfer.DB_To_Client
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    Raise Form_trigger_Failure ;
    End if ;
    LC$Cmd := 'cmd /c start "" /MAX /WAIT "' || LC$Fic || '"' ;
    Ret := WEBUTIL_HOST.blocking( LC$Cmd ) ;
    LN$But := WEBUTIL_HOST.Get_return_Code( Ret ) ;
    If LN$But 0 Then
    Set_Alert_Property( 'ALER_STOP_1', TITLE, 'Host() command' ) ;
    Set_Alert_Property( 'ALER_STOP_1', ALERT_MESSAGE_TEXT, 'Host() command error : ' || To_Char( LN$But ) ) ;
    LN$But := Show_Alert( 'ALER_STOP_1' ) ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Raise Form_Trigger_Failure ;
    End if ;
    If Not webutil_file_transfer.Client_To_DB
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    NULL;
    Else
    Commit ;
    End if ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Exception
    When Form_Trigger_Failure Then
    Raise ;
    End ;sarah

  • Adobe Creative Cloud - How To Share Files With Clients and Colleagues | Creative Suite Podcast: Designers | Adobe TV

    In this episode of the Adobe Creative Suite Podcast, Terry White shows how to share Photoshop, Illustrator and InDesign Files with clients and colleagues and all they'll need is a browser to comment and see your Photoshop Layers.
    http://adobe.ly/10ZjpE4

    Terry,
    I guess I miss something. How can I share a folder of photos? When I return from a shoot, I select 20 of the pictures and need to share them with my client to pick up the favorites. Am I supposed to copy and past an URL for each image separately?
    Sometimes I also work with a colleague, I need to share my favorites with him. Same issue.
    We have tried Adobe Cloud, and then went for Dropbox. There we can share a folder and he can put even his pictures in it as well. That's what I call collaboration. And it is free (unlike Adobe Cloud). If you have some word in Adobe, please tell them to either drop it and make a deal with services like Dropbox, or make it properly.
    Thanks.
    Vaclav

  • How to upload file from client to server in servlets.

    actually in my application i have to upload file from client m/c to server.
    it is not possible through file i/p stream as fileStreams does not work on network. Please mail me if you have any solution to this.
    Thank's in advance............

    Haii roshan
    Pls go through this thread..
    http://forum.java.sun.com/thread.jspa?forumID=45&threadID=616589
    regards
    Shanu

  • How to download  file with Save As dialog

    I am trying to download files with a Save As dialog, according to Jason Hunter's instructions in Jave Enterprise Best Practices.
    String filename = "content.txt";
    // set the headers
    res.setContentType( "application/x-download" );
    res.setHeader( "Content-Disposition", "attachment; filename=" + filename);
    // send the file
    OutputStream out = res.getOutputStream();
    returnFile( filename, out);
    The file content.txt is in the root directory of my webapp. But I get this stack:
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.io.FileNotFoundException: content.txt (The system cannot find the file specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.(FileInputStream.java:64)
         at com.interwoven.cssdk.examples.servlets.FileDownloadServlet.returnFile(FileDownloadServlet.java:43)
         at com.interwoven.cssdk.examples.servlets.FileDownloadServlet.doGet(FileDownloadServlet.java:24)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
         at java.lang.Thread.run(Thread.java:484)

    The root of the webservers changes from server to server and
    sometimes it depends on the path you run webserver exe.
    The best i have found to overcome this kind of problems is by
    using getResourceAstream() method which basically looks at classpath locations only, but still this has some problems like it should kept at the
    specified classpath becoz the getResourceAsStrem() method is not static
    method and it always associated with the class object and the file
    accessing also should be in the same package/classpath.
    by using getResourceastream you cannot look at other places (except classpaths)
    and this should be used only if you looking for .properites definitions.
    the Second best method is
    see you have a file called "context.txt" right
    before you create a file, first create a directory at the root, let say
    "\tmp"
    and then create a file \tmp\context.txt
    and then open an output stream to it either using fileoutputstreamm...
    and then write all output content to servlet/client output stream.
    this will be the best becoz you are specifying the "\" the root
    and this is common for all operating systems and definitely it will create at the root directory either serverroot or harddiskdrives root
    so you will never missout and the exceptin will also not comes along the way
    cheers..
    if you get new thing , let me know
    bye
    with regards
    Lokesh T.C

  • How to download files by using ipad

    How to download the pictures or files from ipad4 using safari browser,it always says it cannot be downloaded
    What alternative is available to solve this issue

    In either Applet or AppletContext you should find 2 methods
    getCodeBase()
    getDocumentBase()
    it is possible that those methods may return the same URL although they might not depending on how everything's set up. But anyway you can use that to get a URL and use the URL to open a connection

  • How to download files from the internet??

    I am a new Mac user, and I am soooo befuddled by downloading files, and what to do with them once they are on the desktop/under devices in Finder. Would someone here be kind enough to explain how to do this, please, or show me in the forum where this is already covered? Thank you very much in advance.

    Hiya,
    Downloading files is simple. All downloads appear in a download window that will open up. Once they are downloaded, you can click the "clear" button if you wish - you don't need them in there any more, and close the window. Files will then be wherever they're set to download to in your Safari preferences - Desktop, Downloads folder etc - and can then be used as you wish, opened, edited, moved. You can drag the files from the desktop into folders in finder. Sadly, someone at Apple foolishly thinks having no "cut" option in finder as you do in windows was a good idea - not quite sure how they came to that conclusion - so you'll have to drag the files from one folder to another, or copy them and then delete the original.
    If you're downloading compressed files (.zip) you may want to look up "Stuffit Expander" - a great file extraction tool.
    Hope this was the information you're after.

  • Add Download Files to Client Software Page

    We need to add downloads to the novell client download page (/welcome/client-software.html). Can some kind sould point in a direction to add downloads to this page? I think the file i want to edit is client-software.html.en in the /srv/www/novell/welcome-novell folder.

    On 25/06/2013 23:26, carnold6 wrote:
    > Sorry, yes we are using OES11 SP2
    Since OES11 SP2 is currently pre-beta, I think you probably mean OES11
    SP1 (installed as an add-on to SLES11 SP2).
    > Yes, that helps a lot! We just want to add some files for download to
    > that client software download page. So, have a heading for "remote
    > control software" then list the software for download. In the same
    > layout/format as already exists on that page. I created a js file called
    > extradownloads.js:
    >
    > Code:
    > --------------------
    > addToWpProductNames("Remote Clients", "iFolder3");
    >
    >
    >
    > // Language = default
    > addToWpI18NProductNames("Remote Clients");
    >
    > var ifolder3clientLinks = new Array();
    > ifolder3clientLinks.push( new Array(1, "Teamviewer for Linux", "/novell/clients/remote/teamviewer_linux.tar.gz", "", "", "" ));
    > ifolder3clientLinks.push( new Array(1, "Teamviewer for Windows", "/novell/clients/remote/TeamViewerQS_en.exe", "", "", "" ));
    > ifolder3clientLinks.push( new Array(1, "Teamviewer for Mac", "/novell/clients/TeamViewerQS_en.dmg", "", "", "" ));
    > addToWpLinks("ifolder3client", ifolder3clientLinks);
    > --------------------
    >
    > I just created a clone js file from one that already existed. So this
    > may be why nothing is showing up on the page.
    Let me guess, you cloned it from ifolder3client.js?
    > I also linked the js file:
    >
    > Code:
    > --------------------
    > document.write('<script type="text/javascript" src="/welcome/links/extradownloads.js">\r\n</script>\r\n');
    > --------------------
    >
    > I have restarted apache with rcapache2 reload. When i go to the client
    > software page, nothing shows up from the added js file.
    The reason why I think you're not seeing your downloads is the same
    reason I think you created your file from ifolder3client.js - the
    presence of ifolder3clientLinks in your extradownloads.js file. What I
    suspect is happening is that an array called ifolder3clientLinks is
    created by your extradownloads.js file then recreated via ifolder3client.js.
    What you need to do is replace all occurrences of ifolder3clientLinks in
    your extradownloads.js file with something else (I'd suggest
    extradownloadsLinks to match filename).
    I don't think you'll need to restart Apache to see whether this works -
    just refresh/clear the browser cache for Client Software page.
    HTH.
    Simon
    Novell Knowledge Partner
    Do you work with Novell technologies at a university, college or school?
    If so, your campus could benefit from joining the Technology Transfer
    Partner (TTP) program. See novell.com/ttp for more details.

Maybe you are looking for

  • How to add a jar file in the visual Age classpath

    I have to import a jar file in visual Age workspace, and don't know hox to do I tried several things, but didn't succeded at this point. I need to succed until tomorrow for completing my work. Please help, thanks.

  • Photoshop elements 4.0 won't work

    Adobe photoshop 4.0 won't work. After installing a hp scanner, I upgraded a driver for it and had problems. So I did a system restore for oct 2009 and now photoshop won't work.I fully uninstalled all my adobe programs except active x then reinstalled

  • Terms of payment - OBB8

    Hi Experts, My issues is creating terms of payment for vendor 1. 1% cash discount if paid within 60 days 2. no cash discount if paid within 61 to 65 days and bill should not show as overdue  till 65 days 3. no cash disocount if paid after 65 days and

  • Can som one help me plz its about videos

    ma ipod 5th generation wont play the videos that i purchase at itunes fo it i dont no why but hte scream remains blacc fo atleast 3 min can some one hook me up wit som help i tried lookin it up on hea in the ipod recommendations crap and questions as

  • N95 Shuts off when answering a call

    Please help! Now about 1 in 5 times I answer a call my N95-3 just shuts down ans re-starts. It is continually dropping calls and is now basically unreliable. Any suggestions?