I think, it's not right (at least, not very convenient) to save user files to WebContent folder of the web application. WebContent folder is meant for resources that are distributed inside the web application archive.
It's common practice to use some specific location on disk for user files that are planned to be reused.
1) To specify the location in configuration file, create file app.properties in the root of application CLASSPATH. In this file you will have the property
user.pdfs.location=/path/to/user/pdfs
To read the property use the following code in your servlet:
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream propsStream = classLoader.getResourceAsStream("app.properties");
Properties properties = new Properties();
properties.load(propsStream);
String userPdfsPath = properties.getProperty("user.pdfs.location");
So you'll always be able to change location of PDFs in "/WEB-INF/classes/app.properties" file in already created WAR.
2) Or you may pass parameter to the Tomcat's JVM:
-Duser.pdfs.location="/path/to/user/pdfs"
To read value of the parameter use the following code:
String userPdfsPath = System.getProperty("user.pdfs.location");
Another popular (but not always right) approach is to save files to database as BLOBs. Consider that in that case you sometimes may have problems with application perfomance or backups.
If you want to work with temporary files (for example, you want to create PDFs for users just to download) you should use JVM's temp directory for that. To get temp directory use
String tempDirPath = System.getProperty("java.io.tmpdir");
Or simply create temp PDF file with
File tempPDF = File.createTempFile("temp-", ".pdf");