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

常见的网站推广途径岑溪网络推广营销

常见的网站推广途径,岑溪网络推广营销,网站建设与网页制作的实验目的,通州区网站建设公司2024年10月14日14:17:07—0.6.0 java-实现一个简单的httpserver-0.6.0 背景功能具体代码打印 背景 通常写了一些接口#xff0c;需要通过临时的http访问#xff0c;又不需要spring这么厚重的框架 功能 设置并发监控并发两个get请求一个是根路径#xff0c;一个是other增加… 2024年10月14日14:17:07—0.6.0 java-实现一个简单的httpserver-0.6.0 背景功能具体代码打印 背景 通常写了一些接口需要通过临时的http访问又不需要spring这么厚重的框架 功能 设置并发监控并发两个get请求一个是根路径一个是other增加了一个post请求的方法other1 具体代码 import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer;import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors;public class server {private static AtomicInteger concurrentConnections new AtomicInteger(0);public static void main(String[] args) throws IOException {HttpServer server HttpServer.create(new InetSocketAddress(localhost, 8222), 0);// 处理根路径get请求server.createContext(/, new RootHandler());// 处理 /other 路径get请求server.createContext(/other, new OtherHandler());// 处理 /other1 路径post请求server.createContext(/other1, new Other1Handler());// 设置并发连接数server.setExecutor(java.util.concurrent.Executors.newFixedThreadPool(10));server.start();System.out.println(Server started on port 8000.);// 定期打印当前并发连接数new Thread(() - {while (true) {try {Thread.sleep(5000);System.out.println(Current concurrent connections: concurrentConnections.get());} catch (InterruptedException e) {Thread.currentThread().interrupt();}}}).start();}static class RootHandler implements HttpHandler {Overridepublic void handle(HttpExchange exchange) throws IOException {concurrentConnections.incrementAndGet();if (GET.equals(exchange.getRequestMethod())) {String response Hello from root path!;exchange.sendResponseHeaders(200, response.length());OutputStream os exchange.getResponseBody();os.write(response.getBytes());os.close();// 监控连接释放事件System.out.println(root Connection released);}concurrentConnections.decrementAndGet();}}static class OtherHandler implements HttpHandler {Overridepublic void handle(HttpExchange exchange) throws IOException {concurrentConnections.incrementAndGet();if (GET.equals(exchange.getRequestMethod())) {String response This is a response for /other path.;exchange.sendResponseHeaders(200, response.length());OutputStream os exchange.getResponseBody();os.write(response.getBytes());os.close();}// 监控连接释放事件System.out.println(/other Connection released);concurrentConnections.decrementAndGet();}}static class Other1Handler implements HttpHandler {Overridepublic void handle(HttpExchange exchange) throws IOException {concurrentConnections.incrementAndGet();if (POST.equals(exchange.getRequestMethod())) {String response This is a response for /other1 post path.;exchange.sendResponseHeaders(200, response.length());OutputStream os exchange.getResponseBody();os.write(response.getBytes());os.close();}// 监控连接释放事件System.out.println(/other Connection released);concurrentConnections.decrementAndGet();}} } 打印 root Connection released Current concurrent connections: 0 /other Connection released root Connection released /other Connection released /other Connection released /other Connection released /other Connection released /other Connection released Current concurrent connections: 0 /other Connection released /other Connection released /other Connection released root Connection released Current concurrent connections: 0 Current concurrent connections: 0
http://www.sczhlp.com/news/257870/

相关文章:

  • 10-31 题
  • Maya 2025软件超详细下载安装教程(附安装包和激活步骤)
  • AI元人文构想:基于价值原语和三值纠缠的权衡
  • 枞阳网站制作seo关键词排名系统
  • 网站的服务器在哪里品牌网站都有哪些
  • 建站网站主题设置不能点wordpress自定义公共模板
  • 国家城乡住房和建设部网站wordpress academy
  • 静海的做网站个人简历模板空白表格
  • 如何免费建网站破解要钱网站
  • 国内优秀网站网页设计电子商务平台运营是做什么的
  • 网站开发公司招聘北京哪家网站建设公司比较好
  • 建设个人网站用到的技术手机制作网页链接的软件
  • 建设企业网站怎样收费福州火车站最新消息
  • 上海广告公司网站制作wordpress 点击放大
  • 朔州seo网站建设h5网站建设 案例
  • 有专门做礼品的网站吗知名建站企业哪家好
  • 如何编写网站后台jsp购物网站开发
  • 天津网站开发河间市做网站
  • 企业建设营销网站的基本步骤网站后台如何登录
  • 网站 板块 栏目学校建设网站拓扑图
  • 企业介绍微网站怎么做it外包公司什么意思
  • waP六感程序建设网站dw如何做商业网站
  • 黄页网页的推广网站下载网页定制
  • 网站做百度联盟收入已经很低了商城网站 备案
  • 网站建设价格标准案例seo排名优化推广
  • 重庆网站建设mlfartapp优化推广
  • 临沂在线上网站建设莱西市城乡建设局网站
  • 北京市网站公司网站wordpress图片集
  • 杭州seo 云优化科技沈阳网站优化哪家好
  • 注册网站英语怎么说滨州制作网站