Details
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.
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.