Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.wnameless.spring</groupId>
<artifactId>spring-bulk-api</artifactId>
<version>0.7.1-SNAPSHOT</version>
<version>0.7.4.1-SNAPSHOT</version>

<name>spring-bulk-api</name>
<description>Add bulk operations support to any Spring RESTful API by a single annotation @EnableBulkApi.</description>
Expand Down Expand Up @@ -109,6 +109,19 @@
<artifactId>gson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -60,6 +61,7 @@ private BulkApiService bulkApiService() {
* @throws BulkApiException
* if this bulk request is invalid
*/
@CrossOrigin("*")
@RequestMapping(value = "${spring.bulk.api.path:/bulk}", method = POST)
BulkResponse bulk(@RequestBody BulkRequest req, HttpServletRequest servReq) {
return bulkApiService().bulk(req, servReq);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public final class BulkOperation {
private Map<String, Object> params = new LinkedHashMap<String, Object>();
private Map<String, String> headers = new LinkedHashMap<String, String>();
private boolean silent = false;
private String payload;

/**
* Returns the URL of this RESTful operation.
Expand Down Expand Up @@ -128,6 +129,26 @@ public void setSilent(boolean silent) {
this.silent = silent;
}

/**
* Returns payload which client put in request without any change
* In addition to using the order of results, client can put a string or number to distinguish between returned results.
*
* @return payload of a RESTful operation
*/
public String getPayload() {
return payload;
}

/**
* Sets the payload parameters of this RESTful operation.
*
* @param payload
* an arbitrary string
*/
public void setPayload(String payload) {
this.payload = payload;
}

@Override
public int hashCode() {
int result = 27;
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/github/wnameless/spring/bulkapi/BulkResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package com.github.wnameless.spring.bulkapi;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.Map;

/**
Expand All @@ -29,6 +30,8 @@ public final class BulkResult {
private int status;
private String body;
private Map<String, String> headers;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String payload;

/**
* Returns the HTTP status code of a RESTful operation outcome.
Expand Down Expand Up @@ -87,6 +90,26 @@ public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}

/**
* Returns payload which client put in request without any change
* Client can put a string or number to distinguish between returned results
*
* @return payload of a RESTful operation
*/
public String getPayload() {
return payload;
}

/**
* Sets the payload parameters of this RESTful operation.
*
* @param payload
* an arbitrary string
*/
public void setPayload(String payload) {
this.payload = payload;
}

@Override
public int hashCode() {
int result = 27;
Expand Down
Loading