in that case you should use rest to get the layer featuretype and then get
the datastore from the featuretype url

*first*
*http://localhost:8080/geoserver/rest/layers/layername.xml
<http://localhost:8080/geoserver/rest/layers/layername.xml>*

parse XML and fetch the first_url value

<resource class="featureType">
<name>workspace:layername</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate" href="
*first_url*" type="application/xml"/>
</resource>

*second*
call the first_url, parse XML and fetch the second_url value

<store class="dataStore">
<name>workspace:storename</name>
<atom:link xmlns:atom="http://www.w3.org/2005/Atom"; rel="alternate" href="
*second_url*" type="application/xml"/>
</store>

*last*
call second_url and fetch the result looking for the key value of:

*<datastore><connectionParameters><entry key="url"><value></entry>*in the
response XML


Vikram <vikram.es...@fleetroute.com> escreveu no dia quinta, 23/01/2020
à(s) 13:47:

> Thanks. Is there also a way to get the shapefile path using the layer name
> ?
>
> For example, If I publish a layer A using a shapefile X (data store), Is
> it possible to get the path or the fullname of X using the layer name "A" ?
>
>
> -Vikram
> On 23/01/2020 13:44, Vitor Fonseca wrote:
>
> I would use the rest API.
>
> doesn't refer javascript but you could start here
>
> https://docs.geoserver.org/stable/en/user/rest/stores.html#listing-store-details
>
> to access geoserver rest API you will also need to deal with
> authentication in client side (maybe using ajax/XMLHttpRequest)
>
> then you could fetch the store details rest endpoint
> e.g.
> http://localhost:8080/geoserver/rest/workspaces/acme/datastores/roads.xml
>
> and parse the response with a xml parser to find what you're looking for
>
> Vikram <vikram.es...@fleetroute.com> escreveu no dia quinta, 23/01/2020
> à(s) 12:26:
>
>> Hi all,
>>
>> is there a way to get the connection parameters for ex, the location of
>> a shapefile of a data store in Geoserver ?
>>
>> I want to get this through a URL request from a client (javascript
>> preferably. if not, Java).
>>
>> Regards,
>>
>> Vikram
>>
>>
>>
>> _______________________________________________
>> Geoserver-users mailing list
>>
>> Please make sure you read the following two resources before posting to
>> this list:
>> - Earning your support instead of buying it, but Ian Turton:
>> http://www.ianturton.com/talks/foss4g.html#/
>> - The GeoServer user list posting guidelines:
>> http://geoserver.org/comm/userlist-guidelines.html
>>
>> If you want to request a feature or an improvement, also see this:
>> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>>
>>
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>
>
> --
>
> www.vfonsecaz.pt
>
>

-- 

www.vfonsecaz.pt
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to