Open source, commercial support.

Using the displayname field

Community provided content
Register
New page Edit

The DAV spec defines a "displayname" field which can contain any arbitrary text representing the name of a resource to the end user. This field doesnt form part of the url.

But most people usually want the displayname field to be the same as the resource name, ie Resource.getName(). This is what Milton does by default.

However, Milton allows you to change this behaviour by dependency injection.

The displayname property is determined by the injected instanceof DisplayNameFormatter, which gets injected into the WebDavProtocol class (see configuration, or below). Two default implementations are provided:

As of the time of writing (13/7/2010) its not certain that the displayname field ever needs to be put inside a CDATA section, but Apache Slide appears to do so.

How to set your implementation into milton

It gets set on a property of the WebDavProtocol class:

WebDavProtocol p = ...;
p.setDisplayNameFormatter(.. your implementation...)

How you get a reference to WebDavProtocol depends on how you do your configuration. If you're using the simplified HttpManager constructor, as is used in MiltonServlet, you might want to write a little bit of code to find it...

(pseudo code)
for(ph : httpManager.gethanders() {
   if( ph instanceof WebDavProtocol ) {
      ... set the display name formatter property
  }
}

But if you configure everything through spring you can do it from the config file.

blog comments powered by Disqus