1、绕过ssl认证的工具类:

import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate; import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager; public final class SSLUtil { private static final TrustManager[] UNQUESTIONING_TRUST_MANAGER = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
return null;
} public void checkClientTrusted(X509Certificate[] certs, String authType)
{
} public void checkServerTrusted(X509Certificate[] certs, String authType)
{
}
} }; public static void turnOffSslChecking() throws NoSuchAlgorithmException, KeyManagementException
{
final SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, UNQUESTIONING_TRUST_MANAGER, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
} public static void turnOnSslChecking() throws KeyManagementException, NoSuchAlgorithmException
{
SSLContext.getInstance("SSL").init(null, null, null);
} private SSLUtil()
{
throw new UnsupportedOperationException("Do not instantiate libraries.");
}
}

2、直接测试类:

import java.io.File;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map; import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; public class AzkabanTest { private static final String API = "http://172.16.4.117:9091"; private static final String SESSION_ID = "6102b053-8720-4940-8baf-0bed38748821"; private static final String PROJECT = "test"; private static final String PROJECT_ID = "12"; private static final String SCHEDULE_ID = "13"; private static RestTemplate restTemplate = null; static
{
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
requestFactory.setReadTimeout(2000);
restTemplate = new RestTemplate(requestFactory);
} public static void main(String[] args) throws Exception
{
loginTest(); // 登录
// createProTest(); // 创建Project
// deleteProTest(); // 删除Project
// uploadZip(); // 上传zip
// scheduleEXEaFlowTest(); // 创建定时任务
// scheduleByCronEXEaFlowTest(); // 创建定时任务cron
// unscheduleFlowTest(); // 取消定时任务
} /**
* 登录测试 登录调度系统
*/
public static void loginTest() throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("action", "login");
linkedMultiValueMap.add("username", "azkaban");
linkedMultiValueMap.add("password", "azkaban"); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API, httpEntity, String.class);
System.out.println(postForObject);
} /**
* 创建任务测试 创建一个project
*/
public static void createProTest() throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("action", "create");
linkedMultiValueMap.add("name", PROJECT);
linkedMultiValueMap.add("description", "testproject"); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/manager", httpEntity, String.class);
System.out.println(postForObject);
} /**
* 删除任务测试 删除一个project
*/
public static void deleteProTest() throws Exception
{ SSLUtil.turnOffSslChecking(); HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
hs.add("Accept", "text/plain;charset=utf-8"); Map<String, String> map = new HashMap<>(); map.put("id", SESSION_ID);
map.put("project", PROJECT); ResponseEntity<String> exchange = restTemplate.exchange(API + "/manager?session.id={id}&delete=true&project={project}", HttpMethod.GET, new HttpEntity<String>(hs), String.class, map); System.out.println(exchange.getBody());
System.out.println(exchange.getStatusCode());
System.out.println(exchange.getStatusCodeValue());
} /**
* 上传zip 上传依赖文件 zip包
*/
public static void uploadZip() throws Exception
{
SSLUtil.turnOffSslChecking();
FileSystemResource resource = new FileSystemResource(new File("C:/Users/wuzy/Desktop/1.zip"));
LinkedMultiValueMap<String, Object> linkedMultiValueMap = new LinkedMultiValueMap<String, Object>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("ajax", "upload");
linkedMultiValueMap.add("project", PROJECT);
linkedMultiValueMap.add("file", resource);
String postForObject = restTemplate.postForObject(API + "/manager", linkedMultiValueMap, String.class);
System.out.println(postForObject);
} /**
* Schedule a period-based Flow 根据时间 创建调度任务
*/
public static void scheduleEXEaFlowTest() throws KeyManagementException, NoSuchAlgorithmException
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("ajax", "scheduleFlow");
linkedMultiValueMap.add("projectName", PROJECT);
linkedMultiValueMap.add("projectId", PROJECT_ID); linkedMultiValueMap.add("flow", "2");
// linkedMultiValueMap.add("scheduleTime", "10,28,am,EDT");
linkedMultiValueMap.add("scheduleTime", "15,08,pm,PDT");
linkedMultiValueMap.add("scheduleDate", "12/1/2017");
linkedMultiValueMap.add("flowName", "test01 description"); // 是否循环
linkedMultiValueMap.add("is_recurring", "on"); // 循环周期 天 年 月等
// M Months
// w Weeks
// d Days
// h Hours
// m Minutes
// s Seconds
linkedMultiValueMap.add("period", "30s"); // 经测试,定时任务支持至少是60秒或其整数倍 HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/schedule", httpEntity, String.class);
System.out.println(postForObject);
} /**
* Flexible scheduling using Cron 通过cron表达式调度执行 创建调度任务
*/
public static void scheduleByCronEXEaFlowTest() throws KeyManagementException, NoSuchAlgorithmException
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("ajax", "scheduleCronFlow");
linkedMultiValueMap.add("projectName", PROJECT);
linkedMultiValueMap.add("cronExpression", "* */1 * * * ?");
linkedMultiValueMap.add("flow", "中文");
linkedMultiValueMap.add("flowName", "dsaf"); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/schedule", httpEntity, String.class);
System.out.println(postForObject);
} /**
* Unschedule a Flow 取消一个流的调度
*/
public static void unscheduleFlowTest() throws KeyManagementException, NoSuchAlgorithmException
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
hs.add("X-Requested-With", "XMLHttpRequest");
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", SESSION_ID);
linkedMultiValueMap.add("action", "removeSched");
linkedMultiValueMap.add("scheduleId", SCHEDULE_ID); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String postForObject = restTemplate.postForObject(API + "/schedule", httpEntity, String.class);
System.out.println(postForObject);
} }

3、Spring Boot接口测试:

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate; @Configuration
public class AzkabanConfig { @Bean
public RestTemplate getRestTemplate()
{
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(2000);
requestFactory.setReadTimeout(2000);
RestTemplate restTemplate = new RestTemplate(requestFactory);
return restTemplate;
} }
import java.io.File;
import java.util.Date; public interface IAzkabanService { /**
* Azkaban登录接口,返回sessionId
* @author wuzy
* @date 2017年12月21日
* @return
* @throws Exception
*/
public String login() throws Exception; /**
* Azkaban创建project
* @author wuzy
* @date 2017年12月21日
* @param projectName project名称
* @param description project描述
* @throws Exception
*/
public void createProject(String projectName, String description) throws Exception; /**
* Azkaban删除project
* @author wuzy
* @date 2017年12月21日
* @param projectName project名称
* @throws Exception
*/
public void deleteProject(String projectName) throws Exception; /**
* Azkaban上传zip文件
* @author wuzy
* @date 2017年12月21日
* @param projectName
* @param file
* @return projectId
* @throws Exception
*/
public String uploadZip(String projectName, File file) throws Exception; /**
* 根据时间 创建调度任务
* @author wuzy
* @date 2017年12月21日
* @param projectId
* @param projectName
* @param flow
* @param flowName
* @param recurring 是否循环,on循环
* @param period 循环频率: M Months,w Weeks,d Days,h Hours,m Minutes,s Seconds;如60s,支持分钟的倍数
* @param date 开始时间
* @return 返回scheduleId
* @throws Exception
*/
public String scheduleEXEaFlow(String projectId, String projectName, String flow, String flowName, String recurring, String period, Date date) throws Exception; /**
* 根据cron表达式 创建调度任务
* @author wuzy
* @date 2017年12月21日
* @param projectName
* @param cron
* @param flow
* @param flowName
* @return 返回scheduleId
* @throws Exception
*/
public String scheduleByCronEXEaFlow(String projectName, String cron, String flow, String flowName) throws Exception; /**
* 根据scheduleId取消一个流的调度
* @author wuzy
* @date 2017年12月21日
* @param scheduleId
* @throws Exception
*/
public void unscheduleFlow(String scheduleId) throws Exception; /**
* 下载Azkaban压缩文件
* @author wuzy
* @date 2017年12月22日
* @param projectName
* @param zipPath
* @throws Exception
*/
public void downLoadZip(String projectName, String zipPath) throws Exception;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate; import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ueb.baseplatform.scheduling.common.Constant;
import com.ueb.baseplatform.scheduling.disconf.GlobalConfig;
import com.ueb.baseplatform.scheduling.service.IAzkabanService;
import com.ueb.baseplatform.scheduling.util.SSLUtil; @Service
public class AzkabanServiceImpl implements IAzkabanService { private static final Logger logger = LoggerFactory.getLogger(AzkabanServiceImpl.class); private static final String CONTENT_TYPE = "application/x-www-form-urlencoded; charset=utf-8"; private static final String X_REQUESTED_WITH = "XMLHttpRequest"; @Autowired
private RestTemplate restTemplate; @Autowired
private GlobalConfig globalConfig; @Override
public String login() throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("action", "login");
linkedMultiValueMap.add("username", globalConfig.getAzkUsername());
linkedMultiValueMap.add("password", globalConfig.getAzkPassword()); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl(), httpEntity, String.class); logger.info("--------Azkaban返回登录信息:" + result); return new Gson().fromJson(result, JsonObject.class).get("session.id").getAsString();
} @Override
public void createProject(String projectName, String description) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("action", "create");
linkedMultiValueMap.add("name", projectName);
linkedMultiValueMap.add("description", description); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/manager", httpEntity, String.class); logger.info("--------Azkaban返回创建Project信息:" + result); // 创建成功和已存在,都表示创建成功
if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()))
{
if (!"Project already exists.".equals(new Gson().fromJson(result, JsonObject.class).get("message").getAsString()))
{
throw new Exception("创建Azkaban Project失败");
}
}
} @Override
public void deleteProject(String projectName) throws Exception
{
SSLUtil.turnOffSslChecking(); HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
hs.add("Accept", "text/plain;charset=utf-8"); Map<String, String> map = new HashMap<>(); map.put("id", login());
map.put("project", projectName); ResponseEntity<String> exchange = restTemplate.exchange(globalConfig.getAzkUrl() + "/manager?session.id={id}&delete=true&project={project}", HttpMethod.GET, new HttpEntity<String>(hs),
String.class, map); logger.info("--------Azkaban返回删除Azkaban Project信息:" + exchange); if (HttpStatus.SC_OK != exchange.getStatusCodeValue())
{
throw new Exception("删除Azkaban Project失败");
}
} @Override
public String uploadZip(String projectName, File file) throws Exception
{
SSLUtil.turnOffSslChecking();
FileSystemResource resource = new FileSystemResource(file);
LinkedMultiValueMap<String, Object> linkedMultiValueMap = new LinkedMultiValueMap<String, Object>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("ajax", "upload");
linkedMultiValueMap.add("project", projectName);
linkedMultiValueMap.add("file", resource);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/manager", linkedMultiValueMap, String.class); logger.info("--------Azkaban返回上传文件信息:" + result); if (StringUtils.isEmpty(new Gson().fromJson(result, JsonObject.class).get("projectId").getAsString()))
{
throw new Exception("上传文件至Azkaban失败");
} return new Gson().fromJson(result, JsonObject.class).get("projectId").getAsString();
} @Override
public String scheduleEXEaFlow(String projectId, String projectName, String flow, String flowName, String recurring, String period, Date date) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("ajax", "scheduleFlow");
linkedMultiValueMap.add("projectName", projectName);
linkedMultiValueMap.add("projectId", projectId);
linkedMultiValueMap.add("flow", flow);
linkedMultiValueMap.add("flowName", flowName);
linkedMultiValueMap.add("is_recurring", recurring);
linkedMultiValueMap.add("period", period);
scheduleTimeInit(linkedMultiValueMap, date); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/schedule", httpEntity, String.class); logger.info("--------Azkaban返回根据时间创建定时任务信息:" + result); if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()) || new Gson().fromJson(result, JsonObject.class).get("scheduleId").getAsInt() < 0)
{
throw new Exception("根据时间创建定时任务失败");
} return new Gson().fromJson(result, JsonObject.class).get("scheduleId").getAsString();
} private void scheduleTimeInit(LinkedMultiValueMap<String, String> linkedMultiValueMap, Date date)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Integer year = calendar.get(Calendar.YEAR);
Integer month = calendar.get(Calendar.MONTH) + 1;
Integer day = calendar.get(Calendar.DATE);
Integer hour = calendar.get(Calendar.HOUR_OF_DAY);
Integer minute = calendar.get(Calendar.MINUTE); linkedMultiValueMap.add("scheduleTime", hour + "," + minute + (hour > 11 ? ",pm,PDT" : ",am,EDT"));
linkedMultiValueMap.add("scheduleDate", month + "/" + day + "/" + year);
} @Override
public String scheduleByCronEXEaFlow(String projectName, String cron, String flow, String flowName) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("ajax", "scheduleCronFlow");
linkedMultiValueMap.add("projectName", projectName);
linkedMultiValueMap.add("cronExpression", cron);
linkedMultiValueMap.add("flow", flow);
linkedMultiValueMap.add("flowName", flowName); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/schedule", httpEntity, String.class); logger.info("--------Azkaban返回根据cron表达式创建定时任务信息:" + result); if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()))
{
throw new Exception("根据cron表达式创建定时任务失败");
} return new Gson().fromJson(result, JsonObject.class).get("scheduleId").getAsString();
} @Override
public void unscheduleFlow(String scheduleId) throws Exception
{
SSLUtil.turnOffSslChecking();
HttpHeaders hs = new HttpHeaders();
hs.add("Content-Type", CONTENT_TYPE);
hs.add("X-Requested-With", X_REQUESTED_WITH);
LinkedMultiValueMap<String, String> linkedMultiValueMap = new LinkedMultiValueMap<String, String>();
linkedMultiValueMap.add("session.id", login());
linkedMultiValueMap.add("action", "removeSched");
linkedMultiValueMap.add("scheduleId", scheduleId); HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(linkedMultiValueMap, hs);
String result = restTemplate.postForObject(globalConfig.getAzkUrl() + "/schedule", httpEntity, String.class); logger.info("--------Azkaban返回取消流调度信息:" + result); if (!Constant.AZK_SUCCESS.equals(new Gson().fromJson(result, JsonObject.class).get("status").getAsString()))
{
throw new Exception("根据cron表达式创建定时任务失败");
}
} @Override
public void downLoadZip(String projectName, String zipPath)
{
OutputStream output = null;
BufferedOutputStream bufferedOutput = null; try
{
URL url = new URL(globalConfig.getAzkUrl() + "/manager?session.id=" + login() + "&download=true&project=" + projectName);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(3 * 1000);
InputStream inputStream = conn.getInputStream();
File file = new File(zipPath);
output = new FileOutputStream(file);
bufferedOutput = new BufferedOutputStream(output);
bufferedOutput.write(IOUtils.toByteArray(inputStream));
}
catch (Exception e)
{
logger.info("--------下载Azkaban压缩文件异常:" + e.getMessage(), e);
}
finally
{
if (bufferedOutput != null)
{
try
{
bufferedOutput.flush();
bufferedOutput.close();
}
catch (IOException e)
{
logger.info("关闭流异常:" + e.getMessage(), e);
}
} if (output != null)
{
try
{
output.close();
}
catch (IOException e)
{
logger.info("关闭流异常:" + e.getMessage(), e);
}
}
} } }

PS:Azkaban Github API:http://azkaban.github.io/azkaban/docs/latest/#ajax-api

Java调用Azkaban的RestFul接口的更多相关文章

  1. java调用webservice,restful

    java调用webservice public String redoEsb(String loguid, String user, String comments, String newMsg, S ...

  2. Java 调用 Hbase API 访问接口实现方案

    HBase是一个分布式的.面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”.就像Bigtable利用了Google文件 ...

  3. java调用.net的webservice接口

    要调用webservice,首先得有接口,用已经写好的接口地址在myEclipse的目标project中,右键->new web service client-> 选择JAX-WS方式,点 ...

  4. java 调用wsdl的webservice接口 两种调用方式

    关于wsdl接口对于我来说是比较头疼的 基本没搞过.一脸懵 就在网上搜 看着写的都很好到我这就不好使了,非常蓝瘦.谨以此随笔纪念我这半个月踩过的坑... 背景:短短两周除了普通开发外我就接到了两个we ...

  5. Java调用solrj5.5.3接口,查询数据

    前期准备 搭建solr服务 参考上一篇,搭建solr搜索服务. 添加依赖 maven工程的话,添加如下依赖, <!-- https://mvnrepository.com/artifact/or ...

  6. POST形式 soapUI调用WebService的restful接口,传入json参数,并且返回json

    第一次使用POST形式传JSON字符串,怎么都调不到后台方法,只是因为注解没加对…… CXF的WebService接口类 package com.zit.webservice.main; import ...

  7. java 调用短信 api 接口发送短信

    参考:   https://blog.csdn.net/u014793522/article/details/59062014 参考 :https://blog.csdn.net/Lu_shilusi ...

  8. Java 调用 php接口(Ajax)(二)

    由于项目里面需要用到Java调用PHP的充值接口,所以学习了一下,以下这个Demo是个小小的例子,写下来做个笔记> jsp页面: <%@ page language="java& ...

  9. post 中文数据到elasticsearch restful接口报json_parse_exception 问题

    我们的客户端程序直接调用es 的restful接口, 通过post json数据去查询, 但post数据有中文的时候,有些中文会报异常,有些中文不会 {"error":{" ...

随机推荐

  1. Portrait Photography Beginners Guide

    Please visit photoandtips稻糠亩 for more information. 六级/考研单词: vogue, derive, gorgeous, thereby, strict ...

  2. day06 目录结构

    day06 目录结构 文件目录 /bin # 存放系统常用命令的目录 /boot # 系统引导程序+内核 /dev # 设备.光驱.硬盘 /etc # 存放系统或服务的配置文件 /home # 普通用 ...

  3. JTable 单元格合并 【转】

    单元格合并 一.单元格合并.(1)我们可以使用Jtable的三个方法:getCellRect(),columnAtPoint(),and rowAtPoint().第一个方法返回一个单元格的边界(Re ...

  4. Qt——error之undefined reference to `vtable for classname

    可能原因:自定义类中使用自定义槽和信号,但是没有在类中增加Q_OBJECT, 解决办法:在类中增加Q_OBJECT,删除编译产生的文件进行重新编译 具体原因分析如下 博主原文

  5. oracle 根据ids转names

     WITH t AS (SELECT '1,2,3,4' a, 1 b    FROM Dual  UNION ALL  SELECT '1,2,3' a, 2 b FROM Dual),p AS ( ...

  6. HongYun项目启动

    一个前后端分离项目的启动顺序: 数据库启动, stams 后台springboot启动 中间路由启动,比如nginx,如果有的话:有这一层,后台可以设置负载均衡,可以动态部署 前端启动

  7. maven常用命令(待补充)

    1.mvn clean 删除已经编译好的信息 2.mvn compile 编译src/main/java目录下的.java文件 3.mvn test 编译src/main/java和src/test/ ...

  8. 【JS】枚举类型

    https://zhuanlan.zhihu.com/p/79137838 相当于用数字来代替一串字母 /** * 时间:2019年8月18日 * 前端教程: https://www.pipipi.n ...

  9. 【JAVA今法修真】 第一章 今法有万象 百家欲争鸣

    大家好,我是南橘,因为这段时间很忙,忙着家里的事情,忙着工作的事情,忙着考试的事情,很多时候没有那么多经历去写新的东西,同时,也是看了网上一些比较新颖的文章输出方式,自己也就在想,我是不是也可以这样写 ...

  10. pthread_cond_signal与pthread_cond_wait详解

    转:http://blog.chinaunix.net/uid-11572501-id-3456343.html //pthread_cond_signal 只发信号,内部不会解锁,在Linux 线程 ...