I am indexing PDF document using Lucene, I use Eclipse indigo as an IDE and tomcat7 as a servlet container , the problem is when I index the document and want to save the original document for later downloading, but eclipse put the documents in temporary directory in stead of the directory I have chosen.
here is what I am doing.
I have this param in my 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>
then calling it inside servlet init() methode like this
filePath = getServletContext().getRealPath("") + File.separator + getServletContext().getInitParameter("file-upload");
in short I am trying to store the document in directory called “folder” inside my project which is called “Search”, but eclipse will store it in the temporary place like this:
C:\Users\Solid\Dropbox\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Search\folder\ir_overview.pdf
but the actual path is like this :
C:\Users\Solid\Dropbox\workspace\Search\WebContent\folder
any idea how to solve this??
Eclipse deploys the project to a working directory outside of the Project Workspace.
Default, Eclipse uses
/workspace/.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebappspath to deploy web application.
It has to re-organize the files from the directory structure the Eclipse Workspace expects to the format a Web Application expects.
Click on > Servers Tab. Right Click on Servlet container (Tomcat 7 in your case) and Open (F3 is shortcut for eclipse).
You should be able to see Server Path option which contains
You can specify the deploy location here.
Note: Server must be published with no modules present to make changes.
So, undeploy your web applicaion and change the location.
EDIT:
Unrelated to Question : You should create separate directory out side webContent / webapp to store
Luceneindexes. This practice would be useful when you deploy application to Tomcat production