Mentions légales du service

Skip to content
Snippets Groups Projects
Commit c1594186 authored by Guillaume Thomazon's avatar Guillaume Thomazon
Browse files

Encode base 64 before send message to EVS

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/gazelle-proxy/trunk@36210 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent 58c9e565
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ import org.apache.commons.exec.PumpStreamHandler; ...@@ -36,6 +36,7 @@ import org.apache.commons.exec.PumpStreamHandler;
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.multipart.ByteArrayPartSource;
import org.apache.commons.httpclient.methods.multipart.FilePart; import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity; import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part; import org.apache.commons.httpclient.methods.multipart.Part;
...@@ -328,7 +329,13 @@ public class MessageBean { ...@@ -328,7 +329,13 @@ public class MessageBean {
// use the type as file name // use the type as file name
String messageType = message.getChannelType().name(); String messageType = message.getChannelType().name();
PartSource partSource = message.getPartSource(messageType); // encode byte before send it to EVS
byte[] bytes = message.getMessageReceived();
bytes = Base64.encodeBase64(bytes);
PartSource partSource = new ByteArrayPartSource(messageType, bytes);
// PartSource partSource = message.getPartSource(messageType);
Part[] parts = { new FilePart("message", partSource) }; Part[] parts = { new FilePart("message", partSource) };
filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams())); filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));
int status = -1; int status = -1;
...@@ -338,7 +345,7 @@ public class MessageBean { ...@@ -338,7 +345,7 @@ public class MessageBean {
status = -1; status = -1;
e.printStackTrace(); e.printStackTrace();
} }
log.info("proxyId : "+proxyId); log.info("proxyId : " + proxyId);
// redirect the user to the good page // redirect the user to the good page
if (status == HttpStatus.SC_OK) { if (status == HttpStatus.SC_OK) {
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment