[英]Httpclient in java without using any third party libraries
I trying to automate few things in my workplace where we are not allowed to use internet (Not all website very few allowed). 我试图在不允许使用互联网的工作场所中自动化一些操作(并非所有网站都很少使用)。
Req: I have a form which has a single text box & a single submit button, I have to put something in the text box and submit the form. 要求:我有一个包含单个文本框和一个提交按钮的表单,我必须在文本框中放入一些内容并提交表单。 The response I need to parse the HTML and get a specific text.
我需要解析HTML并获取特定文本的响应。 The pages are written in JSP
这些页面是用JSP编写的
Constraint: I don't have access to third party libraries & have to work with Java 6. 约束:我无权访问第三方库并且必须使用Java 6。
Please put me in right direction. 请把我朝正确的方向。
HttpURLConnection comes default with java. HttpURLConnection是Java的默认值。 You may consider using this API.
您可以考虑使用此API。 This API does most of the functionality as Apache HTTPClient.
该API像Apache HTTPClient一样执行大多数功能。 Here is simple example on how to use HTTPURLConnection .
这是有关如何使用HTTPURLConnection的简单示例 。
我将使用来自Firefox的tamperdata之类的内容来捕获发送到服务器的HTTP请求,然后使用HTTPUrlConnection(JDK的一部分)重新创建该请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.