commons-httpclient.jar的使用(Cookie的使用 )

Java SSRF漏洞深度解析:从原理到实战代码审计与防御 服务端请求伪造(SSRF)是一种常见的安全漏洞,其核心原理在于服务器对用户输入的URL或地址数据缺乏充分校验,导致攻击者能够诱使服务器向任意地址发起网络请求。这种漏洞之所以危险,是因为请求从受信任的服务器内部发出,可以绕过前端限制,直接攻击内网中本应被防火墙隔离的脆弱后端系统。在Java生态中,由于网络编程API丰富且历史包袱重,SSRF问题尤为突出,常通过`java.net.URL`、`HttpURLConnection`、Apache HttpClient等类库触发。其技术价值在于揭示了应用信任边界的重 阅读详情

package com.test;

import org.apache.commons.httpclient.Cookie;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.cookie.CookieSpec;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;

public class FormLoginDemo {
 static final String LOGON_STR = "localhost";
 static final int LOGON_PORT = 8080;
 
 public static void main(String[] args) throws Exception{
  HttpClient client = new HttpClient();
  
  client.getHostConfiguration().setHost(LOGON_STR, LOGON_PORT);
  
//   模拟登录页面login.jsp->main.jsp
  PostMethod post = new PostMethod("/a.jsp");
  NameValuePair name = new NameValuePair("name", "Id");
  NameValuePair pass = new NameValuePair("password" , "Id");
  
  post.setRequestBody(new NameValuePair[]{name, pass});
  
  int status = client.executeMethod(post);
  
  System.out.println(post.getResponseBodyAsString());
  post.releaseConnection();
  
  //查看cookie 信息
  CookieSpec cookiespec = CookiePolicy.getDefaultSpec();
  Cookie[] cookies = cookiespec.match(LOGON_STR, LOGON_PORT, "/", false, client.getState().getCookies());
  
  if (cookies.length == 0){
   System.out.println("none");
  }else{
   for (int i = 0; i< cookies.length; i++){
    System.out.println(cookies[i].toString());
   }
  }
  
  //访问所需的页面main2.jsp
  GetMethod get = new GetMethod("/b.jsp");
  client.executeMethod(get);
  System.out.println(get.getResponseBodyAsString());
  get.releaseConnection();
  
 }
}
 

HTTPClient 4.5:必备Jar包及源码解析 在当今的网络时代,HTTPClient作为一款广泛使用的网络通信客户端库,对于Web开发者而言可谓是不可或缺的工具。本章节将简要介绍HTTPClient的基础知识及其在应用开发中的重要性。HTTPClient是一个开源的Java HTTP客户端库,它提供了访问Web服务器的简易方式。通过它,开发者可以构建HTTP请求、发送请求并接收响应,这些操作都封装在易于理解和使用的API中。超文本传输协议(HTTP)是互联网上应用最为广泛的一种网络协议。 阅读详情

相关推荐

探索commons-httpclient-3.1.jar:Java HTTP客户端的强大工具

本文还有配套的精品资源,点击获取 简介: commons-httpclient-3.1.jar 是一个封装了Apache Commons HttpClient 3.1版本的Java库,为开发者提供了通过HTTP和HTTPS协议与Web服务器进行交互的客户端功能。本文将详细介绍这个库的主要特点、用途、关键组件以及如何使用它。尽管这个版本的库已不如以往那样流行,并...

weixin_34718952的博客 1993

commons-httpclient.jar的使用(处理页面重定向)

 package com.test;import java.io.IOException;import org.apache.commons.httpclient.Header;import org.apache.commons.httpclient.HttpClient;import org.apache.commons.httpclient.HttpMethod;import org.

liulecode的专栏 2262

commons-httpclient相关jar包

httpclient相关jar包,包括:commons-codec-1.4.jar commons-httpclient-3.0.1.jar commons-logging-1.1.1.jar

commons-httpclient.jar的使用

package com.test;import java.io.IOException;import org.apache.commons.httpclient.HttpClient;import org.apache.commons.httpclient.HttpException;import org.apache.commons.httpclient.HttpMethod;impor

liulecode的专栏 2940

commons--httpclient.jar

包含commons-codec-1.3、commons-httpclient、commons-logging-api-1.1三个jar文件。

commons-httpclient.jar

commons-httpclient.jar

Commons-httpclient cookie的操作

[code="java"]This tip shows how to use cookies. The application below sets an HTTP cookie and updates the cookie's value across multiple HTTP GET requests. /* * $Header: * $Revision$ * $Date...

邓胤的家当 610

OpenWRT软件源更换保姆级教程:从国内镜像到官方源一键切换(含常见报错解决)

本文提供OpenWRT软件源更换的详细教程,涵盖从国内镜像源到官方源的切换方法,并深度解析常见报错解决方案。针对国内网络环境,指导用户如何精准定位系统信息、备份配置、选择并配置清华等国内镜像源,以及处理签名验证失败、依赖缺失、404错误等典型问题,旨在提升软件包管理效率与稳定性。

weixin_29229261的博客 1942

java webclient jar_【commons-httpclient】Java中HttpClient工具访问Web请求

注意jar包是:HttpClient工具使用HttpClient 是 Apache Jakarta Common 下的子项目,可以用来提供高效的、最新的、功能丰富的支持 HTTP 协议的客户端编程工具包,并且它支持 HTTP 协议最新的版本和建议。为什么要使用HttpClient工具:原生态的Socket基于传输层,现在我们要访问的WebService是基于HTTP的属于应用层,所以我们的Sock...

weixin_33604071的博客 436

避坑指南:Qt无边框窗口拖动+阴影效果这些细节要注意

本文深入探讨了Qt无边框窗口开发中实现流畅拖动与阴影效果的关键细节与常见陷阱。针对高DPI屏幕适配、阴影闪烁、拖动卡顿及多显示器兼容性等核心难题,提供了从QGraphicsDropShadowEffect原理剖析到手动绘制优化、坐标系统精准处理及平台原生事件拦截的实战解决方案,帮助开发者构建稳定、美观的商业级应用界面。

weixin_27943395的博客 479

手把手教你用光耦搭建安全隔离电路:从洗衣机控制板到PLC输入模块实战

本文通过洗衣机控制板驱动高压电机和PLC输入模块采集现场信号两个实战场景,手把手教你使用光耦搭建安全隔离电路。文章详细解析了电路架构、关键器件选型、参数计算、仿真验证及PCB布局避坑技巧,并对比了光耦与数字隔离器的适用场景,帮助电子工程师掌握这门保障系统稳定与安全的必备技能。

h6j7k8l9p0的博客 463

通过HttpClient获取cookie

import org.apache.commons.httpclient.Cookie; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.cookie.

qq_36126348的博客 1196

西门子1200与FANUC机器人Profinet通讯

近期在做发那科FANUC的通讯,会吧CC-LINK、Profibus-DP、Profinet I/O、DeviceNet、EtherNet/IP这些常用通讯做成文档发上来,大家喜欢的话可以关注 注:做对应的通讯,在机器人控制柜都需要安装对应的板卡以及软件功能 PLC项目已经归档,只需要恢复就可以看到。对应Profinet通讯的GSD文件也都在博文最后有连接 机器人柜子:R-30IB Mate 机器人主体:M-10IA 12 一、硬件介绍 机器人Profinet I/O通讯板卡:...

七兔自习室 2万+

Android 使用自带的HttpClient进行https请求出现403的解决过程记录

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34319817的博客 1127

Vue3 - 最新实现在线预览Excel文件(xls/xlsx)多种方案,解析打开excel电子表格支持服务器链接在线URL形式、调用后端接口获取二进制文件流、文件地址(vue3实现excel预览)

vue3,预览excel文件,xlsx,xls,vue预览Excel表格,vue在线编辑xls文件,预览和编辑,vue3如何新开一页浏览器打开查看,手机h5页面打开在线EXCEL文档,在弹框中加载预览,在指定模态框中显示,基于Vue的Excel文件预览,加载失败白屏,报错没反应,详细示例代码教程,文件预览下载,nuxt3,excel预览插件,xlsx插件预览,纯前端vue中预览excel表格,接口调用的文件如何预览查看,文件url地址,vue移动端实现excel在线预览,vue移动端H5网页excel预览,

🏆 前端领域优质创作者 1万+

大模型部署指南:SGLang 框架

本文介绍使用 SGLang 框架部署大模型

举世誉之而不加劝,举世非之而不加沮,定乎内外之分,辩乎荣辱之境,斯已矣。 1616

使用HTTPCLIENT进行带参数跨域跳转

1. 首先在工程中加入commons-httpclient-3.0.jar 2. 应用方法实例: public ModelAndView dispatchPage(HttpServletRequest request, HttpServletResponse response) throws IOException, ClassNotFoundException{

johennes的专栏 3702

STM32F103待机模式原理与低功耗实战指南

待机模式是嵌入式系统实现超低功耗的核心机制,其本质是通过切断内核域电源(VDD/VDDA)实现微安级静态电流,区别于睡眠/停止模式的状态保持特性。原理上依赖电源域隔离、WKUP引脚事件唤醒与RTC备份域协同,技术价值在于支撑电池供电设备长达数年续航。典型应用场景包括物联网传感器节点、智能电表、便携医疗设备等对功耗极度敏感的终端。工程落地需严格遵循GPIO模拟输入配置、唤醒标志清除、备份域解锁等关键步骤,避免因漏电或误唤醒导致实测电流超标。本文以STM32F103为例,深入解析待机模式的硬件基础与HAL库实现

weixin_32999557的博客 66

工具篇:apache-httpClient 和 jdk11-HttpClient的使用

关注公众号,一起交流,微信搜一搜: 潜行前行 HttpClient (apache) apache HttpClient 是 java项目里 较为常用的组件之一;对接外部服务时,各个商家提供的接口是各式各样的,有自己的要求,因此要定制对应的请求客户端。httpClient是一个不错的选择 apache HttpClient 实现了 HTTP 1.0 和 HTTP 1.1。支持 HTTP 全部的方法(GET, POST, PUT, DELETE, HEAD, OPTIONS, and TRACE) GET

潜行前行的专栏 1341

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

HttpClient用法--这一篇全了解(内含例子)

HttpClient相比传统JDK自带的URLConnection,增加了易用性和灵活性,它不仅使客户端发送Http请求变得容易,而且也方便开发人员测试接口(基于Http协议的),提高了开发的效率,也方便提高代码的健壮性。因此熟练掌握HttpClient是很重要的必修内容,掌握HttpClient后,相信对于Http协议的了解会更加深入。 org.apache.commons.httpclient.HttpClient与org.apache.http.client.HttpClient的区别 Commons

qq_41933598的博客 311

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

httpclient用法大全

staticfinalintdefaultMaxPerRoute=Integer.valueOf(ProperUtil.get("corePoolSize")).intValue();staticfinalintmaxTotal=Integer.valueOf(ProperUtil.get("maxTotal")).intValue();HttpPosthttpPost=newHttpPost("http//www.baidu.com");//每个主机的最大并行链接数。...

安卓世界库 2479

Java HttpClient

Http协议的重要性相信不用我多说了,HttpClient相比传统JDK自带的URLConnection,增加了易用性和灵活性(具体区别,日后我们再讨论),它不仅是客户端发送Http请求变得容易,而且也方便了开发人员测试接口(基于Http协议的),即提高了开发的效率,也方便提高代码的健壮性。因此熟练掌握HttpClient是很重要的必修内容,掌握HttpClient后,相信对于Http协议的了解会...

lulitianyu的专栏 311

java apache commons HttpClient发送get和post请求的学习整理

版权声明:本文为博主原创文章,未经博主允许不得转载。 原创整理不易,转载请注明出处:java apache commons HttpClient发送get和post请求的学习整理 代码下载地址:http://www.zuidaima.com/share/1754065983409152.htm HttpClient 是我最近想研究的东西,以前想过的一些应用

u011244446的专栏 530

Cactus使用体验

第一部分一、文件夹内的内容cactus.jar: the main jar, contains the framework classes. You can find this jar in [cactus root]/lib. cactus-ant.jar: a jar which contains some custom Ant tasks to help integrate ea

kaukiyou的专栏 1732

工作中使用到的单词(软件开发)_第四版

本文汇总了2020-2025年间软件开发相关的工作笔记,主要包括三版技术词汇整理(2020-2025)、优快云文章导出PDF情况,以及2025年6月的专题整理。重点内容涉及:WebSphere中jackson包加载路径问题、Java异步线程类型(守护/非守护线程)的区分与解决方案、DB2数据库连接相关指令(db2listapplications等)、AWS托管服务优势,以及OSGi框架与Java的关系说明。特别标注了技术术语的英文发音(如initiative)和敏感信息处理注意事项(敏感度标签设置)。后续

sun0322 1346
上一篇: commons-httpclient.jar的使用(处理页面重定向)
下一篇: J2SE5新特性 可变长参数
liulecode
博客等级 码龄19年 0粉丝 3原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值