Adding suffix to TMS HTTP request

classic Classic list List threaded Threaded
3 messages Options
Wojtek Lewandowski Wojtek Lewandowski
Reply | Threaded
Open this post in threaded view
|

Adding suffix to TMS HTTP request

Hi,

Our TMS server uses extra params to authorize and timestamp the request for tiles from TMS data.

Typical tile request looks like this:

"http://server/some/directory/path/tms/1.0.0/subdirectory/1/0/1.png?authorization=USER_KEY=&session=TIMESTAMP"

So the suffix "?authorization=USER_KEY=&session=TIMESTAMP" is added to each request.

TIMESTAMP is not constant and changes with each session so its neccessary to programatically alter it in run time. Is this possible with current TMS plugin and/or options ? How ? Or do I need to override some of the plugins or classes to add that decoration to request string ? In that case what would be your recomendation on the pieces of code to override ?

Cheers,
Wojtek Lewandowski
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Adding suffix to TMS HTTP request

Wojtek,
The only facility for doing this in osgEarth is the HTTP::setURLRewriter function. This will let you set a callback that you can use to alter the HTTP URL just before the request goes out. This is a static function that will apply to all HTTP requests, so you will have to make sure you are only affecting the requests you care about for this TMS server. Also since this happens in the HTTP module, any changes you make to the URL are transient and will not affect caching.

Hope this helps!
Glenn Waldron / Pelican Mapping
Wojtek Lewandowski Wojtek Lewandowski
Reply | Threaded
Open this post in threaded view
|

Re: Adding suffix to TMS HTTP request

Thank You. This solution looks perfect to me. I will try to use it.
Cheers,
Wojtek