【发布时间】:2012-07-09 01:20:24
【问题描述】:
我正在使用 Lucene 索引 PDF 文档,我使用 Eclipse indigo 作为 IDE 和 tomcat7 作为 servlet 容器,问题是当我索引文档并希望保存原始文档以供以后下载时,但 eclipse 将文档放入临时目录,而不是我选择的目录。
这就是我正在做的事情。
我的 web.xml 中有这个参数
<context-param>
<description>Location to store uploaded file also the location of files to be indexed</description>
<param-name>file-upload</param-name>
<param-value>
folder\
</param-value>
</context-param>
然后像这样在 servlet init() 方法中调用它
filePath = getServletContext().getRealPath("") + File.separator + getServletContext().getInitParameter("file-upload");
简而言之,我试图将文档存储在我的项目中名为“搜索”的名为“文件夹”的目录中,但 Eclipse 会将其存储在这样的临时位置:
C:\Users\Solid\Dropbox\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Search\folder\ir_overview.pdf
但实际路径是这样的:
C:\Users\Solid\Dropbox\workspace\Search\WebContent\folder
知道如何解决这个问题吗??
【问题讨论】:
标签: eclipse servlets path lucene indexing