[Geoserver-devel] accessing URL parameters -geoserver 2.3.0

I’m trying to figure out how to get a hold of the url in my datastore java code to parse the parameter in the url. I’ve read the thread “accessing URL Parameters - msg#00434” suggesting:

  1. " If you add &viewparams=p1:v1;p2:v2;… into your request the
    datastore will receive a data access request with a Query containing, among its Hints at the
    Hints.VIRTUAL_TABLE_PARAMETERS key, a hash map with the p1, v1, p2, v2 pairs."
    I did not try exactly passing the parameter as “&viewparams:p1:v1…” as suggested, in debug mode, I saw Hints.Table, but it did not have any data.

  2. The other suggestion "If you need something more generic and are willing to marry the store
    1-1 to GeoServer you can also use the org.geoserver.ows.Dispatcher.REQUEST thread local,
    that one will contain the request and the various stages of its parsing, including the raw

kvp, the parsed kvp, the parsed request object and so on. "

This is exactly what I want to try, but I can’t figure out how to get a hold of the thread.
Thanks in advance for any advice

I’m trying to figure out how to get a hold of the url in my datastore java code to parse the parameter in the url. I’ve read the thread “accessing URL Parameters - msg#00434” suggesting:

  1. " If you add &viewparams=p1:v1;p2:v2;… into your request the
    datastore will receive a data access request with a Query containing, among its Hints at the
    Hints.VIRTUAL_TABLE_PARAMETERS key, a hash map with the p1, v1, p2, v2 pairs."
    I did not try exactly passing the parameter as “&viewparams:p1:v1…” as suggested, in debug mode, I saw Hints.Table, but it did not have any data.

  2. The other suggestion "If you need something more generic and are willing to marry the store
    1-1 to GeoServer you can also use the org.geoserver.ows.Dispatcher.REQUEST thread local,
    that one will contain the request and the various stages of its parsing, including the raw

kvp, the parsed kvp, the parsed request object and so on. "

This is exactly what I want to try, but I can’t figure out how to get a hold of the thread.
Thanks in advance for any advice

On Wed, Jun 19, 2013 at 3:35 PM, m l <ml032013@anonymised.com> wrote:

2. The other suggestion "*If you need something more generic and are
willing to marry the store*
* 1-1 to GeoServer you can also use the
org.geoserver.ows.Dispatcher.REQUEST thread local,
that one will contain the request and the various stages of its parsing,
including the raw
*
*kvp, the parsed kvp, the parsed request object and so on.* "

This is exactly what I want to try, but I can't figure out how to get a
hold of the thread.

Simple, you don't need to. Jus call Dispatcher.REQUEST.get() and you'll get
the Request
object for the current thread.
That's the nature of the thread locals:
http://docs.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------