I\'m writing a simple client in Java to allow reusable use of proprietary virus scanning software accessible through a RESTful API. To upload a file for scanning the API req
package zuulx;
import java.net.URI;
import java.net.URISyntaxException;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
public class CookieTest {
/**
*
* array(1) {
["aaa"]=>
string(2) "11"
}
* @param args
* @throws URISyntaxException
*/
public static void main(String[] args) throws URISyntaxException {
HttpHeaders headers = new HttpHeaders();
headers.add("Cookie", "aaa=11" );
RestTemplate restTemplate = new RestTemplate();
// URI url= new URI("http://localhost:9088/cktest");
// System.out.println( restTemplate.getForObject(url, String.class));
String url = "http://localhost/showck.php";
url="http://localhost:9088/cktest";
ResponseEntity response = restTemplate.exchange(url,
HttpMethod.GET,
new HttpEntity (headers) ,String.class);
System.out.println(response.getBody());
//http://localhost/showck.php
}
}