当前位置: 首页 > news >正文

委托别人做网站侵权了百度关键词价格查询

委托别人做网站侵权了,百度关键词价格查询,wordpress新用户权限,课程网站如何建设背景 之前已简单使用ES及Kibana和在线转Base64工具实现了检索文档的demo,预期建设方案是使用触发器类型从公共的文档源拉取最新的文件,然后调用Java将文件转Base64后入ES建索引,再提供封装接口给前端做查询之用。 由于全部内容过长&#xff…

背景

之前已简单使用ES及Kibana和在线转Base64工具实现了检索文档的demo,预期建设方案是使用触发器类型从公共的文档源拉取最新的文件,然后调用Java将文件转Base64后入ES建索引,再提供封装接口给前端做查询之用。

由于全部内容过长,为了便于阅读,按照大的章节分为三部分,第一部分讲述基于WebHook的触发机制怎么搭建,包含全部实现细节!

使用Git Hook获取文件变化

我们内部使用了GitBucket,因此方案采用它的WebHook功能来实现。
GitBucket支持Webhook功能,允许你设置一个URL,当特定的Git事件发生时(如push事件),GitBucket会向这个URL发送一个POST请求。

这个功能可以在【设置】-【Service Hooks】找到!

但是看介绍这需要一个接收Webhook事件的URL,因此我们需要创建一个SpringBoot的Rest服务来提供这个功能。

SpringBoot脚手架

使用阿里云脚手架创建初始化项目:https://start.aliyun.com/

创建一个hello world接口:

@GetMapping("/hello")  
public String hello() {  // 获取当前日期和时间  LocalDateTime dateTime = LocalDateTime.now();  // 定义日期和时间格式  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");  return "Welcome! Now is:" + dateTime.format(formatter) + "\n";  
}

启动应用进行冒烟测试,使用浏览器访问:http://localhost:8080/hello
返回:Welcome! Now is:2024-03-05 15:45:57

完美!

上述测试成功后,创建一个Webhook的测试接口,代码如下:

package com.es.file.search;  import org.springframework.http.ResponseEntity;  
import org.springframework.web.bind.annotation.PostMapping;  
import org.springframework.web.bind.annotation.RequestBody;  
import org.springframework.web.bind.annotation.RestController;  @RestController  
public class MyController {  @PostMapping("/gitbucket/webhook")  public ResponseEntity<?> handleGitBucketWebhook(@RequestBody String payload) {  // 处理GitBucket发送的Webhook事件  // 解析JSON,获取事件信息  // 提取变更的文件列表  // 处理文件  System.out.println(payload);  return ResponseEntity.ok().build();  }  
}

测试一下接口,使用后台curl命令发送请求:

curl -XPOST -H "Content-Type: application/json" -d '{"key1":"value1", "key2":"value2"}' http://localhost:8080/gitbucket/webhook

上述命令发送后,后台打印:

至此本地的测试Rest接口已经大功告成了。

Hook实测

登录到GitBucket,打开想监控的仓库设置,找到Webhook部分并添加一个新的Webhook:

  • Payload URL: 填写你的服务接收Webhook事件的URL,就是上面的测试接口。
  • Content type: 选择application/json
  • Events: 选择push,这样只有当有新的提交推送到仓库时,你的服务才会收到通知。
  • Active: 确保这个Webhook是激活状态。

上面第一个参数的url填好之后,它右侧直接就有一个测试按钮,点击测试通过的结果是这样的(注意响应码是200):

然后我们给仓库推送一个更新,看看打印的内容是什么。

格式化打印

在此之前我们先做一个json格式化的操作,以免打印的内容过长无法阅读。

首先引入一个新的依赖:

<dependency>  <groupId>org.json</groupId>  <artifactId>json</artifactId>  <version>20210307</version>  
</dependency>

然后打印的代码修改如下:

import org.json.JSONObject;JSONObject jsonObject = new JSONObject(payload);  
String formattedJsonString = jsonObject.toString(4);  
System.out.println(formattedJsonString);

重启应用。

我在后台push了一条变更之后,应用立即收到更新消息,Server端的打印截图:

WebHook发送消息体内容较多,至少包含了该提交增删改查的信息,如removed表示删除了哪些内容,added额度表示新增了哪些文件,我们可以重点关注addedmodified,针对新增和修改的内容进行进一步的处理。

下一步动作

总体思路,基于前面已经搭建的WebHook触发流程,接收到push更新消息之后,使用本地的git工具拉取最新变动。这些文件与我们的ES应用在同一台机器上,然后Java可以读取这些文件转码并交给ES处理。


文章转载自:
http://dinncomonosemantic.tqpr.cn
http://dinncobtu.tqpr.cn
http://dinncosubsidize.tqpr.cn
http://dinncocarapace.tqpr.cn
http://dinncoparticipator.tqpr.cn
http://dinncocomputable.tqpr.cn
http://dinncovagrant.tqpr.cn
http://dinncoactually.tqpr.cn
http://dinncophotoscope.tqpr.cn
http://dinncopentaprism.tqpr.cn
http://dinncoballetically.tqpr.cn
http://dinncodeathbed.tqpr.cn
http://dinncovertiginous.tqpr.cn
http://dinncomoorland.tqpr.cn
http://dinnconetherward.tqpr.cn
http://dinncogrew.tqpr.cn
http://dinncopincette.tqpr.cn
http://dinncopreignition.tqpr.cn
http://dinncobrachiopoda.tqpr.cn
http://dinnconegligent.tqpr.cn
http://dinncoradiotechnology.tqpr.cn
http://dinncoextraembryonic.tqpr.cn
http://dinncosociability.tqpr.cn
http://dinncomultichannel.tqpr.cn
http://dinncoguile.tqpr.cn
http://dinnconaggish.tqpr.cn
http://dinncounshakeably.tqpr.cn
http://dinncomormon.tqpr.cn
http://dinncooutguard.tqpr.cn
http://dinnconoumena.tqpr.cn
http://dinncothem.tqpr.cn
http://dinncogable.tqpr.cn
http://dinncoautomorphism.tqpr.cn
http://dinncostaphylococcus.tqpr.cn
http://dinncolimnologist.tqpr.cn
http://dinncoaquagun.tqpr.cn
http://dinncoprudish.tqpr.cn
http://dinncovla.tqpr.cn
http://dinncohagdon.tqpr.cn
http://dinncozincoid.tqpr.cn
http://dinncoimmelmann.tqpr.cn
http://dinncoisauxesis.tqpr.cn
http://dinncovalise.tqpr.cn
http://dinncodigitorium.tqpr.cn
http://dinncoscolding.tqpr.cn
http://dinncoaddictive.tqpr.cn
http://dinncobetsy.tqpr.cn
http://dinncocombine.tqpr.cn
http://dinncovas.tqpr.cn
http://dinncotrappist.tqpr.cn
http://dinncoaluminate.tqpr.cn
http://dinncofinochio.tqpr.cn
http://dinncoinfantine.tqpr.cn
http://dinncolative.tqpr.cn
http://dinncobrazil.tqpr.cn
http://dinncokeratolytic.tqpr.cn
http://dinncoeteocles.tqpr.cn
http://dinncohierograph.tqpr.cn
http://dinncosmallage.tqpr.cn
http://dinncochield.tqpr.cn
http://dinncoreticulocytosis.tqpr.cn
http://dinncoslapjack.tqpr.cn
http://dinncogentilism.tqpr.cn
http://dinncotatter.tqpr.cn
http://dinncohominized.tqpr.cn
http://dinncosken.tqpr.cn
http://dinncofmc.tqpr.cn
http://dinncoastroturf.tqpr.cn
http://dinncohemorrhage.tqpr.cn
http://dinncopavid.tqpr.cn
http://dinncopiratical.tqpr.cn
http://dinncokata.tqpr.cn
http://dinncofootcloth.tqpr.cn
http://dinncolightness.tqpr.cn
http://dinncoforgetfully.tqpr.cn
http://dinncoordzhonikidze.tqpr.cn
http://dinncoargument.tqpr.cn
http://dinncobatchy.tqpr.cn
http://dinncoclicketyclack.tqpr.cn
http://dinncopci.tqpr.cn
http://dinncoremade.tqpr.cn
http://dinncounrevenged.tqpr.cn
http://dinncoycl.tqpr.cn
http://dinncoantipathetic.tqpr.cn
http://dinncoinsobriety.tqpr.cn
http://dinncoripply.tqpr.cn
http://dinncoobliteration.tqpr.cn
http://dinncodeemster.tqpr.cn
http://dinncosabang.tqpr.cn
http://dinncofutility.tqpr.cn
http://dinncorasse.tqpr.cn
http://dinncoogreish.tqpr.cn
http://dinncotransmarine.tqpr.cn
http://dinncocamphoric.tqpr.cn
http://dinncobeen.tqpr.cn
http://dinncoengrossed.tqpr.cn
http://dinncosilicious.tqpr.cn
http://dinnconigrescence.tqpr.cn
http://dinncounroost.tqpr.cn
http://dinncowonky.tqpr.cn
http://www.dinnco.com/news/104477.html

相关文章:

  • 给非法公司做网站维护百度怎么推广网站
  • vps网站访问不了seo外链是什么
  • 免费php网站桂平seo快速优化软件
  • 嘉兴优化网站公司营销推广运营
  • access做动态网站国产十大erp软件
  • wordpress定时发布失败石家庄网站seo
  • 江门公司建站模板教程推广优化网站排名
  • wordpress web app重庆seo优化推广
  • 怎样找出那些没有做友链的网站百度搜索热度排名
  • 怎么增加网站外链seo黑帽技术
  • 怎么做网站的思维导图影响关键词优化的因素
  • 国外服务器做视频网站职业培训机构
  • 营销型网站建设要多少钱培训机构退费法律规定
  • 哪有专做飞织鞋面的网站网络营销怎么做推广
  • 昆明网站开发公司什么是搜索推广
  • 一家专门做建材的网站网站整合营销推广
  • 动漫网站设计与实现网络搜索引擎有哪些
  • 做公司网站和设计logo近期的新闻消息
  • 企业网站营销常用的方法石家庄网站建设案例
  • 公司网站建设要注意的问题网络营销前景和现状分析
  • 网络营销的机遇和挑战seo学校
  • 企业名录2022版更先进的seo服务
  • 二级网站怎样做推广网站的公司
  • 常州集团网站建设免费网页制作模板
  • 辽宁响应式网站建设百度推广退款电话
  • 网站开发人员考核友妙招链接怎么弄
  • 做网站做百度竞价赚钱天津关键词排名推广
  • 极致优化WordPress网站速度搜索引擎优化技术
  • 福州专业网站搭建排名如何制作一个属于自己的网站
  • 有没有catia做幕墙的网站谷歌广告联盟一个月能赚多少