00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030  
00031 package org.objectweb.proactive.core.body.http.util.messages;
00032 
00033 import java.io.IOException;
00034 import java.io.Serializable;
00035 
00036 import org.objectweb.proactive.Body;
00037 import org.objectweb.proactive.core.UniqueID;
00038 import org.objectweb.proactive.core.body.http.util.HttpMessage;
00039 import org.objectweb.proactive.core.body.http.util.HttpUtils;
00040 import org.objectweb.proactive.core.body.reply.Reply;
00041 
00042 
00048 public class HttpReply extends HttpMessage implements Serializable {
00049     private Reply reply;
00050     private UniqueID idBody;
00051 
00057     public HttpReply(Reply reply, UniqueID idBody, String url) {
00058         super(url);
00059         this.reply = reply;
00060         this.idBody = idBody;
00061     }
00062 
00063     public int getReturnedObject() {
00064         if (this.returnedObject != null) {
00065             return ((Integer) this.returnedObject).intValue();
00066         }
00067         return 0; 
00068     }
00069 
00070     public Object processMessage() {
00071         try {
00072             Body body = HttpUtils.getBody(idBody);
00073             if (this.reply != null) {
00074                 return new Integer(body.receiveReply(this.reply));
00075             }
00076         } catch (IOException e) {
00077             e.printStackTrace();
00078         }
00079 
00080         return null;
00081     }
00082 }