import java.io.*; import java.util.*; import Publish; // library :-) class A implements Serializable { public A() { i=0; s="test";} int i; String s; } // test public class Test { public static void main(String argv[]) { A a = new A(), a1=new A(), b=null; // new publishing directory Publish p=new Publish("http://host/servlet/PublishServlet/","your_dir_is_here"); a.i=1; a1.i=2; try { // save p.putObject(a); } catch (IOException e) { System.out.println("can not save object a!"); } try { // save p.putObject(a1,"my_name"); } catch (IOException e) { System.out.println("can not save object a1!"); } try { // restore b=(A) p.getObject("my_name"); } catch (IOException e) { System.out.println("can not restore object !"); } // check if (b==null) System.out.println("such object does not exist"); else System.out.println(b.i); try { // no such object b=(A) p.getObject("C"); } catch (IOException e) { System.out.println("can not restore object C !"); } try { Vector v=p.getObjects("A"); System.out.println("Count is "+v.size()); System.out.println("1-st "+((A)v.elementAt(0)).i+" 2-nd "+((A)v.elementAt(1)).i); } catch (Exception ex) { System.out.println("no such objects"); } } }