Reading-eScience-Centre / edal-java

Environmental Data Abstraction Layer libraries
Other
39 stars 30 forks source link

tomcat handled password digestion and persistent configDir #58

Closed rjdave closed 8 years ago

rjdave commented 8 years ago

I have found that for tomcat handled password digestion (set in conf/server.xml using CredentialHandler) I have to replace DIGESTED with BASIC for "<auth-method>" near the bottom of webapps/ncWMS2/WEB-INF/web.xml. Perhaps this setting would be better stored in a config outside of webapps/ncWMS2 so it is not replaced with each upgrade. Or maybe this override is already available and I don't know how to do it.

As a workaround at this point I unpack the WAR in a temporary location, make the change, and repack the WAR before placing it in my webapps folder. I do a similar process for setting the configDir for my testing server so I don't collide with my production server (running on the same physical machine).

guygriffiths commented 8 years ago

@rjdave I don't believe that the auth-method can be accessed programmatically or configured outside of web.xml. If you are aware of a way of doing this I'd be happy to look into implementing it.

However, for configDir, I think it might be a good idea to move (all of) the configuration from the config.properties file to context parameters in web.xml. Those could then be overridden by configuring individual webapp contexts in the Tomcat directory.

As for your workaround, do you need to repack the WAR? Can you not just copy the unpacked directory into webapps? I don't really have much experience with deploying webapps into a running instance of Tomcat.

guygriffiths commented 8 years ago

I've implemented the configuration of configDir (and other parameters from config.properties) in the web.xml file so that they will persist across deployments if overridden in a context file at the Tomcat level. https://github.com/Reading-eScience-Centre/edal-java/commit/cef96a148ea37be4dbfdf24096396607f5fe8b96

kwilcox commented 8 years ago

Thanks for this @guygriffiths, being able to override all of the values in the tomcat context config is crucial for us. The documentation here could be improved, but I couldn't find a repository to contribute the changes.

This

<Parameter name="configDir" value="$HOME/.ncWMS2-testserver" override="false"/>

should have all of the config options listed so people don't have to go digging into web.xml to find out what they can configure. It also wasn't obvious to me that the <Parameter> tags should be nested under <Context>.

<?xml version='1.0' encoding='utf-8'?>
<Context>
    <Parameter name="configDir" value="$HOME/.ncWMS2-testserver" override="false"/>
    <Parameter name="paletteDirs" value="$HOME/.ncWMS2-testserver/palettes" override="false"/>
    <Parameter name="styleDirs" value="$HOME/.ncWMS2-testserver/styles" override="false"/>
    <Parameter name="defaultPalette" value="[whetever]" override="false"/>
    <Parameter name="advertisedPalettes" value="[whatever]" override="false"/>
</Context>
guygriffiths commented 8 years ago

@kwilcox Thanks for that. I will update the docs tomorrow.

For future reference, all of the docs for the user guide can now be found at: https://github.com/Reading-eScience-Centre/edal-java/tree/develop/docs