Hello
If you use Pax Web Undertow instead of default(ish) Pax Web Jetty, you
could add this to ${karaf.home}/etc/undertow.xml:
...
<server>
<host name="default-host" alias="localhost">
<location name="/scans handler="static-content" />
...
</host>
</server>
...
<handlers>
<file name="static-content" path="/path/to/scans"
directory-listing="false" follow-symlink="false" />
</handlers>
If you use Pax Web Jetty or Pax Web Tomcat, you can do it too with
container-specific configuration (jetty.xml or tomcat-server.xml)
regards
Grzegorz Grzybek
pt., 20 lut 2026 o 16:48 Steinar Bang <[email protected]> napisał(a):
> Is it possible, without writing any code, to make karaf serve static
> files with http?
>
> I.e. is it possible to give commands to the karaf console that will
> cause karaf to serve static files from a local directory?
>
> To use a more concrete example: can I from the karaf console command
> line give configuration commands to make karaf serve the directory
> /home/sb/Pictures/scans/
> with the URL
> http://localhost:8181/scans/
> ?
>
> It doesn't have to be high performing.
>
> The use case is that I have augmented my oldalbum application[1][2] to be
> able to export files with EXIF metadata for date, title and description,
> and I would like to make it convenient to use oldalbum just for this.
>
> I changed oldalbum to fix EXIF metadata, because I am scanning old
> photos and would like to set the date on them. And there wasn't any
> convenient tools out there that worked the way I wanted them to work so
> I've been tinkering with oldalbum to make it as convenient as possible,
> to sort and modify dates and titles and description on them, and then
> make it possible to download JPEGs with modified EXIF metadata, and
> collections of JPEGs as zip files with modified metadata (leaving the
> originals untouched).
>
> But oldalbum requires the pictures it imports to be served by an HTTP
> server. For myself I am serving static files using nginx.
>
> But for someone who doesn't want oldalbum for anything else, but just
> wants it to fix the EXIF metadata of scanned pictures, it would be
> convenient to just download and unpack karaf, install oldalbum (from
> maven central) and then give some commands to serve some local
> directories containing pictures.
>
> Thanks!
>
> References:
> [1] <
> https://steinar.bang.priv.no/2022/02/12/1990-ies-picture-archives-in-modern-skin/
> >
> [2] <https://github.com/steinarb/oldalbum>
>
>
>