场景是从网络摄像头捕获图像并将图像存储到数据库中,我在客户端使用 flex,我在服务器端使用 Java,以下是我的 flex 代码
var jpg_binary:ByteArray = snap.getPixels(snap.rect);
var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
var request:URLRequest = new URLRequest("../saveProfileImage.htm");
var urlVars : URLVariables = new URLVariables();
request.requestHeaders.push(header);
request.method = URLRequestMethod.POST;
urlVars.image = jpg_binary;
urlVars.resourceId = FlexGlobals.topLevelApplication.parameters["id"];
urlVars.resourceName= FlexGlobals.topLevelApplication.parameters["type"];
request.data = urlVars;
var loader:URLLoader = new URLLoader();
trace ("sending pic to htm");
loader.load(request);
Alert.show("Uploaded Successfully");
现在我需要帮助来编写它的 java 部分,我的意思是如何从请求对象接收 byteArray。