GeoServer

datastore connection paramters contain spaces and can't be updated via REST configuration

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Not A Bug
  • Affects Version/s: 2.0.2
  • Fix Version/s: 2.0.3
  • Component/s: REST
  • Labels:
    None
  • Number of attachments :
    0

Description

If the "expose primary key" flag is activated for a datastore, the REST
XML API exposes this information as an connectionParamter of the datastore.

<connectionParameters>
....
<entry key="port">5432</entry>
<entry key="Expose primary keys">true</entry>
....
</connectionParameters>

But I see no way to set this parameter via rest. Usually the connection
parameters are passed as XML tags, but <Expose primary keys> is not a
valid tag, but rather a tag with two attributes:

> > com.thoughtworks.xstream.converters.ConversionException: : expected = after attribute name (position: END_TAG seen ...</namespace><Expose primary k... @1:267) : : expected = after attribute name (position: END_TAG seen ...</namespace><Expose primary k... @1:267)
> > ---- Debugging information ----
> > message : : expected = after attribute name (position: END_TAG seen ...</namespace><Expose primary k... @1:267)
> > cause-exception : com.thoughtworks.xstream.io.StreamException
> > cause-message : : expected = after attribute name (position: END_TAG seen ...</namespace><Expose primary k... @1:267)
> > class : org.geoserver.catalog.impl.DataStoreInfoImpl
> > required-type : java.util.HashMap
> > line number : 1

Is there a trick? Or is general a solution needed for Connection Parameters containing spaces?
Maybe we could just do something like replacing all spaces with underscores when presenting and parsing REST XML connection parameters?
If one could point me to the classes that expose and parse these parameters I could try to write a patch.

Activity

Hide
Justin Deoliveira added a comment -

Hi Stefan,

There are a couple of ways to encode a map with the restconfig api. One of them (the same one that maps are encoded as ) is friendly to spaces. So just change your content to:

<connectionParameters>
....
<entry key="port">5432</entry>
<entry key="Expose primary keys">true</entry>
....
</connectionParameters>

And it should work. Going to close this as not a bug. If it does not work however please feel free to reopen.

Show
Justin Deoliveira added a comment - Hi Stefan, There are a couple of ways to encode a map with the restconfig api. One of them (the same one that maps are encoded as ) is friendly to spaces. So just change your content to: <connectionParameters> .... <entry key="port">5432</entry> <entry key="Expose primary keys">true</entry> .... </connectionParameters> And it should work. Going to close this as not a bug. If it does not work however please feel free to reopen.
Hide
Stefan Alfons Tzeggai added a comment -
Show
Stefan Alfons Tzeggai added a comment - It does work. Thanks a lot. Maybe we should add a line on that at http://docs.geoserver.org/stable/en/user/extensions/rest/rest-config-api.html and also I think its a good idea to provide a Java Example to http://docs.geoserver.org/stable/en/user/extensions/rest/rest-config-examples.html as well. How about a link to: http://code.google.com/p/gsrcj/source/browse/trunk/src/main/java/org/geopublishing/GsRest.java Stefan
Hide
Andrea Aime added a comment -

Mass closing all issues that have been in "resolved" state for 2 months or more without any feedback or update

Show
Andrea Aime added a comment - Mass closing all issues that have been in "resolved" state for 2 months or more without any feedback or update

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: