0

I want to publish a directory of static files alongside my application on GlassFish 3.1; in order to do that, I have to enable directory listings and add a custom MIME type mapping. Since this will only be needed in some installations, I want to do the configuration on the server instead of putting it in the application.

Both can be achieved by editing the default-web.xml file in the domain configuration.

To enable directory listings I have to change the listings parameter to true inside the servlet block:

<servlet>
  <!-- more stuff -->
  <init-param>
    <param-name>listings</param-name>
    <param-value>true</param-value>
  </init-param>
  <!-- more stuff -->
</servlet>

To add a MIME type mapping I have to add a block like this one:

<mime-mapping>
  <extension>ext</extension>
  <mime-type>text/plain</mime-type>
</mime-mapping>

I'd like to do this from a script so that I can reproduce the installation as needed.

Is there a way to change these configurations using asadmin or some other command line tool?

1 Answer 1

3

Asadmin does not provide element level access to default-web.xml. That said, you may just want to have an alternate copy of default-web.xml and then use a script to replace the 'shipped' version with the customized version.

2
  • Thanks. I will probably upload a diff and patch the shipped file (though diffing XML files is not beautiful).
    – Andrea
    May 21, 2013 at 10:42
  • 2
    IMHO, changing <server_name>.http-service.virtual-server.server.property.default-web-xml property to point to a custom file would be a better idea than replacing the default master file. Oct 31, 2013 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.