Comment 6 for bug 607961

Revision history for this message
Leonard Richardson (leonardr) wrote :

There's no reason not to serve the service root through Apache. It's the same for every user and we don't want to deny access to it to anyone. I can think of four potential stumbling blocks.

1. Apropos checking in the WADL. I think I mentioned this before, but just in case. The WADL has a URL in it, https://api.launchpad.dev/beta/ or similar. This WADL is different for every site. Whose WADL gets checked in? We either need to check in all the WADL, or we need to check in a generic WADL and customize it as part of the build process.

2. There are multiple versions of the WADL at different URLs. /beta/, /1.0/, etc. Each will correspond to a different file on disk. I don't think this will cause much of a problem; we can use a rewrite rule to map /(.*)/$ to /path/to/wadl/\1.xml if that file exists.

3. The WADL doesn't have a URL all to itself. It's the WADL representation of the service root, and we use content negotiation to determine whether to serve WADL or JSON. I don't know if it's possible to do the content negotiation and send the request to Apache if it's WADL and to Zope if it's JSON.

We'd have a simpler and faster system if we also pre-generated the JSON, checked *that* in, and served both representations from Apache. Any argument for serving the WADL from Apache applies just as strongly to the JSON, it's just that the body of the JSON is much smaller. Since the JSON representation is full of URLs, we'd have to generate a generic JSON as well as a generic WADL and customize it at build time.

4. We've implemented optimizations for spending as little time as possible sending out WADL. We serve an ETag so the client can make conditional requests later, and we use mod_compress to compress the representation if the client asks for it. These optimizations need to be preserved.

This shouldn't be difficult: the compression happens in Apache already, and Apache knows how to generate an ETag for a file on disk. There will be a point where the ETag suddenly changes format and everyone re-downloads the WADL, but that will probably happen during a Launchpad upgrade, when the ETag would have changed anyway.