A alguns dias atrás na lista GeoServer-BR, um usuário precisou recarregar o catálogo de Geoserver sem precisar reiniciar o serviço. É possível recarregar o catálogo usando o módulo de LWP no Perl, sempre que uma nova layer for adicionada ao Geoserver. Se você tiver o Perl, o seguinte códio deve servir para você também:

[source language=”:Java”]
#!/usr/bin/perl

use HTTP::Request::Common;
use HTTP::Cookies;
use LWP 5.64;
use strict;

reload_geoserver_catalog();

sub reload_geoserver_catalog {
my $browser = LWP::UserAgent->new;
my $cookie_jar = HTTP::Cookies->new;

#Perform geoserver authentication:
my $url =
‘http://localhost:8080/geoserver/admin/loginSubmit.do’;
my $response = $browser->request(POST $url,
[‘username’ => ‘someusername’,
‘password’ => ‘somepassword’,
‘submit’ => ‘Submit’]);

die "Error: ", $response->header(‘WWW-Authenticate’) ||
‘Error accessing’,
# (‘WWW-Authenticate’ is the realm-name)
"\n ", $response->status_line, "\n at $url\n Aborting"
unless $response->is_success;

$cookie_jar->extract_cookies($response);

#Load the new catalog:
$url =
‘http://localhost:8080/geoserver/admin/loadFromXML.do’;
my $req = new HTTP::Request POST => $url;
$cookie_jar->add_cookie_header($req);
$response = $browser->request($req);

#Finally, logout:
$url =
‘http://localhost:8080/geoserver/admin/logout.do’;
$req = new HTTP::Request POST => $url;
$cookie_jar->add_cookie_header($req);
$response = $browser->request($req);
}
[/source]

Se você estiver usando Linux, você poderia também usar o comando curl, que pode realizar o mesmo objetivo. Veja como utilizar o curl, neste link.
Para utilizar Java, segue o código bastando apenas alterar o username/password:

[source language=”:Java”]
// 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);
[/source]

O código seguinte é em PHP, ele permite cadastrar uma FeatureType nova e então recarregar o catálogo. Para isso você necessitará incluir a classe HttpClient.class.php (http://scripts.incutio.com/httpclient/index.php). Este código é uma parte de um código que recebe apenas XML, cria uma tabela temporária no PostGIS, insere o dado e finalmente registra o novo layer no GeoServer.

[source language=”:php”]
<?php

//Register the new data type
//using geoserver configuration tool
require_once(‘HttpClient.class.php’);

//Generate a ramdom featureType name (layer)
srand(time());
$layerName = (rand()%99999999);

//Datastore from where the FeatureType
//will be created (database in PostGIS)
$datastore="localhost_postgis";

$client = new HttpClient(‘localhost’, 8080);
$client->setDebug(false);

//Authenticate in Geoserver
$client->post(‘/geoserver/admin/loginSubmit.do’,
array (
‘username’ =>"admin";,
‘password’ =>"geoserver",
‘submit’ => ‘Submit’
));

$headers = $client->getHeaders();
//Sorry, not very nice but I did not
//manage to make it work other way…
$foo= explode(";",$headers[‘set-cookie’]);
$foo= explode("=",$foo[0]);
$sessionArray = array(‘JSESSIONID’ => $foo[1]);
$client->setCookies($sessionArray);

//Create a new Feature Type
$client->post(‘/geoserver/config/data/typeNewSubmit.do’,
array (‘selectedNewFeatureType’ =>
$datastore.’:::’.$layerName));

//edit feature details
$client->post(‘/geov2/config/data/typeEditorSubmit.do’,
array (
‘styleId’ => ‘poi’,
‘SRS’ => ‘4326’,
‘title’ => ‘temporary dataset:’ . $layerName,
‘minX’ => ‘-180’,
‘minY’ => ‘-90’,
‘maxX’ => ‘180’,
‘maxY’ => ’90’,
‘keywords’ => ‘ ‘,
‘abstract’ => ‘temporary dataset:’ . $layerName,
‘schemaBase’ => ‘–‘,
‘action’ => ‘Submit’
));

//Click Apply
$client->post(‘/geov2/admin/saveToGeoServer.do’,
array (‘submit’ => ‘Apply’));

//Click Save
$client->post(‘/geov2/admin/saveToXML.do’,
array (‘submit’ => ‘Save’));
?>
[/source]

Fonte: GeoServer