diff --git a/de.dentrassi.osgi.web/src/de/dentrassi/osgi/web/ResourceRequestHandler.java b/de.dentrassi.osgi.web/src/de/dentrassi/osgi/web/ResourceRequestHandler.java index 119ed2d9..297472b8 100644 --- a/de.dentrassi.osgi.web/src/de/dentrassi/osgi/web/ResourceRequestHandler.java +++ b/de.dentrassi.osgi.web/src/de/dentrassi/osgi/web/ResourceRequestHandler.java @@ -10,6 +10,7 @@ *******************************************************************************/ package de.dentrassi.osgi.web; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.URL; @@ -54,11 +55,16 @@ public void process ( final HttpServletRequest request, final HttpServletRespons return; } - response.setDateHeader ( Responses.LAST_MODIFIED, this.lastModified ); - try ( InputStream in = this.url.openStream () ) { + response.setDateHeader ( Responses.LAST_MODIFIED, this.lastModified ); ByteStreams.copy ( in, response.getOutputStream () ); } + catch ( final FileNotFoundException e ) + { + // caused by accessing a directory + Responses.notFound ( request, response ); + } + } }