On 30-01-16 12:08, Andrea Aime wrote:
The ResourceMetadata xml representation should be follow the same
resource interlinking
approach as our main REST API, for example:
Modified.
I'd remove POST, two ways to do exactly the same things seem redundant
to me,
not sure what other think... maybe the API is easier to use if one
does not
have to remember whether to use PUT or POST? :-)
Fair enough, done.
I see that Java 7 has this useful API, maybe it can be used for a guess?
http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#probeContentType%28java.nio.file.Path%29
I didn't want anything based on Files, because I don't want to force
caching it as a file just to determine the mime type.
But I have found a way that uses both filename and content:
String mimeType =
URLConnection.guessContentTypeFromName(resource.name());
if
(MediaType.APPLICATION_OCTET_STREAM.getName().equals(mimeType)) {
try (InputStream is = new
BufferedInputStream(resource.in())) {
mimeType = URLConnection.guessContentTypeFromStream(is);
} catch (IOException e) {
//do nothing, keep at application/octet-stream
}
}
I have added to the proposal that content type will be guessed in this
manner.
Writing the above I actually raised one more question: what happens if
someone
goes and chances configuration files using the resource REST api?
It's ok to say "it's store implementation dependent", but at least we
should make
a statement on that (otherwise people will start assuming that the
behavior
of one store is actually valid for all stores).
I don't understand your point. The REST API will give to administrators
the same control over the resource store as they would have through the
file system with a regular data directory.
Oh, and one final question, I see it's a proposal, I'm assuming this
means these
new endpoints will be folded in the main rest API, instead of being a
community
module, right?
So is it going to be implemented using the same library as the main
REST api?
Yes.
Regards
Niels
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel