springboot 1.X 实现 jersey

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import org.springframework.web.multipart.MultipartFile;
	public String doPutToFileServer(MultipartFile file, String url) {

		String fileName = file.getOriginalFilename();
		String uploadUrl = FileNameCreator.creatRandomName(url, fileName);
		Client client = new Client();
		WebResource webResource = client.resource(uploadUrl);
		try {
			byte[] buf = file.getBytes();
			webResource.put(String.class,buf);
			return uploadUrl;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

pom.xml


		
			com.sun.jersey
			jersey-client
			1.18.1
		

详细内容:看利用jersey 实现图片的上传

你可能感兴趣的:(springboot,jersey,springboot,jersey)