[OLINGO-713] Minor fix in batch tutorial

This commit is contained in:
mibo 2016-11-16 20:19:46 +01:00
parent 69659a1a90
commit ecf9b9f9ba
2 changed files with 26 additions and 12 deletions

View File

@ -29,16 +29,30 @@
<name>${project.artifactId}-Webapp</name> <name>${project.artifactId}-Webapp</name>
<build>
<finalName>DemoService</finalName>
</build>
<properties> <properties>
<javax.version>2.5</javax.version> <javax.version>2.5</javax.version>
<odata.version>4.4.0-SNAPSHOT</odata.version> <odata.version>4.4.0-SNAPSHOT</odata.version>
<slf4j.version>1.7.7</slf4j.version> <slf4j.version>1.7.7</slf4j.version>
<project.source>1.6</project.source>
<compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<build>
<finalName>DemoService</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin.version}</version>
<configuration>
<source>${project.source}</source>
<target>${project.source}</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>

View File

@ -122,12 +122,12 @@ public class DemoBatchProcessor implements BatchProcessor {
responseParts.add(facade.handleBatchRequest(part)); responseParts.add(facade.handleBatchRequest(part));
} }
// 5. Serialize the response content // 5. Create a new boundary for the response
final InputStream responseContent = odata.createFixedFormatSerializer().batchResponse(responseParts, boundary);
// 6. Create a new boundary for the response
final String responseBoundary = "batch_" + UUID.randomUUID().toString(); final String responseBoundary = "batch_" + UUID.randomUUID().toString();
// 6. Serialize the response content
final InputStream responseContent = odata.createFixedFormatSerializer().batchResponse(responseParts, responseBoundary);
// 7. Setup response // 7. Setup response
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary);
response.setContent(responseContent); response.setContent(responseContent);