Right now i'm using Apache to complete some quite simple file serving. We have a JBoss 4.2.3 instance that does all of our application serving. Let me only use JBoss for everything. In Apache, I'm doing the next within the httpd.conf file to do the file serving:

Alias /reports "C:/driveReports/"
<Directory "C:/driveReports/*">
   AllowOverride All
   Options Indexes FollowSymLinks
   Order allow,deny
   Allow from all
</Directory>

Can there be something equivalent I'm able to do in JBoss to complete exactly the same factor? It appears simple, however i weren't capable of finding something that leads me to think there's an answer that does not involve Apache being associated with JBoss's Tomcat.

I understand I possibly could easily enough just slowly move the files using their "C:/driveReports" location to the JBoss web deployer location, but I'd rather not need to do this. Thanks.

I am unsure if JBoss AS has some such feature as they are. This is an application server, in the end.

You can utilize a servlet for such purpose, much like Jetty's default servlet, having a code so on this:

private void dispatchFileForDownload( File file, HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException {

    // Check the file existence.
    if( !file.exists() )
        throw new IllegalStateException("File "+file.getPath()+" does not exist.");
    if( !file.isFile() )
        throw new IllegalStateException("File "+file.getPath()+" is not a regular file.");

    // HTTP stuff.
    resp.setContentLength( (int)file.length() );
    if( artifactInfo.getFileName().endsWith(".jar") )
        resp.setContentType("application/java-archive");
    else if( artifactInfo.getFileName().endsWith(".xml") )
        resp.setContentType("text/xml");
    else
        resp.setContentType("application/octet-stream");

    resp.setHeader("Content-Disposition", "attachment; filename="+file.getName());


    ServletOutputStream os = resp.getOutputStream();
    FileInputStream in = new FileInputStream(file);
    IOUtils.copy(in, os);
    in.close();
    os.close();
}

Attempt to take the aid of this wiki page about static file serving.