Use .jar as type-map file

406 views Asked by At

I'd really like how to use '.jar"-Files as type-map files instead of standard ".var"-files using Content Negotiation.

Well, this is my configuration:

<Directory "${APACHE_PROJ}/htdocs/foo">
  AddType application/x-java-archive .jar
  AddHandler type-map .var

  <Files *.pack.gz>
    AddEncoding pack200-gzip .jar
    RemoveEncoding .gz
  </Files>

</Directory>

...working well and delivering from subfolders as expected with foo.var:

URI: foo

URI: packed/foo.jar.pack.gz
Content-Type: x-java-archive
Content-Encoding: pack200-gzip

URI: unpacked/foo.jar
content-type: x-java-archive

Renaming file foo.var to foo.jar and changing the configuration to AddHandler type-map .jar does not work, this delivers the foo.jar from the root directory right away.

1

There are 1 answers

0
Bear In Hat On BEST ANSWER

Without some form of type-map (currently .var in your case) to let the browser/server negotiation figure out what variants of your .jar files can be used, it's just going to grab the first .jar it finds and serve it. Being as Apache's default handler for a .jar file is to serve it, you would have to RemoveHandler .jar after adding the type-map handler to read it as you want, but this would prohibit the files from being served as needed.