*) avoid reading of content body into memory

*) Bugfix for soap attachment support

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2854 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 18 years ago
parent 88cfdecd38
commit 4d1f933ea1

@ -85,6 +85,7 @@ import de.anomic.http.httpHeader;
import de.anomic.http.httpc; import de.anomic.http.httpc;
import de.anomic.http.httpdAbstractHandler; import de.anomic.http.httpdAbstractHandler;
import de.anomic.http.httpdHandler; import de.anomic.http.httpdHandler;
import de.anomic.plasma.plasmaParser;
import de.anomic.server.serverClassLoader; import de.anomic.server.serverClassLoader;
import de.anomic.server.serverCore; import de.anomic.server.serverCore;
import de.anomic.server.serverFileUtils; import de.anomic.server.serverFileUtils;
@ -196,13 +197,16 @@ public final class httpdSoapHandler extends httpdAbstractHandler implements http
*/ */
static { static {
// create an Axis server // create an Axis server
serverLog.logInfo("SOAP","Init soap engine ...");
engine = new AxisServer(); engine = new AxisServer();
// setting some options ... // setting some options ...
engine.setShouldSaveConfig(false); engine.setShouldSaveConfig(false);
serverLog.logInfo("SOAP","Deploying default services ...");
for (int i=0; i < defaultServices.length; i++) { for (int i=0; i < defaultServices.length; i++) {
String[] nextService = defaultServices[i].split("="); String[] nextService = defaultServices[i].split("=");
serverLog.logInfo("SOAP","Deploying service " + nextService[0] + ":" + nextService[1]);
String deploymentStr = serviceDeploymentString String deploymentStr = serviceDeploymentString
.replaceAll("@serviceName@", nextService[0]) .replaceAll("@serviceName@", nextService[0])
.replaceAll("@className@", nextService[1]); .replaceAll("@className@", nextService[1]);
@ -281,18 +285,6 @@ public final class httpdSoapHandler extends httpdAbstractHandler implements http
} }
} }
private byte[] readRequestBody(httpHeader requestHeader, PushbackInputStream body) throws SoapException {
try {
// getting an input stream to handle transfer encoding and content encoding properly
InputStream soapInput = getBodyInputStream(requestHeader, body);
// read the content
return serverFileUtils.read(soapInput);
} catch (IOException e) {
throw new SoapException(500,"Read error",e.getMessage());
}
}
private InputStream getBodyInputStream(httpHeader requestHeader, PushbackInputStream body) throws SoapException{ private InputStream getBodyInputStream(httpHeader requestHeader, PushbackInputStream body) throws SoapException{
InputStream input; InputStream input;
@ -446,16 +438,17 @@ public final class httpdSoapHandler extends httpdAbstractHandler implements http
* GENERATE REQUEST MESSAGE * GENERATE REQUEST MESSAGE
* ======================================================================== */ * ======================================================================== */
// read the request message // read the request message
byte[] buffer = readRequestBody(requestHeader, body); InputStream bodyStream = getBodyInputStream(requestHeader, body);
// generating the SOAP message context that will be passed over to the invoked service // generating the SOAP message context that will be passed over to the invoked service
MessageContext msgContext = this.generateMessageContext(path, requestHeader, conProp); MessageContext msgContext = this.generateMessageContext(path, requestHeader, conProp);
// Generating a SOAP Request Message Object // Generating a SOAP Request Message Object
String mime = plasmaParser.getRealMimeType(requestHeader.mime()); // this is important !!!!
Message requestMsg = new Message( Message requestMsg = new Message(
buffer, bodyStream,
false, false,
requestHeader.mime(), mime,
(String)requestHeader.get(httpHeader.CONTENT_LOCATION) (String)requestHeader.get(httpHeader.CONTENT_LOCATION)
); );
msgContext.setRequestMessage(requestMsg); msgContext.setRequestMessage(requestMsg);

Loading…
Cancel
Save