简体   繁体   English

如何访问http:// localhost:8080 / pdf / abc123.pdf tomcat eclipse

[英]How to access http://localhost:8080/pdf/abc123.pdf tomcat eclipse

I my code I am trying to access the file abc123.pdf like http://localhost:8080/pdf/abc123.pdf . 我的代码我试图访问文件abc123.pdf,例如http:// localhost:8080 / pdf / abc123.pdf I have set up the the project in eclipse and takes the control of tomcat installation .My project is present under C:\\apache-tomcat-6.0.45\\wtpwebapps\\ . 我已经在eclipse中设置了项目并控制了tomcat的安装。我的项目位于C:\\ apache-tomcat-6.0.45 \\ wtpwebapps \\下。 How can access the file abc123.pdf where shall i keep it so that it can be accessed by http://localhost:8080/pdf/abc123.pdf 如何访问文件abc123.pdf,我应将其保存在哪里,以便可以通过http:// localhost:8080 / pdf / abc123.pdf进行访问

You can deploy the webapp as root webapp, see: deploy webapp from Eclipse to Tomcat root context 您可以将webapp部署为根webapp,请参阅: 将Webapp从Eclipse部署到Tomcat根上下文

Resources that should be accessable directly have to be in the web -folder of your project. 应直接访问的资源必须位于项目的web夹中。 Something like this: 像这样:

C:\[PATH_TO_WORKSPACE]\[WEBAPPNAME]\web\pdf\abc123.pdf

After deployment it should be here: 部署后,它应该在这里:

C:\apache-tomcat-6.0.45\wtpwebapps\[WEBAPPNAME]\pdf\abc123.pdf
  1. Read the file in your tomcat 在您的tomcat中读取文件
  2. write this file to HttpServletResponse 将此文件写入HttpServletResponse
  3. only support the GET method 仅支持GET方法
  4. when browser get this response which with byte stream in ResponseBody it will start to download 当浏览器获得此响应时,它会在ResponseBody中使用字节流发送该响应

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Tomcat在Eclipse运行时打不开http://localhost:8080/ - Cannot open http://localhost:8080/ when Tomcat is running in Eclipse 如何在tomcat中部署Ldap war文件? 访问站点本地主机:8080 - How to deploy a Ldap war file in tomcat? to access site localhost:8080 Tomcat 7 未在浏览器上运行 (http://localhost:8080/) - Tomcat 7 is not running on browser(http://localhost:8080/ ) Tomcat 6在Eclipse中运行,但是localhost:8080在浏览器中从未响应 - Tomcat 6 is running in Eclipse but localhost:8080 never responds in browser 我的 tomcat 正在运行,但无法连接到 http://localhost:8080 - My tomcat is running but I can't connect to http://localhost:8080 Tomcat 启动但主页无法打开,网址为 http://localhost:8080 - Tomcat starts but home page cannot open with url http://localhost:8080 需要认证。 http://localhost:8080 在Tomcat中需要用户名和密码 - Authentication required. http://localhost:8080 requires a username and password in Tomcat 从eclipse启动时看不到Tomcat主页(http:// localhost:8080)。 但是,当我从tomcat bin目录启动它时会加载它。 有什么想法吗? - Cannot see Tomcat homepage( http://localhost:8080) when starting it from eclipse. But it loads when I start it from tomcat bin directory. Any idead? 如何查看网址http://www.test.com/abc.pdf是文件还是目录? - how to find out if the url http://www.test.com/abc.pdf is a file or a directory? 如何在网络上访问localhost:8080? - How to give access to localhost:8080 on network?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM