Hello list,
thanx very much, Alex
if someone is interested in the java code fragment to reload the geoserver config, here it is (only adjust your addresses/ username/password):
// do login
URL url=new URL("http://localhost:8080/geoserver/admin/loginSubmit.do?username=goeserverUser&password=geoserverPassword&submit=Submit"\);
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
String responseString=new String();
BufferedReader in = new BufferedReader(new InputStreamReader(inStream));
while(in.ready())
{ responseString+= in.readLine(); }
System.out.println("------------------------------------------------------\nresponseString:"+responseString);
// reload
String cookie=conn.getHeaderField("Set-Cookie");
System.out.println("cookie-text:"+cookie);
cookie = cookie.substring(0, cookie.indexOf(";"));
String cookieName = cookie.substring(0, cookie.indexOf("="));
String cookieValue = cookie.substring(cookie.indexOf("=") + 1, cookie.length());
String cookieString=cookieName+"="+cookieValue;
URL url2=new URL("http://localhost:8080/geoserver/admin/loadFromXML.do"\);
URLConnection conn2 = url2.openConnection();
conn2.setRequestProperty("Cookie",cookieString); // set the Cookie for request
conn2.connect();
inStream = conn2.getInputStream();
in = new BufferedReader(new InputStreamReader(inStream));
responseString=new String();
while(in.ready())
{ responseString+= in.readLine(); }
System.out.println("------------------------------------------------------\nresponseString:"+responseString);
//logout
URL url3=new URL("http://localhost:8080/geoserver/admin/logout.do"\);
URLConnection conn3 = url3.openConnection();
conn3.setRequestProperty("Cookie",cookieString);
conn3.connect();
inStream = conn3.getInputStream();
in = new BufferedReader(new InputStreamReader(inStream));
responseString=new String();
while(in.ready())
{ responseString+= in.readLine(); }
System.out.println("------------------------------------------------------\nresponseString:"+responseString);
Best regards, Sven
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193