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.rmi;
00032
00033 import java.io.DataInputStream;
00034 import java.io.IOException;
00035
00036 import org.objectweb.proactive.core.body.http.util.HttpMarshaller;
00037 import org.objectweb.proactive.core.body.http.util.HttpMessage;
00038
00039
00043 public class HTTPProcess {
00044 protected DataInputStream in;
00045 protected RequestInfo info;
00046
00052 public HTTPProcess(DataInputStream in, RequestInfo info) {
00053 this.info = info;
00054 this.in = in;
00055 }
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00068
00069
00070
00071
00072
00073
00074
00075
00079 public Object getBytes() {
00080
00081
00082 Object result = null;
00083 byte[] replyMessage = null;
00084 String action = null;
00085
00086 byte[] source = new byte[info.getContentLength()];
00087 int b;
00088
00089 try {
00090 in.readFully(source);
00091
00092
00093
00094
00095
00096 ClassLoader cl = Thread.currentThread().getContextClassLoader();
00097
00098 Thread.currentThread().setContextClassLoader(this.getClass()
00099 .getClassLoader());
00100 HttpMessage message = (HttpMessage) HttpMarshaller.unmarshallObject(source);
00101
00102 if (message != null)
00103 result = message.processMessage();
00104 Thread.currentThread().setContextClassLoader(cl);
00105 return result;
00106 } catch (IOException e) {
00107 e.printStackTrace();
00108 } catch (Exception e) {
00109
00110
00111 result = e;
00112 }
00113
00114 return result;
00115 }
00116 }