rest - NSIS inetc::put, cannot upload file: "Try setting the Content-type header." -
i trying use inetc::put
upload styled layer descriptor (.sld) local geoserver instance has restful endpoint. error saying need set content-type, though am.
inetc::put /silent /header "content-type: application/vnd.ogc.sld+xml" "http://username:password@localhost:8080/geoserver/rest/styles/mynewstyle" "$instdir/mynewstyle.sld" pop $0 detailprint "uploading styled layer descriptor: $0"
this returns http 400 (request error). server log has following say:
error [geoserver.rest] - not determine format. try setting content-type header. org.geoserver.rest.restletexception @ org.geoserver.rest.abstractresource.getformatpostorput(abstractresource.java:173) @ org.geoserver.rest.reflectiveresource.handlepost(reflectiveresource.java:116) @ org.restlet.finder.handle(finder.java:296) @ org.geoserver.rest.beandelegatingrestlet.handle(beandelegatingrestlet.java:37) @ org.restlet.filter.dohandle(filter.java:105) @ org.restlet.filter.handle(filter.java:134) @ org.restlet.router.handle(router.java:444) @ org.geoserver.rest.restdispatcher$1.handle(restdispatcher.java:204) @ com.noelios.restlet.ext.servlet.servletconverter.service(servletconverter.java:129) @ org.geoserver.rest.restdispatcher.handlerequestinternal(restdispatcher.java:86) @ org.springframework.web.servlet.mvc.abstractcontroller.handlerequest(abstractcontroller.java:153) [...]
it doesn't documentation inetc not indicate /header
available option inetc::post
nor inetc::put
. however, i've confirmed can use /header
set content-type inetc::post
requests create workspaces , styles in geoserver. there different inetc::put
either requires different syntax, or wasn't implemented correctly.
i haven't found single example of performing inetc::put
set content-type of request. have tried putting /header
before, between, , after url
, local_file
. can perform put using firefox add-on "poster", , using curl. not work inetc.
i using latest build of inetc available off link shared above.
i took @ source , when doing put inetc add "content-type: octet-stream" , "content-length: %size%" httpaddrequestheaders(..., http_addreq_flag_add|http_addreq_flag_replace)
after adding headers specified caller.
you should ask authors add "content-type" header before other headers fix this...
Comments
Post a Comment