FTP在java / HTML中查找类似的应用程序 [英] FTP Look a like application in java/HTML

查看:130
本文介绍了FTP在java / HTML中查找类似的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开发FTP的更好方法看起来像下面所示的应用程序。



这将允许我项目中的人员下载所有软件我们使用的安装包括 IBM Websphere(1 GB) eclipse(500 MB)以及其他软件,包括2.5 GB到500 MB个人大小Hat Linux


  1. 更好的方法是安装Apache HTTP Server并将DocumentRoot设置为源目录,Apache完成剩下的工作?

      DocumentRoot/ hosting / softwares



  1. 使用HTML / JSP 编写简单的JAVA / J2EE Web应用程序以生成像上面的视图和伪代码likw下面。但我认为它不是一个好主意,阅读在JAVA这样的巨大文件。

     文件downloadFile = new File(filePath); 
    FileInputStream inStream = new FileInputStream(downloadFile);

    response.setContentType(mimeType);
    response.setContentLength((int)downloadFile.length());


    字符串headerKey =Content-Disposition;
    String headerValue = String.format(attachment; filename = \%s\,downloadFile.getName());
    response.setHeader(headerKey,headerValue);

    //获取响应的输出流
    OutputStream outStream = response.getOutputStream();

    byte [] buffer = new byte [4096];
    int bytesRead = -1; ((bytesRead = inStream.read(buffer))!= -1){
    outStream.write(buffer,0,bytesRead);

    while
    }

    inStream.close();
    outStream.close();


如果使用HTML或任何其他框架,请完成此操作。

解决方案

从磁盘,然后Apache是​​最简单和最有效的选择。您仍然可以提供静态 index.html 文件以改善导航和外观。



Wiki提供还有简单安全的文件上传的额外好处。你应该研究wiki,但是设置比Apache复杂。
$ b webapp服务器(servlet / JSP,J2EE,.NET,...)并不是真正相关的,因为它们用于动态内容。他们当然可以提供静态内容,但是为了您的目的使用这些内容是过分的,除非您的文件需要存储在数据库中,而不是文件系统中。


What would be a better approach to develop a FTP look a like application as the one shown below .

It would allow people in my project to download all the software installables we use , like IBM Websphere (1 GB) , eclipse (500 MB) and lot's of other software ranging from 2.5 GB to 500 MB individual size which are hosted in Red Hat Linux

  1. Is it better just install Apache HTTP Server and set the DocumentRoot to the source directory and Apache do the rest?

    DocumentRoot "/hosting/softwares"
    

  1. Write a simple JAVA/J2EE web application using HTML/JSP to generate view like above and with pseudo code likw below .But i think its not good idea to read such huge files in JAVA.

    File downloadFile = new File(filePath);
    FileInputStream inStream = new FileInputStream(downloadFile);
    
    response.setContentType(mimeType);
    response.setContentLength((int) downloadFile.length());
    
    
    String headerKey = "Content-Disposition";
    String headerValue = String.format("attachment; filename=\"%s\"",  downloadFile.getName());
    response.setHeader(headerKey, headerValue);
    
    // obtains response's output stream
    OutputStream outStream = response.getOutputStream();
    
    byte[] buffer = new byte[4096];
    int bytesRead = -1;
    
    while ((bytesRead = inStream.read(buffer)) != -1) {
        outStream.write(buffer, 0, bytesRead);
    }
    
    inStream.close();
    outStream.close();   
    

Is there any other approach to get this done , like using HTML or any other framework.

解决方案

If your files are 100% static and served from disk, then Apache is the easiest and most efficient choice. You can still provide static index.html files to improve navigation and look-and-feel.

A wiki provides the extra benefit of easy secured file upload as well. You should look into wikis, but setup is more complex that Apache.

A webapp server (servlet/JSP, J2EE, .NET, ...) is not really relevant, because they are intended for dynamic content. They can of course serve static content, but it's overkill to use for your purpose, unless your files need to be stored in a database, instead of the file system.

这篇关于FTP在java / HTML中查找类似的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆