* @exception RemoteAccessException If somenetwork failure occured.
*/
public RemoteResource registerResource(String id, String classname)
throws RemoteAccessException
{
ResourceDescription rd = new EmptyDescription(classname, id);
try {
Request req = createRequest();
// Prepare the request:
req.setMethod("REGISTER-RESOURCE");
req.setContentType(admin.conftype);
req.setURL(url);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
OutputStream out;
if (debug) {
out = bout;
} else {
out = new GZIPOutputStream(bout);
}
admin.writer.writeResourceDescription(rd, out);
byte bits[] = bout.toByteArray();
req.setContentLength(bits.length);
if (!debug) {
req.addTransferEncoding("gzip");
}
req.setOutputStream(new ByteArrayInputStream(bits));
// Run it:
Reply rep = admin.runRequest(req);
// Decode the result:
rd = admin.reader.readResourceDescription(getInputStream(rep));
RemoteResource ret =
new PlainRemoteResource(admin, url, rd.getIdentifier(), rd);
return ret;
} catch (RemoteAccessException rae) {
throw rae;
} catch (Exception ex) {