Well, if they're in the same web app and you are not running out of an unexpanded war file, you can use the ServletContext.getRealPath() method to find the file on disk and then use normal File I/O operations on it.
If not, well that's more difficult as you'll need to cooperation of whatever web app the files belong to.
For remote file type, you could parse the URL, but the catch is you may not get the correct file type. http://www.thehost.com/someSection/someSubSection/Presentation.doc this is actually an html type.
try doHeader() to get the content type and file size if the web container does support it (I haven't done it)
Receives an HTTP HEAD request from the protected service method and handles the request. The client sends a HEAD request when it wants to see only the headers of a response, such as Content-Type or Content-Length. The HTTP HEAD method counts the output bytes in the response to set the Content-Length header accurately.