Geoserver Configuration Reload - rest

Not quite sure if I should even be doing this. What I am wanting is I will be dynamically generating my sld file and it looks like when you update the sld in the geoserver admin it does a reload. So I tried to do a reload using the rest api and curl and it does not appear to work.
Here is my Curl
curl -uadmin:password-XPOST http://localhost:8080/geoserver/rest/reload
If there is another way to clear everything so my sld reloads that'd be awesome as well. Just needing to get this working and am not sure why it isn't.
Thank you

I have asked this on the GIS site and received an answer suitable for what I am doing.
https://gis.stackexchange.com/questions/7754/geoserver-configuration-reload

This documentation on the REST API for Configuration Reloading may be what you are looking for...
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html#configuration-reloading
Your curl request seems pretty close, I only had to change it slightly and it worked in my environment...
curl -u admin:password -v -XPOST http://localhost:8080/geoserver/rest/reload
If this doesn't work for you, can you describe more thoroughly in what way it is not working?

Related

How to add custom http headers when using kubectl tool

Can not find any issues.
I have to add several custom http headers to access my dedicate api-server proxy, but no clues available right now. Did I miss something?
This is a dirty hard coded hack to show you how to get the outcome your looking for it's not a fully vetted solution. This method will compile a new version of kubectl that will add your needed headers. Maybe it will at least give you a idea to run with.
The reason I wanted to do this is because I put my k8s api endpoint on the internet and safeguarded it with Cloudflare Access. To allow Cloudflare access to let me get past the steel wall I needed to pass in two headers one for my client id and the other for client secret. This ended up working like a charm and is one case someone may want to add custom headers.
Steps:
I assume you have Go installed and setup, if not go do that now.
git clone https://github.com/kubernetes/kubernetes.git (could take awhile it's pretty big)
cd kubernetes/staging/src/k8s.io/client-go/transport/
Open file round_trippers.go in your favorite code editor
Search for func (rt userAgentRoundTripper) RoundTrip(req http.Request) (*http.Response, error)
Add your needed headers by adding lines like this req.Header.Set("Bob-Is", "cool")
cd back to root folder kubernetes/
cd cmd/kubectl/
go build custom-kubectl
now test it with ./custom-kubectl get ns --v=9
in that output look for the header you added to the rest calls to K8s api, you should see -H "Bob-Is: cool" in the output
To make this not a hack maybe see if there's a way to add a kubectl plugin you create do to this for you or ask the kind folks in the k8s community how you can make this hacky method a bit cleaner or if there's a reason adding customer headers isn't a good idea. Worst case parameterize your custom kubectl build to pull in a new parameter you add --custom-request-headers and make it a bit more clean.

Confluence REST API update issue: Property with name sync-rev is not a String

I am writing a script to update a confluence page through the REST API, using:
curl -u user:password -X PUT -H 'Content-Type: application/json' -d'{"id":173390846,"type":"page","title":"test4","body":{"storage":{"value":"hello world","representation":"storage"}},"version":{"number":10}}' http://confluence.private.com/rest/api/content/173390846
but sometimes i get the following error.
{"statusCode":500,"message":"java.lang.IllegalArgumentException: Property with name sync-rev is not a String"}
This can happen if I manually edited and saved the page, or it can happen without the page having been edited manually.
Sometimes if I run the update again it works, and some times it persists and gives the same error.
The script im writing is bigger than the hello world example, but If I created a new blank page, updated it through the REST API, edited it manually, and attempted to update it again (with version incremented) I got the abovementioned error.
I have not found any mention of the property sync-rev other than in this doc, but it has not helped me in solving my problem.
Our confluence version is 5.9.6
Why am I getting this error, and what can i do/change so that it goes away?
I've got the same problem and asked for help in the atlassian community. You can follow my question at https://answers.atlassian.com/questions/38379050/how-to-update-confluence-pages-using-rest-api
Further I contacted the support as it seems to me that this problem is a bug at confluence. I will keep you updated with the supports response.
Edit: This is what Atlassian suggests:
backup the database since this require manual database delete
run the following SQL query:
// identify how many entries need to be deleted
select count( distinct propertyid) from CONTENTPROPERTIES where propertyname='sync-rev';
// delete all of the entries
delete from CONTENTPROPERTIES where propertyname='sync-rev';
restart Confluence instance
verify if the problem persist
Please note that I have not verified their solution yet.

How do relative URLs work in Sinatra?

I am hosting my Sinatra application using Apache with Passenger. It's hosted within a subfolder -- meaning, my main site is example.com, my application is at example.com/popcorn.
So I have a get '/' route, and that works fine. The problem is that my view includes a HTML form that makes a post request to upload, and the post '/upload' route isn't handling it. Instead of example.com/popcorn/upload, it's trying to get example.com/upload.
So I figure okay, not the ideal solution, but for now I'll hardcode the form action URL. But that doesn't work either -- making the action popcorn/upload fails too. This is where I get a little baffled, and my Google-fu was weak, I couldn't find help there.
Maybe I could have some kind of Apache rewrite rule, but is that the correct solution? Am I missing something? I would really appreciate a tip here because it feels like I've messed up something very simple and it's really bugging me.
You probably want the url helper method. That takes into account where the app is mounted on the server:
url('/upload')
The above code will evaluate to something like this:
http://example.com/popcord/upload
Inside your app you shouldn’t need to change anything, this will be routed to the existing post '/upload' handler.

RESTFUL API : new Iron Router version this.request.body not working anymore

I had my API fully functional and everything was working like a charm but with the last updates of Iron Router (Meteor update could impact?) my command
this.request.body
doesn't render nothing when I have a POST call on my API (all calls work good and I have no problem with GET this.params), I took a look at the docs and I don't see nothing talking about this, does anyone have an idea?
Thanks for your help =)
PS : I tried to replace it (without success obviously) by :
this.params.query.body
this.request.query.body
When I try to do a JSON.stringify on this.request it is empty so I guess it has been moved somewhere...
As asked here https://github.com/EventedMind/iron-router/issues/1003, just add:
Router.onBeforeAction(Iron.Router.bodyParser.urlencoded({extended: false}))
in your Meteor.startup

CURL class that works like simple HTML DOM?

So i've been using both CURL and simple_html_dom for a while, for anyone who is not familiar with simple HTML DOM - It allows you to go through elements with ease and without the hassle of having to use regex/exploding stuff and so on.
E.g.
$html = file_get_html($obj->loc);
$item['title'] = $html->find('#Prod-Name h1',0)->plaintext;
However as far as i'm aware this does not support cookies - like CURL does, is there something out there that does?
Would be interested to hear peoples experience in this screen scraping/bot creation.
You can just download with curl and parse it with the parsing lib of your choice. I use this method sometimes but I'm not very happy with it, it would be nice if php had some decent scraping libs and even nicer if they were built in.