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

网站什么时候备案指数运算法则

网站什么时候备案,指数运算法则,微商城怎么弄,php商务网站开发客服端以post请求输入xml的输入流#xff0c;来到服务器端#xff0c;服务器端接到输入流#xff0c;进行处理#xff0c;处理完毕后#xff0c;返回xml信息的返回输出流#xff0c;来告诉对方成功与否。 htppClient的使用至少需要commons-httpclient-3.1.jar#xff0c…  客服端以post请求输入xml的输入流来到服务器端服务器端接到输入流进行处理处理完毕后返回xml信息的返回输出流来告诉对方成功与否。 htppClient的使用至少需要commons-httpclient-3.1.jarcommons-logging-1.0.4.jarcommons-codec-1.3.jar三个Apache开源项目jar包的支持。jar的版本可以不同我用的是如上三个。   模拟客户端代码 package httpClientDemo;import java.io.File; import org.apache.commons.httpclient.HttpClient;import org.apache.commons.httpclient.NameValuePair;import org.apache.commons.httpclient.methods.FileRequestEntity;import org.apache.commons.httpclient.methods.PostMethod;import org.apache.commons.httpclient.methods.RequestEntity; public class HttpClientTest {   private static final String  LOGON_SITE localhost ;   private static final int     LOGON_PORT 8080;     SuppressWarnings(deprecation)  public static void main(String[] args) throws Exception {        File input new File(d:\\test.xml);        PostMethod post new PostMethod(/Mytest/servlet/abc.do);       NameValuePair name new NameValuePair( name , zhangjinping );       NameValuePair pass new NameValuePair( password , 123456 );        post.setRequestBody( new NameValuePair[]{name,pass});         HttpClient client new HttpClient();        client.getHostConfiguration().setHost(LOGON_SITE, LOGON_PORT);                                   RequestEntity entity new FileRequestEntity(input, text/xml; charsetutf-8);              //  post.setRequestHeader( Content-type , text/xml; charsetutf-8 );                post.setRequestEntity(entity);                try {                            int result client.executeMethod(post);                    System.out.println(Response status code: result);                    System.out.println(Response body: );                            System.out.println(post.getResponseBodyAsString());                         } finally {                             post.releaseConnection();                         }                     /*  // 设置请求的内容直接从文件中读取        post.setRequestBody( new FileInputStream(input));         if (input.length() Integer.MAX_VALUE)           post.setRequestContentLength(input.length());        else           post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED);         // 指定请求内容的类型                    int result client.executeMethod(post);        System.out.println( Response status code: result);        System.out.println( Response body: );        System.out.println(post.getRequestCharSet());        System.out.println(post.getResponseBodyAsString());         post.releaseConnection();      } */      } }     服务器端代码   package web; import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.PrintWriter;import java.util.List; import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse; import pojo.Student;import bo.CreateBD; import common.CreateXMLUtil; public class AjaxTestServlet extends HttpServlet {  /**  * Constructor of the object.  */ public AjaxTestServlet() {  super(); }  /**  * Destruction of the servlet. br  */ public void destroy() {  super.destroy(); // Just puts destroy string in log  // Put your code here }  /**  * The doGet method of the servlet. br  *  * This method is called when a form has its tag value method equals to get.  *   * param request the request send by the client to the server  * param response the response send by the server to the client  * throws ServletException if an error occurred  * throws IOException if an error occurred  */ public void doGet(HttpServletRequest request, HttpServletResponse response)   throws ServletException, IOException {           doPost(request, response); }  /**  * The doPost method of the servlet. br  *  * This method is called when a form has its tag value method equals to post.  *   * param request the request send by the client to the server  * param response the response send by the server to the client  * throws ServletException if an error occurred  * throws IOException if an error occurred  */ public void doPost(HttpServletRequest request, HttpServletResponse response)   throws ServletException, IOException {    System.out.println(.);  String str request.getParameter(testPost);  String name request.getParameter(name);  String password request.getParameter(password);  System.out.println(name  password);  SuppressWarnings(unused)  StringBuffer sb new StringBuffer();  InputStream is request.getInputStream();    InputStreamReader isr new InputStreamReader(is);  BufferedReader br new BufferedReader(isr);  while(true){        str br.readLine();        if(str!null)         sb.append(str);        if(strnull)         break;   }    System.out.println(sb.toString());    response.setContentType(application/xml); //application/xml代表的是XML形式返回   response.setHeader(Cache-Control, no-cache); //设置不缓存           ListStudent students CreateBD.getData();  //组织返回数据   String xmlCreateXMLUtil.getClassXML(students, students);   PrintWriter pwnull;   try {   //获取页面写入器   pwresponse.getWriter();   } catch (IOException e) {   e.printStackTrace();   }   pw.write(xml);   pw.flush();   pw.close();    }  /**  * Initialization of the servlet. br  *  * throws ServletException if an error occurs  */ public void init() throws ServletException {  // Put your code here } }         Apache官方httpClient 详解 http://hc.apache.org/httpclient-3.x/ Apache官方httpClient使用xmlPOST的举例代码http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/src/examples/转载于:https://www.cnblogs.com/alaricblog/p/3278275.html
http://www.yutouwan.com/news/8149/

相关文章:

  • 怎么提高网站加载速度建设网站的网络公司
  • 网站备案号在哪里看直播开放平台登录
  • Centos建网站必须域名网站推广指标
  • 怎么样让网站快速收录建设报名系统官网考试平台
  • 做电影下载网站还赚钱吗怎么免费制作网页
  • 一个企业网站如何能放到互联网上 vps微信有哪些不正经的公众号
  • 怎么找到网站后台外贸营销网站怎么建设
  • 珠海新盈科技 网站建设小程序商城图标素材
  • 合肥企业网站建设wordpress个人网站模板
  • 怎么指导电脑有么有安装wordpress佛山市seo广告优化工具
  • 做吃的教程网站正规seo排名公司
  • 有趣的网站小游戏百度排行榜风云
  • 做图网站大学生兼职个人求职简历模板免费下载
  • 南昌自助建站横沥镇网站仿做
  • 公司网站建设制作价格网站策划书的撰写流程
  • 最好的响应式网站app应用分发平台开发
  • 设计师一般放作品的网站网页制作与网站建设 论文
  • 美术主题资源网站建设湖南关键词优化快速
  • 如何查看网站跳出率wordpress照片exif
  • 网站建设浅析付费可见wordpress
  • 超链接到网站怎么做视频文件如何制作自己的微信小程序
  • 做菠菜网站代理软件开发专业就业
  • seo网站关键词优化多少钱如何自己制作图片
  • 网站空间 阿里云集团公司网页设计
  • 昆明智能建站网站排名代做
  • 绵阳网站设计公司国家建筑信息管理平台
  • 深圳网站建设制作公司排名新网站关键词怎么优化
  • 网站设置快捷方式到桌面郑州影视公司有哪些
  • pc端微信端网站建设pc端网页视频怎么下载
  • 国内网站做得好的公司国内wordpress有名主题