Hi Techies,

                 I have an issue with deserialization issue in my Restlet.
My code is below,

I have an interface ,
============

public interface MiddleWare extends Serializable{
        
        @Put
        public void addGroup(String name);
        
        @Get
        public ObjectRepresentation<ArrayList<UserBean>> getUserList();
        
}

My server side code is :
===============

public class ReceiveRequest extends Application{
        
        @Override
        public Restlet createInboundRoot() {
                Router router = new Router(getContext());
                router.attach("/start", Resource.class);
                return router;
        }
}


The Resource class is :
==================

public class Resource extends ServerResource implements MiddleWare,
Serializable{

        private static final long serialVersionUID = 6705338955844911422L;
        
        @Put
        public void addGroup(String name) {
                
                // Add the Data in to DB
        }

        @Get
        public ObjectRepresentation<ArrayList<UserBean>> getUserList() {
                
                ObjectRepresentation<ArrayList<UserBean>> obj = null;
                List<UserBean> list = new ArrayList<UserBean>();
                
                
                // Getting the data from DB and putting into Array List
                
                try {
                        obj = new ObjectRepresentation((ArrayList<UserBean>)
list,MediaType.APPLICATION_JAVA_OBJECT);
                } catch (IllegalArgumentException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                }
                
                System.out.println("The List is >>>>>>>> ::"+list.size());
                return obj;
        }
        
}


And my client side code is ::
=============

 ClientResource clientResource = new
ClientResource("http://springdboperation.com:8080/InvokeRestletWS/start";);
 MiddleWare testResource = clientResource.wrap(MiddleWare.class);


testResource.addGroup("Thangavel");  // This method invoking and adding the
values in DB

// But while getting the List from DB am using the following class and its
throwing null exception.

ObjectRepresentation<ArrayList<UserBean>> objec = new
ObjectRepresentation<ArrayList<UserBean>>(testResource.getUserList());

=================================


Any idea to get the Array list from the server through interface with good
practice..

Thanks in Advance..

--------------

Thangavel




-- 
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Deserialization-issue-tp5367438p5367438.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2642245

Reply via email to