Download A directory uploaded on a web server...

We want to down load a directory which is uploaded on a web server... plz if any body can suggest how to do this thrtough servlets or any other method...

Check out the java.util.zip.ZipOutputStream and java.util.zip.ZipEntry classes.
Set the content type of your servlet response to "application/zip" and create the ZipOutputStream using the response output stream.
Then you can create ZipEntries for each file and send them to the ZipOutputStream. Naming the zip entry with DIRECTORYNAME/FILENAME will create the appropriate directory structure.
For each entry, position the new ZipEntry using the putNextEntry(ZipEntry) class of ZipOutputStream then use the write(byte[] b, int off, int len) method to write the file data. You can load the files into a series of byte arrays beforehand if you like.

Similar Messages

  • How to authenticate a JWS Client download of jar files on a web server

    Here is a history of how i tried to implement the auth system:
    The resources(jar files) cannot be downloaded by any HTTP client from the server without some authentication method.
    As JWS is not reliable when using cookies (only 1.5 supports them, but with problems when in JNLP file i specify j2se version=older that 1.5) , i implemented another mecanism that works like this:
    1. 1.The template JNLP looks like this
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp codebase="http://10.3.0.62/" href="mapped/#JWS_CODE#___#PLATFORM#___app2.2.jnlp">
        <information>
           bla bla
        </information>
        <security>
            <all-permissions/>
        </security>
        <resources>
            <j2se version="1.4"/>
            <jar href="http://10.3.0.62/mapped/gui.jar?jwsid=#JWS_CODE#" version="2.2"/>
            <jar href="http://10.3.0.62/mapped/data.jar?jwsid=#JWS_CODE#" version="2.2"/>
            <jar href="http://10.3.0.62/mapped/log4j.jar?jwsid=#JWS_CODE#"/>
        </resources>
        <application-desc main-class="com.bet.blues.gui.Application">
            <argument>-host</argument>
            <argument>ursus</argument>
            <argument>-port</argument>
            <argument>17771</argument>
        </application-desc>
    </jnlp>2. All resources found in /mapped/ directory are mapped to JWSServlet
    3. The users login to a site , clik on link , /mapped/app2.2.jnlp , the servlet checks if the session is active , gets the PLATFORM form browser request header , gets the JWSCODE for the logged user, replaces this in the template, and returns it to the client
    4.Now after the 1st download the JNLP file is opened by JWS Client , that checks for latest version , requesting the JNLP file again
    like this:
    GET http://10.3.0.62/mapped/f12ks21092___windows___app2.2.jnlp5.Now the servlet sees the the request has a JNLP file name with an ID and PLATFORM, and serves the JNLP as before
    6.The JWS Client will request for JAR Files
    GET http://10.3.0.62/mapped/gui.jar?jwscode=f12ks21092?version-id=2.2Note: that i have forced JWSID parameter in the URL, that's why the query string contains 2 "?"
    - forcing this is because the mapped/*.jar is redirected JnlpDownloadServlet that supports versions , diffs - i cannot use 'version' to put there the jswid param(e.g .../mapped/gui.jar version="fk12ks21092_2.2" because the JnlpDownloadServlet will not find this version , and if JWS Servlet will redirect to JnlpDownloadServlet with correct version param in request, the JWS Client will raise an exception because version responded is not right(JNLPDownloadServlet marks in response HTTP header the version of the jar so JWS CLient will chek it)
    JWS Client expects version 'fk12ks21092_ver2.2'; to correct this i should modify the JnlpDownloadServlet and i shouldnt
    THE PROBLEM :
    on older versions than 1.5 JWS Client raises an exception because it wants to create a temp file named
    " gui.jar?jwscode=f12ks21092" because it contains "?"
    Only with 1.5 that seems to parse the jar name until it meets "?" char :(
    Thats why i wanted to send an error to the client to upgrade to Java Web Start 1.5
    Now, maybe u have a solution to this problem...
    All i want is a solution to let JWS Client download jars only if the user is authenticated by some mecanism....and also support the versioning system.
    Also:
    Note that the jar names must preserve on the client JWS Cache dir ( i cannot use the same method to pass the JWSCODE when requesting the JARS as when requesting the JNLP).

    You need to look into JAAS

  • Deleting downloaded email from iphone but not web server

    I recently purchased an iphone 3gs. My wife has had an iphone 3g for over a year. I am having a problem deleting email on my 3gs. Whenever my wife downloads mail to her phone, she can delete if off her phone but leave it on the web server for our internet provider. This way we can still download all of our mail into Oulook on our home computer. Whenever I download email to my 3gs and delete it from my phone it also deletes it from our web server and either puts iit in the web server trash or on my iphone trash folder, whichever I have it set to go. How do I set up my iphone 3gs so that after I download email to my iphone 3gs, I can delete it from the iphone 3gs and not delete the web server version?

    Does the email account provider for the account support accessing the account as a POP or IMAP account?
    If so, it sounds like your wife is accessing the account as a POP account with the iPhone's Mail application and you are accessing the account as an IMAP account.

  • Trying to password protect a directory in my portal web server

    I have a third party web file manage called ckfinder that i am testing for a client and it works fine. However, when i try to password protect the directory using .htaccess file, it doesn't work. It starts out by kicking me to the SSO logine page, which is fine. But when i put a valid user name and password, it displays a page cannot be displayed error with the url being:
    https://infra.portal2.bynum.com:4443/sso/auth
    I checked the ssoServer.log and this is what it reads:
    Wed Jun 18 16:52:24 CDT 2008 [DEBUG] AJPRequestHandler-ApplicationServerThread-10 FilePolicyManager.getAuthLevel: papp success Url=http://por
    tal2.bynum.com/bellin/ckfinder/_samples/php/osso_login_success
    Wed Jun 18 16:52:24 CDT 2008 [DEBUG] AJPRequestHandler-ApplicationServerThread-10 FilePolicyManager.getAuthLevel: pappHostPort=portal2.bynum.
    com
    Wed Jun 18 16:52:24 CDT 2008 [DEBUG] AJPRequestHandler-ApplicationServerThread-10 No auth level found. Returning DefaultAuthLevel
    Wed Jun 18 16:52:24 CDT 2008 [INFO] AJPRequestHandler-ApplicationServerThread-10 FilePolicyManager.getAuthLevel returns 40
    Wed Jun 18 16:52:24 CDT 2008 [DEBUG] AJPRequestHandler-ApplicationServerThread-10 Requested Auth Level: 40
    Wed Jun 18 16:52:24 CDT 2008 [INFO] AJPRequestHandler-ApplicationServerThread-10 Entered SSOLoginServlet: :processSSOPartnerRequest method ..
    Wed Jun 18 16:52:24 CDT 2008 [DEBUG] AJPRequestHandler-ApplicationServerThread-10 AuthUtil: SSO Cookie received: null
    Wed Jun 18 16:52:24 CDT 2008 [DEBUG] AJPRequestHandler-ApplicationServerThread-10 Current Auth Level: -1
    Wed Jun 18 16:52:24 CDT 2008 [DEBUG] AJPRequestHandler-ApplicationServerThread-10 Header Accept: */*
    Any ideas??

    ok, i found out the problem. My web server was inproperly configured with by SSO Server. I reconfigured the server with the defaults and ran again and all worked fine..

  • An html exported keynote shows "Slide couldn't be displayed" when uploaded to my web server

    Uploaded an html exported keynote (6.5.2) to web server but got the msg: Slide couldn't be displayed.
    But on my mac locally it works fine.
    Trying multiple scenarios, even a new blank file but the outcome is always the same.

    Hi Lisa,
    the Office Web Apps Server discovery URL defined in Lync Topology is https://officewebappint.domain.local/hosting/discovery.
    the issue still persist. I hope there is any other solutions.
    THank you for your feedback.
    Assraf Kamaruddin Suria Business Solutions Sdn. Bhd.

  • Lion Server: How can I enable directory listing for the Web Server?

    The functionality was part of the Server App in Lion Server but was not included in Lion.  Can anyone shed some light on how to enable Directory Listing.  Any help is appreciated!

    Go to /etc/apache2 and edit the file 000_any_80_.conf
    using sudo nano command and replace  "-Indexes" with "+Indexes".
    Restart Apache with "sudo apachecrl restart"
    Good luck,
    Ricky
    from Costa Rica

  • Where to download Iplanet web server?

    I am looking for a download link to Sun Java System Web server (Oracle iPlanet Web server). Someone here knows the link? It has been a day and the closest link that I can get is just http://www.oracle.com/technetwork/middleware/iplanetwebserver-098726.html. However, it leads me somewhere else.
    Thanks

    Can you be more specific? I can only find Sun versin 7.0.8.
    This web site is really, really horrible. The links for iplanet download take you to jdeveloper or, they're completely broken.
    thanks

  • Personal Web Server - Configuration Question

    Hi All,
    I am attempting to change the 'home directory' of the personal web server from the default to '\www'. Based on my understanding this can be done by simply editing 'httpd.conf'.
    However, I am unable to edit this file, or even make a copy of it. The account that I am using has got the 'administrator' check enabled, and when attempt to type 'su' in the console, and enter my password, it responds with 'sorry'.
    How does one therefore get enough permissions to edit this file?
    Regards
    Olaf

    You probably can't su to root in the terminal because root is disabled by default as a security measure. If you want to edit that file you can use sudo to execute a command as root. In the terminal try:
    sudo emacs httpd.conf
    and then enter your password. You'll probably have to save it to another location because of directory permissions and then copy it over or something. The rest is left as an exercise to the reader.

  • Secure service in Java Web server 2.0

    Hi all, I have installed a Java Web Server 2.0 without the secure service running, and everything works just fine.
    Then I make a self-signed certificate with authstore, using key size 1024, MD5withRSA, hostname: <my computer> (testing on local net (maybe this is what fails?)), and all the other stuff. All looks good and certificate info looks like this:
    Subject Information: CN=yodopc1, OU=SW dept, O=Yodoba, L=Z?rich, ST=Z?ric, C=CH
    Issuer Information: CN=yodopc1, OU=SW dept, O=Yodoba, L=Z?rich, ST=Z?ric, C=CH
    Dates Valid: Thu Jun 28 10:19:35 CEST 2001 --> Wed Sep 26 10:19:35 CEST 2001
    Algorithm: MD5withRSA
    Serial Number: 993716375
    Then I exit, and restart (even tried rebooting machine).
    Start webserver, type inn key password, and login to the Server admin applet. There it says:
    Service -------------- Status ------ Port -- Network Address
    Java web server ------ Terminated - -------
    - Web service -------- Unknown --- 80 ----
    - Secure Web service - Unknown --- 7070 --
    If I try to start the server, it runs for about ten seconds before it is back to the same state again. Of course trying to access server through http(s)://localhost(:7070) results in a "Cannot find server..." If I delete the keys file in <JWS-root>, everything is back to where it was before I started creating the certificate.
    I have seen that there are a lot of old (1-2 years old) Posts with similar and perhaps related issues, but none of witch have any replies that finds a solution. Hopefully someone can help my now...
    All help and suggestion are Greatly appriciated.
    Sjur

    Hi Sjurba,
    Please follow this URL:
    http://www.sun.com/software/jwebserver/faq/faq.html#f6
    http://docs.iplanet.com/docs/manuals/messaging/sims35/install/postwa.doc6.html
    Also read the below.
    Client side workaround: Use Netscape Communicator 4.x instead of Netscape Navigator 3.x.
    Java Web Server workaround: Use the VeriSign root certificate that is shipped in Java Web Server 1.1. Follow these instructions:
    1.Copy or save the file named keys, located in the top level directory of your Java Web Server installation, to a secure place (for example, a floppy disk).
    2.Locate the secure server certificate that VeriSign sent you.
    3.Install Java Web Server 1.1 in a temporary directory. You don't need to run this server--you only need to run AuthStore to regenerate the keys file. (The install of
    Java Web Server 1.1 does need not be on the same machine as the install of the Java Web Server 1.1.x that has the problem).
    For the remainder of these instructions, 1.1.x server root is the installation directory of the Java Web Server 1.1.x that shows the problem. 1.1 server root is the
    installation directory of Java Web Server 1.1
    4.Copy the keys file from 1.1.x server root/ to 1.1 server root/.
    5.Run AuthStore under 1.1 server root. AuthStore is in the bin directory. You will need to type in the server passphrase to launch AuthStore.
    6.From the scrolling list, select the key that corresponds to the secure server certificate from VeriSign.
    7.Click Import and type the full path of the certificate that you received from VeriSign.
    8.Click Save to write a new keys file under 1.1 server root.
    9.Click Exit.
    10.Copy the new keys file from 1.1 server root/ to 1.1.x server root/.
    11.Restart the Java Web Server 1.1.x under 1.1.x server root.
    I hope this will help you.
    Thanks
    Bakrudeen
    Technical Support Engineer
    Sun MicroSystems Inc, India

  • Is there a problem with Allen Bradley PLC and web server export options

    It says this object will not run in a client version. I have a development version and a client version. Maybe I'm not understanding the error message. Lookout 5.0

    The process you upload to a web server needs to be a poor client process. It means you have to create a client process without the PLC driver and a server process with the PLC driver. You will just upload the client process and the server process will stay on the Lookout Server machine.
    There are several links on the support site those explain the prefered client-server architecture to choose for a Lookout application.
    Building a Sample Server-Client System in Lookout
    Converting a Lookout Server Process Into a Client
    ://ae.natinst.com/operations/ae/public.nsf/fca7838c4500dc10862567a100753500/4c13547ceb6354a886256b80...
    Hope this is a good starting point for your Lookout application design.
    Roland

  • Upload and Download a JAR/JAD file to/from a Web Server

    How do I upload the JAR and JAD file to the Web Server?
    And once deployed on the Web Server,how can I down load this.
    I have written a small MIDlet.
    I would like to upload this to my Web Server(I have Apache running),and then
    I would like to download this and test this,
    Please can any suggest.I am testing this on Siemens m50.
    Ajay

    You should configure your web server to send the correct mime types
    for .jad and .jar extensions
    Ivan

  • Issue with permissions to upload files into Apache web server to OS 10.8.2

    Hello everyone;
    I setted up Apache web server and mysql to OS 10.8.2 Mountain Lion. It's working fine except for the permissions. I can't upload files into the web site directory. Doesn't recognize, e.g., the PHP function "move_uploaded".
    One problem for my is that I can't modify the permissions by "Terminal" app since it telling me that the "Process completed" and I can't write any script.
    Any suggestion will be welcome.
    Thanks in advance.

    My only question now would be how to speed up Safari's 6.0.1 performance in 10.8.2 or do I just accept that it's a little slower than it was, which is fine. Are other folks having this issue?
    I was primarily passing along info about my particular download speed and for the Web Confidential 3.8 people: make a backup of your passwords b4 installing 10.8.2 or be prepared to upgrade.

  • How do I download a folder from a directory display on a web page?

    I have been sent a link in order to download a program which has been sent to me in a possibly corrupt form. The link opens as a directory viewer, from which I can open sub-directories. But how can I download these files?

    Just a guess, but is it possible that the link opened a ZIP archive and Firefox downloaded and launched it from a temp folder? In that case, you might be able to drag and drop or use the Extract command to move the desired files to a more convenient location.
    On the other hand, if you are still viewing the files on the web server and there are no hyperlinks or buttons associated with the individual files, you may need to check with the person who sent you the link.

  • Can iDSIE (Meta-directory) be used as a single authentication point from iPlanet Web Server for multiple databases using direct "or" indirect connectors?

    Basically, the latest release of iPlanet Web Server forces the user/group information source to be an LDAP database. Currently, the user accounts are in Active Directory, NT, Oracle and NetWare Directory Service in this heterogeneous environment.
    What I am looking for is a meta-directory product which can do two things:
    1-Single authentiation point for users in mulitple databases from iPlanet Web Server.
    2-Single administration point for all of the databases listed above.
    For example, can I add/modify/delete a user account at the meta-directory level and have this propagate to all of the databases listed above reducing the administration to one meta-directory product?

    With an Virtual Directory solution, you can authenticate Iplanet Web Server against nearly anything including any LDAPv3 Directory Server, Microsoft Active Directory, Windows NT Domains, Oracle RDBMS, IBM DB2 RDBMS, Microsoft SQL, and others.
    All of this is done dynamically and doesn't require any heavyweight synchronization process. The Virtual Directory acts as a dynamic schema / DIT / data translation engine for different types of repositories.
    OctetString's Virtual Directory Engine is one such example. You can download a 30 day evaluation copy at:
    http://www.octetstring.com
    It will take you all of 30 minutes to get iPlanet Web Server authenticated against and using groups from things like Oracle RDBMS, Windows NT Domains, or Active Directory.

  • Uploading Multiple Files from web client to web server

    Am using a Digitally signed applet to pickup files from a specific directory and only to pickup those of a specific type. Applet is called by a HTML converted page and uses the JAVA 1.3.1 plug-in. Client side is ok, but the server side does not work - cannot see how to drop the files down onto the web server.
    code
    URL url = null ;
    FileInputStream filReader = null ;
    DataOutputStream dosOutfile = null ;
    HttpURLConnection httpUrlConn = null ;
    int bytes = 0 ;
    //read local file on client's hd with signed applet
    try
    filReader = new FileInputStream( new File( fromFile ) );
    catch ( java.io.FileNotFoundException eNotFound )
    DisplayStatus ( fromFile + " Not found");
    eNotFound.printStackTrace();
    // start setup to server-side copy of in file
    try
    url = new URL ( toFile ) ;
    catch ( java.net.MalformedURLException eMalFormedUrl )
    DisplayStatus ( url + " url mal formed");
    eMalFormedUrl.printStackTrace();
    // create a HttpUrl connection for POSTING
    try
    httpUrlConn = (HttpURLConnection) url.openConnection(); // do not remove this casting, as needed
    catch ( java.io.IOException eIoException )
    DisplayStatus ( url + " IO not possible");
    eIoException.printStackTrace();
    // set preferences
    httpUrlConn.setDoInput(true); // default value, but best make sure
    httpUrlConn.setDoOutput(true); // default value, but best make sure
    httpUrlConn.setUseCaches(false); // enable write straight through
    try
    httpUrlConn.setRequestMethod("POST") ;
    // httpUrlConn.setRequestMethod("PUT") ;
    } catch ( java.net.ProtocolException eProtEx )
    DisplayStatus ( "Protocol Exception on setting up POST") ;
    eProtEx.printStackTrace();
    httpUrlConn.setRequestProperty("Content-Type", "multipart/form-data");
    // permissions?
    try
    java.security.Permission permission = httpUrlConn.getPermission() ;
    if ( iDebug == true )
    DisplayStatus ("Permission = " + permission.toString() ) ;
    DisplayStatus ( "Actions = " + permission.getActions() ) ;
    DisplayStatus ( "Name = " + permission.getName() ) ;
    catch ( java.io.IOException eUrlIOConnException )
    DisplayStatus ( "httpUrl " + httpUrlConn + " IO not possible");
    DisplayStatus ( eUrlIOConnException.toString() ) ;
    eUrlIOConnException.printStackTrace();
    // connect
    try
    this.VerifyHttpResponseCode ( httpUrlConn.getResponseCode() ) ;
    DisplayStatus ("About to connect") ;
    httpUrlConn.connect() ;
    DisplayStatus ("Connected") ;
    if ( iDebug == true )
    DisplayStatus ("Connected Content Encoding = " + httpUrlConn.getContentEncoding() ) ;
    DisplayStatus ("Connected Content Length = " + httpUrlConn.getContentLength() ) ;
    DisplayStatus ("Connected Content Type = " + httpUrlConn.getContentType() ) ;
    DisplayStatus ("Connected default allow user interaction = " + httpUrlConn.getDefaultAllowUserInteraction() ) ;
    DisplayStatus ("Connected File Map = " + httpUrlConn.getFileNameMap() ) ;
    DisplayStatus ("Connected request method = " + httpUrlConn.getRequestMethod() ) ;
    DisplayStatus ("Connected response code = " + httpUrlConn.getResponseCode() ) ;
    DisplayStatus ("Connected response message = " + httpUrlConn.getResponseMessage() ) ;
    DisplayStatus ("Connected = " + httpUrlConn.getURL() ) ;
    } // end of debug print out status
    catch ( java.net.ConnectException eConnEx )
    this.DisplayStatus ( "Connection error - no server listening or incorrect port " ) ;
    this.DisplayStatus ( "Connection error - http = " + httpUrlConn) ;
    eConnEx.printStackTrace();
    catch ( java.io.IOException eUrlConnException )
    DisplayStatus ( "url " + url + " connection not possible");
    DisplayStatus ( eUrlConnException.toString() ) ;
    eUrlConnException.printStackTrace();
    // create file on server
    try
    dosOutfile = new DataOutputStream ( new BufferedOutputStream( httpUrlConn.getOutputStream () ) ) ;
    catch ( java.io.IOException eNewFileIO )
    DisplayStatus ("Unable to create file on server / buffer output stream " + toFile ) ;
    // copy files char by char for the moment, till testing complete
    try
    bytes = filReader.read();
    while(bytes != -1)
    dosOutfile.writeByte(bytes);
    bytes = filReader.read();
    // close both files
    dosOutfile.flush ();
    dosOutfile.close ();
    filReader.close();
    catch (java.io.IOException eCpyIo )
    DisplayStatus ("Error copying files") ;
    connection of the HttpURLConnection
    gives 'Fobbiden' response for 'PUT'
    and
    'method not allowed' for 'POST'
    trying to create the file on the server than causes IOException at the create DataStream line
    What am I doing wrong?
    Is this philosphy correct?
    Should the HttpURLConnection be to the target folder
    and then create the file in it?

    hello,
    first here is my interpretation of your prob.
    You have a client.From this client you are trying to upload files onto a server.
    Finding the files and reading them on the client side is not a prob. The prob is storing them on the server side.
    right?
    If the above stated prob is right, here is a solution.
    1. You have to first inform the server that you are sending the file. Unless you do so the server will not understand when you have started sending the file.
    So, initially, the applet which you have written need to communicate with a servlet on the server side.
    This can be done using reqs.. .get or post.In the req itself you can even send the name of the folder wherein you want to store the file you are going to transfer later on.
    Next, after receiving the folder name, the servlet can now understand that next file data is going to be received.
    The applet now sends the file which is received by the servlet and stored appropriately.
    You need to explicitly write a servlet to receive a data into the file and then store the file into appropriate folder.
    for any further probs email me at [email protected]

Maybe you are looking for

  • DVD-R is soooooo slow

    I'm attempting to burn DVDs using Toast 7 Titanium and my built in Matshita DVD-R UJ835-F. It's been taking over 4 hours to burn one DVD with about 2 hours of video on it. I've finally narrowed it down to the following problem. I have Toast set at 16

  • Send data from a sharepoint 2010 list to a csv file

    How do I import a SharePoint 2010 List's data to a csv file using c# code or Powershell Script? 

  • Totally confused with mobile agent need ur help

    hello experts two things about me . i know core java well and have read some advanced java now i am reading rmi i want to make a mobile agent application that is shopping system with mobile agent my problem is as follow: * a lot of material on net th

  • Credentials panel showing 2 times

    Hi All, This is related to this thread. Range values for command object parameter I have a report and I am showing dynamic lovs in report level using another command object . When I run the report for it is asking db credentials I have given and Agai

  • Ethernet driver for WXP is not working on Satellite A100

    Satellite A100-784 PSAANE-02L011G3 ethernet driver for wxp is not working. Can not properly install driver, downloaded all possible drivers and still not working. In device manager yellow sign. I have bought my laptop with Vista BASIC and I put XP-SP