Hi Jon, in your PUT URL GSURL/rest/workspaces/WS/coveragestores/CSN/external.geotiff you are specifying "external" as endpoint, and it configures a file in the local filesystem.
Referring to the doc at http://docs.geoserver.org/latest/en/user/restconfig/rest-config-api.html#coverage-stores you have to use "file.geotiff" and send the file data in the PUT request. Cheers, Emanuele Alle 12:37:14 di lunedì 21 febbraio 2011, Jon Britton ha scritto: > Hi, > > I've currently got some code which creates a new coveragestore and coverage > using REST. It doesn't actually upload the coverage, but instead links > Geoserver to its current location on disk. How would I change this so that > it actually uploads the file to geoserver? My code is shown below (it using > the Jersey REST client). > > public static void linkToExternalCoverage(String geoserverUrl, File file, > String workspace, String coverageStoreName, String coverageName) { > WebResource r = client.resource(geoserverUrl + "/rest/workspaces/" > + workspace + "/coveragestores"); > try { > // POST coveragestore > String xml = "<coverageStore><name>" + coverageStoreName > + "</name><workspace>" + workspace > + "</workspace><enabled>true</enabled></coverageStore>"; > r.type("application/xml").post(String.class, xml); > > // PUT coverage > r = client.resource(geoserverUrl + "/rest/workspaces/" + workspace > + "/coveragestores/" + coverageName > + "/external.geotiff?configure=first&coverageName=" > + coverageName); > r.put(String.class, "file:/" + file.getAbsolutePath()); > } catch (UniformInterfaceException e) { > e.printStackTrace(); > } > } > > Cheers, > > Jon -- ------------------------------------------------------- Ing. Emanuele Tajariol Senior Software Engineer GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584962313 fax: +39 0584962313 mob: +39 3477895230 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://www.youtube.com/user/GeoSolutionsIT http://twitter.com/geosolutions_it http://it.linkedin.com/in/etajariol ------------------------------------------------------- ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Geoserver-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
