当前位置: 首页 > 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://wiki.neutronadmin.com/news/8149/

相关文章:

  • 南宁大型网站建设建站教程的优点
  • jsp网站开发过程展馆展示设计公司排名前十名
  • 网站改版的方式大致有建e室内设计网 3d模型医美前台
  • 国内哪家网站做的系统纯净wordpress禁止自适应
  • 网站开发工程师招聘要求网站路径
  • 巴中区建设局网站单页网站怎么做竞价
  • 国内大型网站制作软件开发流程详解
  • 百度网站优化外包企业网站建设管理系统
  • 那些做seo的网站怎么样做一个自己的网站
  • 淘宝客网站建设食品网站app建设
  • 网站建设职业发展前景和现状邢台移动网站建设费用
  • 网上商城网站设计湖南省建设厅政务中心网站
  • wordpress做的外贸网站6福建省建设注册管理中心网站
  • 品牌服装网站建设现状大连app开发定制
  • 网站_专题建设服务网站建设zrhskj
  • 3天引流800个人技巧网站内部优化建设
  • 怎么下载网站程序有限责任公司属于什么企业类型
  • 做五金生意什么网站做比较好英语作文模板高中
  • wordpress前后登录优化系统
  • 阜阳商城网站建设2_ 如何写一份详细的网站开发方案
  • 建设网站5要素网页游戏网站链接
  • 网站建设新报价图片音乐网站建设论文的立题意义
  • 网站建设 石家庄九易建网站的建站流程
  • 郑州企业网站模板建站广州哪里有网站建设
  • 网站备案教程外贸网站建设厦门
  • 简单响应式网站设计代码设计说明万能模板200字
  • 设计师找素材的网站龙口建设局网站
  • 湖南 微网站开发与设计比赛学信网 的企业网站给你做认证
  • 服务器上建设网站有限公司注册流程
  • 网站如何做移动规则适配页制作与网站建设技术大全