[httpclient] RE: Http Client- How to send and recieve Serialized Object using Http Client
Can any one give me url for getting Base64OutputStream and Base64InputStream classes on google. Tahnks. Sanjeev Tripathi -Original Message- From: Sharples, Colin [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 2:57 PM To: Jakarta Commons Developers List Subject: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client Assuming it's not just because of the typo in the content type (should be application/octet-stream), you could try base 64 encoding the object output stream, and then you can just use text/plain content type. On the other end you base 64 decode the response body before passing it to the object input stream. There are plenty of examples of how to do base 64 encode/decode on the web. Colin Sharples IBM Advisory IT Specialist Email: [EMAIL PROTECTED] -Original Message- From: Sanjeev Tripathi [mailto:[EMAIL PROTECTED] Sent: Tuesday, 8 February 2005 8:18 a.m. To: commons-dev@jakarta.apache.org Subject: Http Client- How to send and recieve Serialized Object using Http Client Hi, I am working on thick client proxy that will connect to servlet and retrive and save data to database. I am using Http Client for communication. I am able to send string values using parameter in request as follows. // ** NameValuePair userid = new NameValuePair(LOGIN_NAME, login); NameValuePair password = new NameValuePair(LOGIN_PASSWORD, password); NameValuePair thickClient = new NameValuePair(ThickClient, ThickClient); authpost.setRequestBody( new NameValuePair[] {action, url, userid, password,thickClient}); // ** I am able to send xml string as parameter and able to receive it back from response as String. But I am getting problem in serialized user defined objects communication. Following is not working //*In Servlet* if (request.getParameter(ThickClient).equals(ThickClient)) { response.setContentType(application/octel-stream); ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream()); oos.writeObject(new com.parago.communication.SubmissionVO(1,Controll Servlet)); oos.flush(); oos.close(); return; } In Thick Client Proxy * client.executeMethod(authpost); System.out.println(Login form post: + authpost.getStatusCode()); ObjectInputStream ois = new ObjectInputStream(authpost.getResponseBodyAsStream()); SubmissionVO vo = (SubmissionVO)ois.readObject(); System.out.println(id : +vo.getSubmissionId() +: desc: + vo.getDescription()); //**Here SubmissionVO is Serialized Object*** public class SubmissionVO implements java.io.Serializable{ public SubmissionVO(int id,String desc) { this.submissionId = id; this.description = desc; } private int submissionId; private String description; public int getSubmissionId () { return submissionId; } public String getDescription() { return description; } } //*** Please suggest me. How to send and receive Serialized User Defined Value Objects in using Http Client. Thanks. Sanjeev Tripathi __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Http Client- How to send and recieve Serialized Object using Http Client
Assuming it's not just because of the typo in the content type (should be application/octet-stream), you could try base 64 encoding the object output stream, and then you can just use text/plain content type. On the other end you base 64 decode the response body before passing it to the object input stream. There are plenty of examples of how to do base 64 encode/decode on the web. Colin Sharples IBM Advisory IT Specialist Email: [EMAIL PROTECTED] -Original Message- From: Sanjeev Tripathi [mailto:[EMAIL PROTECTED] Sent: Tuesday, 8 February 2005 8:18 a.m. To: commons-dev@jakarta.apache.org Subject: Http Client- How to send and recieve Serialized Object using Http Client Hi, I am working on thick client proxy that will connect to servlet and retrive and save data to database. I am using Http Client for communication. I am able to send string values using parameter in request as follows. // ** NameValuePair userid = new NameValuePair(LOGIN_NAME, login); NameValuePair password = new NameValuePair(LOGIN_PASSWORD, password); NameValuePair thickClient = new NameValuePair(ThickClient, ThickClient); authpost.setRequestBody( new NameValuePair[] {action, url, userid, password,thickClient}); // ** I am able to send xml string as parameter and able to receive it back from response as String. But I am getting problem in serialized user defined objects communication. Following is not working //*In Servlet* if (request.getParameter(ThickClient).equals(ThickClient)) { response.setContentType(application/octel-stream); ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream()); oos.writeObject(new com.parago.communication.SubmissionVO(1,Controll Servlet)); oos.flush(); oos.close(); return; } In Thick Client Proxy * client.executeMethod(authpost); System.out.println(Login form post: + authpost.getStatusCode()); ObjectInputStream ois = new ObjectInputStream(authpost.getResponseBodyAsStream()); SubmissionVO vo = (SubmissionVO)ois.readObject(); System.out.println(id : +vo.getSubmissionId() +: desc: + vo.getDescription()); //**Here SubmissionVO is Serialized Object*** public class SubmissionVO implements java.io.Serializable{ public SubmissionVO(int id,String desc) { this.submissionId = id; this.description = desc; } private int submissionId; private String description; public int getSubmissionId () { return submissionId; } public String getDescription() { return description; } } //*** Please suggest me. How to send and receive Serialized User Defined Value Objects in using Http Client. Thanks. Sanjeev Tripathi __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client
Is there Any way I can retrieve object that I set in servlet using request.setAttruibute(name, object); And vise versa can I send from Client Side to servlet similar way as we send Other string parameter as follows PostMethod authpost = new PostMethod(/argo/XmzServlet); NameValuePair action = new NameValuePair(action, login); NameValuePair url = new NameValuePair(url, argo/index.html); NameValuePair userid = new NameValuePair(LOGIN_NAME, login); NameValuePair password = new NameValuePair(LOGIN_PASSWORD, passwd); NameValuePair thickClient = new NameValuePair(ThickClient, ThickClient); authpost.setRequestBody( new NameValuePair[] {action, url, userid, password,thickClient}); thanks. -Original Message- From: Sharples, Colin [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 2:57 PM To: Jakarta Commons Developers List Subject: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client Assuming it's not just because of the typo in the content type (should be application/octet-stream), you could try base 64 encoding the object output stream, and then you can just use text/plain content type. On the other end you base 64 decode the response body before passing it to the object input stream. There are plenty of examples of how to do base 64 encode/decode on the web. Colin Sharples IBM Advisory IT Specialist Email: [EMAIL PROTECTED] -Original Message- From: Sanjeev Tripathi [mailto:[EMAIL PROTECTED] Sent: Tuesday, 8 February 2005 8:18 a.m. To: commons-dev@jakarta.apache.org Subject: Http Client- How to send and recieve Serialized Object using Http Client Hi, I am working on thick client proxy that will connect to servlet and retrive and save data to database. I am using Http Client for communication. I am able to send string values using parameter in request as follows. // ** NameValuePair userid = new NameValuePair(LOGIN_NAME, login); NameValuePair password = new NameValuePair(LOGIN_PASSWORD, password); NameValuePair thickClient = new NameValuePair(ThickClient, ThickClient); authpost.setRequestBody( new NameValuePair[] {action, url, userid, password,thickClient}); // ** I am able to send xml string as parameter and able to receive it back from response as String. But I am getting problem in serialized user defined objects communication. Following is not working //*In Servlet* if (request.getParameter(ThickClient).equals(ThickClient)) { response.setContentType(application/octel-stream); ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream()); oos.writeObject(new com.parago.communication.SubmissionVO(1,Controll Servlet)); oos.flush(); oos.close(); return; } In Thick Client Proxy * client.executeMethod(authpost); System.out.println(Login form post: + authpost.getStatusCode()); ObjectInputStream ois = new ObjectInputStream(authpost.getResponseBodyAsStream()); SubmissionVO vo = (SubmissionVO)ois.readObject(); System.out.println(id : +vo.getSubmissionId() +: desc: + vo.getDescription()); //**Here SubmissionVO is Serialized Object*** public class SubmissionVO implements java.io.Serializable{ public SubmissionVO(int id,String desc) { this.submissionId = id; this.description = desc; } private int submissionId; private String description; public int getSubmissionId () { return submissionId; } public String getDescription() { return description; } } //*** Please suggest me. How to send and receive Serialized User Defined Value Objects in using Http Client. Thanks. Sanjeev Tripathi __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL
[httpclient]RE: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client
Can you please send me link for base 64 encode/decode examples in java. -Original Message- From: Sharples, Colin [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 2:57 PM To: Jakarta Commons Developers List Subject: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client Assuming it's not just because of the typo in the content type (should be application/octet-stream), you could try base 64 encoding the object output stream, and then you can just use text/plain content type. On the other end you base 64 decode the response body before passing it to the object input stream. There are plenty of examples of how to do base 64 encode/decode on the web. Colin Sharples IBM Advisory IT Specialist Email: [EMAIL PROTECTED] -Original Message- From: Sanjeev Tripathi [mailto:[EMAIL PROTECTED] Sent: Tuesday, 8 February 2005 8:18 a.m. To: commons-dev@jakarta.apache.org Subject: Http Client- How to send and recieve Serialized Object using Http Client Hi, I am working on thick client proxy that will connect to servlet and retrive and save data to database. I am using Http Client for communication. I am able to send string values using parameter in request as follows. // ** NameValuePair userid = new NameValuePair(LOGIN_NAME, login); NameValuePair password = new NameValuePair(LOGIN_PASSWORD, password); NameValuePair thickClient = new NameValuePair(ThickClient, ThickClient); authpost.setRequestBody( new NameValuePair[] {action, url, userid, password,thickClient}); // ** I am able to send xml string as parameter and able to receive it back from response as String. But I am getting problem in serialized user defined objects communication. Following is not working //*In Servlet* if (request.getParameter(ThickClient).equals(ThickClient)) { response.setContentType(application/octel-stream); ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream()); oos.writeObject(new com.parago.communication.SubmissionVO(1,Controll Servlet)); oos.flush(); oos.close(); return; } In Thick Client Proxy * client.executeMethod(authpost); System.out.println(Login form post: + authpost.getStatusCode()); ObjectInputStream ois = new ObjectInputStream(authpost.getResponseBodyAsStream()); SubmissionVO vo = (SubmissionVO)ois.readObject(); System.out.println(id : +vo.getSubmissionId() +: desc: + vo.getDescription()); //**Here SubmissionVO is Serialized Object*** public class SubmissionVO implements java.io.Serializable{ public SubmissionVO(int id,String desc) { this.submissionId = id; this.description = desc; } private int submissionId; private String description; public int getSubmissionId () { return submissionId; } public String getDescription() { return description; } } //*** Please suggest me. How to send and receive Serialized User Defined Value Objects in using Http Client. Thanks. Sanjeev Tripathi __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client
Ok. I am able to receive object from servlet using application/octet-stream, but How I can send the object from client to sevlet. NameValuePair allow only Strings. Thanks. Sanjeev Tripathi -Original Message- From: Sharples, Colin [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 2:57 PM To: Jakarta Commons Developers List Subject: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client Assuming it's not just because of the typo in the content type (should be application/octet-stream), you could try base 64 encoding the object output stream, and then you can just use text/plain content type. On the other end you base 64 decode the response body before passing it to the object input stream. There are plenty of examples of how to do base 64 encode/decode on the web. Colin Sharples IBM Advisory IT Specialist Email: [EMAIL PROTECTED] -Original Message- From: Sanjeev Tripathi [mailto:[EMAIL PROTECTED] Sent: Tuesday, 8 February 2005 8:18 a.m. To: commons-dev@jakarta.apache.org Subject: Http Client- How to send and recieve Serialized Object using Http Client Hi, I am working on thick client proxy that will connect to servlet and retrive and save data to database. I am using Http Client for communication. I am able to send string values using parameter in request as follows. // ** NameValuePair userid = new NameValuePair(LOGIN_NAME, login); NameValuePair password = new NameValuePair(LOGIN_PASSWORD, password); NameValuePair thickClient = new NameValuePair(ThickClient, ThickClient); authpost.setRequestBody( new NameValuePair[] {action, url, userid, password,thickClient}); // ** I am able to send xml string as parameter and able to receive it back from response as String. But I am getting problem in serialized user defined objects communication. Following is not working //*In Servlet* if (request.getParameter(ThickClient).equals(ThickClient)) { response.setContentType(application/octel-stream); ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream()); oos.writeObject(new com.parago.communication.SubmissionVO(1,Controll Servlet)); oos.flush(); oos.close(); return; } In Thick Client Proxy * client.executeMethod(authpost); System.out.println(Login form post: + authpost.getStatusCode()); ObjectInputStream ois = new ObjectInputStream(authpost.getResponseBodyAsStream()); SubmissionVO vo = (SubmissionVO)ois.readObject(); System.out.println(id : +vo.getSubmissionId() +: desc: + vo.getDescription()); //**Here SubmissionVO is Serialized Object*** public class SubmissionVO implements java.io.Serializable{ public SubmissionVO(int id,String desc) { this.submissionId = id; this.description = desc; } private int submissionId; private String description; public int getSubmissionId () { return submissionId; } public String getDescription() { return description; } } //*** Please suggest me. How to send and receive Serialized User Defined Value Objects in using Http Client. Thanks. Sanjeev Tripathi __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[httpclient] RE: Http Client- How to send and recieve Serialized Object using Http Client
How to use RequestEntity in http client to send and retrieve object from servlet and vice versa. Thanks. Sanjeev Tripathi -Original Message- From: Sharples, Colin [mailto:[EMAIL PROTECTED] Sent: Monday, February 07, 2005 2:57 PM To: Jakarta Commons Developers List Subject: Spam: RE: Http Client- How to send and recieve Serialized Object using Http Client Assuming it's not just because of the typo in the content type (should be application/octet-stream), you could try base 64 encoding the object output stream, and then you can just use text/plain content type. On the other end you base 64 decode the response body before passing it to the object input stream. There are plenty of examples of how to do base 64 encode/decode on the web. Colin Sharples IBM Advisory IT Specialist Email: [EMAIL PROTECTED] -Original Message- From: Sanjeev Tripathi [mailto:[EMAIL PROTECTED] Sent: Tuesday, 8 February 2005 8:18 a.m. To: commons-dev@jakarta.apache.org Subject: Http Client- How to send and recieve Serialized Object using Http Client Hi, I am working on thick client proxy that will connect to servlet and retrive and save data to database. I am using Http Client for communication. I am able to send string values using parameter in request as follows. // ** NameValuePair userid = new NameValuePair(LOGIN_NAME, login); NameValuePair password = new NameValuePair(LOGIN_PASSWORD, password); NameValuePair thickClient = new NameValuePair(ThickClient, ThickClient); authpost.setRequestBody( new NameValuePair[] {action, url, userid, password,thickClient}); // ** I am able to send xml string as parameter and able to receive it back from response as String. But I am getting problem in serialized user defined objects communication. Following is not working //*In Servlet* if (request.getParameter(ThickClient).equals(ThickClient)) { response.setContentType(application/octel-stream); ObjectOutputStream oos = new ObjectOutputStream(response.getOutputStream()); oos.writeObject(new com.parago.communication.SubmissionVO(1,Controll Servlet)); oos.flush(); oos.close(); return; } In Thick Client Proxy * client.executeMethod(authpost); System.out.println(Login form post: + authpost.getStatusCode()); ObjectInputStream ois = new ObjectInputStream(authpost.getResponseBodyAsStream()); SubmissionVO vo = (SubmissionVO)ois.readObject(); System.out.println(id : +vo.getSubmissionId() +: desc: + vo.getDescription()); //**Here SubmissionVO is Serialized Object*** public class SubmissionVO implements java.io.Serializable{ public SubmissionVO(int id,String desc) { this.submissionId = id; this.description = desc; } private int submissionId; private String description; public int getSubmissionId () { return submissionId; } public String getDescription() { return description; } } //*** Please suggest me. How to send and receive Serialized User Defined Value Objects in using Http Client. Thanks. Sanjeev Tripathi __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]