本文整理了Java中com.qiniu.http.Response.isOK
方法的一些代码示例,展示了Response.isOK
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.isOK
方法的具体详情如下:
包路径:com.qiniu.http.Response
类名称:Response
方法名:isOK
暂无
代码示例来源:origin: qiniu/java-sdk
public void deleteBucket(String bucketname) throws QiniuException {
String url = String.format("%s/drop/%s", configuration.rsHost(), bucketname);
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: yzcheng90/X-SpringBoot
@Override
public String upload(byte[] data, String path) {
try {
Response res = uploadManager.put(data, path, token);
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
}
} catch (Exception e) {
throw new RRException("上传文件失败,请核对七牛配置信息", e);
}
return config.getQiniuDomain() + "/" + path;
}
代码示例来源:origin: com.qiniu/qiniu-java-sdk
public void deleteBucket(String bucketname) throws QiniuException {
String url = String.format("%s/drop/%s", configuration.rsHost(), bucketname);
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: yjjdick/sdb-mall
@Override
public String upload(byte[] data, String path) {
try {
Response res = uploadManager.put(data, path, token);
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
}
} catch (Exception e) {
throw new RRException("上传文件失败,请核对七牛配置信息", e);
}
return config.getQiniuDomain() + "/" + path;
}
代码示例来源:origin: muyinchen/migo-security
@Override
public String upload(byte[] data, String path) {
try {
Response res = uploadManager.put(data, path, token);
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
}
} catch (Exception e) {
throw new RRException("上传文件失败,请核对七牛配置信息", e);
}
return config.getQiniuDomain() + "/" + path;
}
代码示例来源:origin: zhaoqicheng/renren-fast
@Override
public String upload(byte[] data, String path) {
try {
Response res = uploadManager.put(data, path, token);
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
}
} catch (Exception e) {
throw new RRException("上传文件失败,请核对七牛配置信息", e);
}
return config.getQiniuDomain() + "/" + path;
}
代码示例来源:origin: qiniu/java-sdk
public void createBucket(String bucketName, String region) throws QiniuException {
String url = String.format("%s/mkbucketv2/%s/region/%s", configuration.rsHost(),
UrlSafeBase64.encodeToString(bucketName), region);
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: com.qiniu/qiniu-java-sdk
public void createBucket(String bucketName, String region) throws QiniuException {
String url = String.format("%s/mkbucketv2/%s/region/%s", configuration.rsHost(),
UrlSafeBase64.encodeToString(bucketName), region);
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: qiniu/java-sdk
public void setBucketAcl(String bucket, AclType acl) throws QiniuException {
String url = String.format("%s/private?bucket=%s&private=%s", configuration.ucHost(), bucket, acl.getType());
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: qiniu/java-sdk
public BucketInfo getBucketInfo(String bucket) throws QiniuException {
String url = String.format("%s/v2/bucketInfo?bucket=%s", configuration.ucHost(), bucket);
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
BucketInfo info = res.jsonToObject(BucketInfo.class);
res.close();
return info;
}
代码示例来源:origin: qiniu/java-sdk
public void setIndexPage(String bucket, IndexPageType type) throws QiniuException {
String url = String.format("%s/noIndexPage?bucket=%s&noIndexPage=%s",
configuration.ucHost(), bucket, type.getType());
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: com.qiniu/qiniu-java-sdk
public void setBucketAcl(String bucket, AclType acl) throws QiniuException {
String url = String.format("%s/private?bucket=%s&private=%s", configuration.ucHost(), bucket, acl.getType());
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: com.qiniu/qiniu-java-sdk
public BucketInfo getBucketInfo(String bucket) throws QiniuException {
String url = String.format("%s/v2/bucketInfo?bucket=%s", configuration.ucHost(), bucket);
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
BucketInfo info = res.jsonToObject(BucketInfo.class);
res.close();
return info;
}
代码示例来源:origin: com.qiniu/qiniu-java-sdk
public void setIndexPage(String bucket, IndexPageType type) throws QiniuException {
String url = String.format("%s/noIndexPage?bucket=%s&noIndexPage=%s",
configuration.ucHost(), bucket, type.getType());
Response res = post(url, null);
if (!res.isOK()) {
throw new QiniuException(res);
}
res.close();
}
代码示例来源:origin: qiniu/java-sdk
public FileListing listFiles(String bucket, String prefix, String marker, int limit, String delimiter)
throws QiniuException {
Response response = listV1(bucket, prefix, marker, limit, delimiter);
if (!response.isOK()) {
throw new QiniuException(response);
}
FileListing fileListing = response.jsonToObject(FileListing.class);
response.close();
return fileListing;
}
代码示例来源:origin: com.qiniu/qiniu-java-sdk
public FileListing listFiles(String bucket, String prefix, String marker, int limit, String delimiter)
throws QiniuException {
Response response = listV1(bucket, prefix, marker, limit, delimiter);
if (!response.isOK()) {
throw new QiniuException(response);
}
FileListing fileListing = response.jsonToObject(FileListing.class);
response.close();
return fileListing;
}
代码示例来源:origin: hexiangtao/wechat4j
public String uploadToQiniu(InputStream is, String fileName) {
try {
String host = Constant.configReader.get(Constant.QIUNIU_IMG_URL);
String fileKey = generateFileKey(fileName);
Auth auth = Auth.create(ak, secret);
String uploadToken = auth.uploadToken(bucket);
byte[] buffer = new byte[is.available()];
IOUtils.readFully(is, buffer);
Response response = uploadManager.put(buffer, fileKey, uploadToken);
return response.isOK() ? host + fileKey : "";
} catch (Exception ex) {
return "";
}
}
代码示例来源:origin: vakinge/jeesuite-libs
/**
* 处理上传结果,返回文件url
*
* @return
* @throws QiniuException
*/
private String processUploadResponse(Response res) throws QiniuException {
if (res.isOK()) {
UploadResult ret = res.jsonToObject(UploadResult.class);
return getFullPath(ret.key);
}
throw new FSOperErrorException(name(), res.toString());
}
代码示例来源:origin: wucao/java-cloud-storage-service
@Override
public void upload(byte[] data, String path) throws Exception {
Auth auth = Auth.create(qiniuConfig.getAccessKey(), qiniuConfig.getSecretKey());
UploadManager uploadManager = new UploadManager();
Response res = uploadManager.put(data, path, auth.uploadToken(qiniuConfig.getBucket()));
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
}
}
代码示例来源:origin: souyunku/Picture-Bed
public String upload(byte[] data, String path) throws Exception {
try {
uploadManager = new UploadManager(new Configuration(Zone.autoZone()));
token = Auth.create(cloudStorageConfigPo.getQiniuAccessKey(), cloudStorageConfigPo.getQiniuSecretKey()).uploadToken(cloudStorageConfigPo.getQiniuBucketName());
Response res = uploadManager.put(data, path, token);
if (!res.isOK()) {
throw new RuntimeException("上传七牛出错:" + res.toString());
}
} catch (Exception e) {
throw new RuntimeException("上传文件失败,请核对七牛配置信息", e);
}
return cloudStorageConfigPo.getQiniuDomain() + "/" + path;
}
内容来源于网络,如有侵权,请联系作者删除!