Esempio n. 1
0
 private Response handleHttpRequest(HttpRequestBase httpRequestBase) throws IOException {
   HttpParams httpParams = new BasicHttpParams();
   HttpConnectionParams.setConnectionTimeout(httpParams, timeout);
   HttpConnectionParams.setSoTimeout(httpParams, timeout);
   HttpClient httpClient = new DefaultHttpClient(httpParams);
   byte[] content = null;
   String charset;
   HttpResponse httpResponse;
   Header cookie;
   try {
     httpResponse = httpClient.execute(httpRequestBase);
     cookie = httpResponse.getLastHeader("Set-Cookie");
     //			Log.d("remote", "cookie: " + cookie);
     HttpEntity httpEntity = httpResponse.getEntity();
     if (httpEntity != null) {
       ByteArrayOutputStream bos = new ByteArrayOutputStream();
       InputStream is = httpEntity.getContent();
       IoUtil.ioAndClose(is, bos);
       content = bos.toByteArray();
     }
     charset = EntityUtils.getContentCharSet(httpEntity);
   } finally {
     try {
       httpClient.getConnectionManager().shutdown();
     } catch (Exception ignore) {
       // ignore it
     }
   }
   return responseParser.parse(content, charset, parseSessionId(cookie));
 }
  public void loginUGotFile() throws Exception {

    loginsuccessful = false;
    HttpParams params = new BasicHttpParams();
    params.setParameter(
        "http.useragent",
        "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
    DefaultHttpClient httpclient = new DefaultHttpClient(params);

    NULogger.getLogger().info("Trying to log in to ugotfile.com");
    HttpPost httppost = new HttpPost("http://ugotfile.com/user/login");
    httppost.setHeader("Cookie", phpsessioncookie);
    List<NameValuePair> formparams = new ArrayList<NameValuePair>();
    formparams.add(new BasicNameValuePair("ugfLoginUserName", getUsername()));
    formparams.add(new BasicNameValuePair("ugfLoginPassword", getPassword()));
    UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
    httppost.setEntity(entity);
    HttpResponse httpresponse = httpclient.execute(httppost);
    if (httpresponse.getStatusLine().toString().contains("302")) {
      tmp = httpresponse.getLastHeader("Location").getValue();
      NULogger.getLogger().info("UGotFile Login success");
      loginsuccessful = true;
      username = getUsername();
      password = getPassword();
    } else {
      NULogger.getLogger().info("UGotFile login failed");
      loginsuccessful = false;
      username = "";
      password = "";
      showWarningMessage(Translation.T().loginerror(), HOSTNAME);
      accountUIShow().setVisible(true);
    }
  }
Esempio n. 3
0
 /**
  * 从响应中获取body信息
  *
  * @param res
  * @return String
  */
 @SuppressWarnings("deprecation")
 private String getResBody(HttpResponse res) {
   String strResult = "";
   if (res == null) return strResult;
   if (res.getStatusLine().getStatusCode() == 200) {
     try {
       strResult = strResult + EntityUtils.toString(res.getEntity(), charset);
     } catch (ParseException e) {
       log.error("获取body信息异常450:");
       log.error(e.getMessage());
       strResult = e.getMessage().toString();
     } catch (IOException e) {
       log.error("获取body信息异常454:");
       log.error(e.getMessage());
       strResult = e.getMessage().toString();
     }
   } else if (res.getStatusLine().getStatusCode() == 302) {
     String url = res.getLastHeader("Location").getValue();
     res.setStatusCode(200);
     strResult = url;
     return strResult;
   } else {
     strResult = "Error Response:" + res.getStatusLine().toString();
     if (res.getEntity() != null) {
       try {
         res.getEntity().consumeContent();
       } catch (IOException e) {
         log.error("获取body信息异常469:");
         log.error(e.getMessage());
       }
     }
   }
   return strResult;
 }
Esempio n. 4
0
  @Override
  public void login() {
    loginsuccessful = false;
    try {
      initialize();

      NULogger.getLogger().info("Trying to log in to FileParadox.in");
      httpPost = new NUHttpPost("http://fileparadox.in");

      List<NameValuePair> formparams = new ArrayList<NameValuePair>();
      formparams.add(new BasicNameValuePair("op", "login"));
      formparams.add(new BasicNameValuePair("login", getUsername()));
      formparams.add(new BasicNameValuePair("password", getPassword()));

      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
      httpPost.setEntity(entity);
      httpResponse = httpclient.execute(httpPost, httpContext);
      NULogger.getLogger().info(httpResponse.getStatusLine().toString());
      Header lastHeader = httpResponse.getLastHeader("Location");

      if (lastHeader != null && lastHeader.getValue().contains("op=upload_form")) {
        EntityUtils.consume(httpResponse.getEntity());
        loginsuccessful = true;
        username = getUsername();
        password = getPassword();
        NULogger.getLogger().info("FileParadox.in login successful!");

      } else {
        // Get error message
        responseString = EntityUtils.toString(httpResponse.getEntity());
        // FileUtils.saveInFile("FileParadoxAccount.html", responseString);
        Document doc = Jsoup.parse(responseString);
        String error = doc.select(".err").first().text();

        if ("Incorrect Login or Password".equals(error)) {
          throw new NUInvalidLoginException(getUsername(), HOSTNAME);
        }

        // Generic exception
        throw new Exception("Login error: " + error);
      }
    } catch (NUException ex) {
      resetLogin();
      ex.printError();
      AccountsManager.getInstance().setVisible(true);
    } catch (Exception e) {
      resetLogin();
      NULogger.getLogger().log(Level.SEVERE, "{0}: {1}", new Object[] {getClass().getName(), e});
      JOptionPane.showMessageDialog(
          NeembuuUploader.getInstance(),
          "<html>" + TranslationProvider.get("neembuuuploader.accounts.loginerror") + "</html>",
          HOSTNAME,
          JOptionPane.WARNING_MESSAGE);
      AccountsManager.getInstance().setVisible(true);
    }
  }
  @Override
  public void login() {
    loginsuccessful = false;
    try {
      initialize();

      NULogger.getLogger().info("Trying to log in to FileHoot.com");
      httpPost = new NUHttpPost("http://filehoot.com/");

      List<NameValuePair> formparams = new ArrayList<NameValuePair>();
      formparams.add(new BasicNameValuePair("op", "login"));
      formparams.add(new BasicNameValuePair("redirect", ""));
      formparams.add(new BasicNameValuePair("login", getUsername()));
      formparams.add(new BasicNameValuePair("password", getPassword()));

      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
      httpPost.setEntity(entity);
      httpResponse = httpclient.execute(httpPost, httpContext);
      NULogger.getLogger().info(httpResponse.getStatusLine().toString());
      Header lastHeader = httpResponse.getLastHeader("Location");

      if (httpResponse != null && httpResponse.toString().contains("xfss=")) {
        EntityUtils.consume(httpResponse.getEntity());
        loginsuccessful = true;
        username = getUsername();
        password = getPassword();
        NULogger.getLogger().info("FileHoot.com login successful!");

      } else {
        // Get error message
        responseString = EntityUtils.toString(httpResponse.getEntity());
        // FileUtils.saveInFile("FileHootAccount.html", responseString);
        Document doc = Jsoup.parse(responseString);
        String error = doc.select("div.alert-danger").first().text();

        if ("Incorrect Login or Password".equals(error)) {
          throw new NUInvalidLoginException(getUsername(), HOSTNAME);
        }

        // Generic exception
        throw new Exception("Login error: " + "Login Failed");
      }
    } catch (NUException ex) {
      resetLogin();
      ex.printError();
      accountUIShow().setVisible(true);
    } catch (Exception e) {
      resetLogin();
      NULogger.getLogger().log(Level.SEVERE, "{0}: {1}", new Object[] {getClass().getName(), e});
      showWarningMessage(Translation.T().loginerror(), HOSTNAME);
      accountUIShow().setVisible(true);
    }
  }
Esempio n. 6
0
  public NamedList<Object> request(final SolrRequest request, final ResponseParser processor)
      throws SolrServerException, IOException {
    HttpRequestBase method = null;
    InputStream is = null;
    SolrParams params = request.getParams();
    Collection<ContentStream> streams = requestWriter.getContentStreams(request);
    String path = requestWriter.getPath(request);
    if (path == null || !path.startsWith("/")) {
      path = DEFAULT_PATH;
    }

    ResponseParser parser = request.getResponseParser();
    if (parser == null) {
      parser = this.parser;
    }

    // The parser 'wt=' and 'version=' params are used instead of the original
    // params
    ModifiableSolrParams wparams = new ModifiableSolrParams(params);
    if (parser != null) {
      wparams.set(CommonParams.WT, parser.getWriterType());
      wparams.set(CommonParams.VERSION, parser.getVersion());
    }
    if (invariantParams != null) {
      wparams.add(invariantParams);
    }

    int tries = maxRetries + 1;
    try {
      while (tries-- > 0) {
        // Note: since we aren't do intermittent time keeping
        // ourselves, the potential non-timeout latency could be as
        // much as tries-times (plus scheduling effects) the given
        // timeAllowed.
        try {
          if (SolrRequest.METHOD.GET == request.getMethod()) {
            if (streams != null) {
              throw new SolrException(
                  SolrException.ErrorCode.BAD_REQUEST, "GET can't send streams!");
            }
            method = new HttpGet(baseUrl + path + ClientUtils.toQueryString(wparams, false));
          } else if (SolrRequest.METHOD.POST == request.getMethod()) {

            String url = baseUrl + path;
            boolean hasNullStreamName = false;
            if (streams != null) {
              for (ContentStream cs : streams) {
                if (cs.getName() == null) {
                  hasNullStreamName = true;
                  break;
                }
              }
            }
            boolean isMultipart =
                (this.useMultiPartPost || (streams != null && streams.size() > 1))
                    && !hasNullStreamName;

            // only send this list of params as query string params
            ModifiableSolrParams queryParams = new ModifiableSolrParams();
            for (String param : this.queryParams) {
              String[] value = wparams.getParams(param);
              if (value != null) {
                for (String v : value) {
                  queryParams.add(param, v);
                }
                wparams.remove(param);
              }
            }

            LinkedList<NameValuePair> postParams = new LinkedList<NameValuePair>();
            if (streams == null || isMultipart) {
              HttpPost post = new HttpPost(url + ClientUtils.toQueryString(queryParams, false));
              post.setHeader("Content-Charset", "UTF-8");
              if (!isMultipart) {
                post.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
              }

              List<FormBodyPart> parts = new LinkedList<FormBodyPart>();
              Iterator<String> iter = wparams.getParameterNamesIterator();
              while (iter.hasNext()) {
                String p = iter.next();
                String[] vals = wparams.getParams(p);
                if (vals != null) {
                  for (String v : vals) {
                    if (isMultipart) {
                      parts.add(new FormBodyPart(p, new StringBody(v, Charset.forName("UTF-8"))));
                    } else {
                      postParams.add(new BasicNameValuePair(p, v));
                    }
                  }
                }
              }

              if (isMultipart && streams != null) {
                for (ContentStream content : streams) {
                  String contentType = content.getContentType();
                  if (contentType == null) {
                    contentType = BinaryResponseParser.BINARY_CONTENT_TYPE; // default
                  }
                  String name = content.getName();
                  if (name == null) {
                    name = "";
                  }
                  parts.add(
                      new FormBodyPart(
                          name,
                          new InputStreamBody(
                              content.getStream(), contentType, content.getName())));
                }
              }

              if (parts.size() > 0) {
                MultipartEntity entity = new MultipartEntity(HttpMultipartMode.STRICT);
                for (FormBodyPart p : parts) {
                  entity.addPart(p);
                }
                post.setEntity(entity);
              } else {
                // not using multipart
                post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8"));
              }

              method = post;
            }
            // It is has one stream, it is the post body, put the params in the URL
            else {
              String pstr = ClientUtils.toQueryString(wparams, false);
              HttpPost post = new HttpPost(url + pstr);

              // Single stream as body
              // Using a loop just to get the first one
              final ContentStream[] contentStream = new ContentStream[1];
              for (ContentStream content : streams) {
                contentStream[0] = content;
                break;
              }
              if (contentStream[0] instanceof RequestWriter.LazyContentStream) {
                post.setEntity(
                    new InputStreamEntity(contentStream[0].getStream(), -1) {
                      @Override
                      public Header getContentType() {
                        return new BasicHeader("Content-Type", contentStream[0].getContentType());
                      }

                      @Override
                      public boolean isRepeatable() {
                        return false;
                      }
                    });
              } else {
                post.setEntity(
                    new InputStreamEntity(contentStream[0].getStream(), -1) {
                      @Override
                      public Header getContentType() {
                        return new BasicHeader("Content-Type", contentStream[0].getContentType());
                      }

                      @Override
                      public boolean isRepeatable() {
                        return false;
                      }
                    });
              }
              method = post;
            }
          } else {
            throw new SolrServerException("Unsupported method: " + request.getMethod());
          }
        } catch (NoHttpResponseException r) {
          method = null;
          if (is != null) {
            is.close();
          }
          // If out of tries then just rethrow (as normal error).
          if (tries < 1) {
            throw r;
          }
        }
      }
    } catch (IOException ex) {
      throw new SolrServerException("error reading streams", ex);
    }

    // XXX client already has this set, is this needed?
    method.getParams().setParameter(ClientPNames.HANDLE_REDIRECTS, followRedirects);
    method.addHeader("User-Agent", AGENT);

    InputStream respBody = null;
    boolean shouldClose = true;
    boolean success = false;
    try {
      // Execute the method.
      final HttpResponse response = httpClient.execute(method);
      int httpStatus = response.getStatusLine().getStatusCode();

      // Read the contents
      respBody = response.getEntity().getContent();
      Header ctHeader = response.getLastHeader("content-type");
      String contentType;
      if (ctHeader != null) {
        contentType = ctHeader.getValue();
      } else {
        contentType = "";
      }

      // handle some http level checks before trying to parse the response
      switch (httpStatus) {
        case HttpStatus.SC_OK:
        case HttpStatus.SC_BAD_REQUEST:
        case HttpStatus.SC_CONFLICT: // 409
          break;
        case HttpStatus.SC_MOVED_PERMANENTLY:
        case HttpStatus.SC_MOVED_TEMPORARILY:
          if (!followRedirects) {
            throw new SolrServerException(
                "Server at " + getBaseURL() + " sent back a redirect (" + httpStatus + ").");
          }
          break;
        default:
          if (processor == null) {
            throw new RemoteSolrException(
                httpStatus,
                "Server at "
                    + getBaseURL()
                    + " returned non ok status:"
                    + httpStatus
                    + ", message:"
                    + response.getStatusLine().getReasonPhrase(),
                null);
          }
      }
      if (processor == null) {

        // no processor specified, return raw stream
        NamedList<Object> rsp = new NamedList<Object>();
        rsp.add("stream", respBody);
        // Only case where stream should not be closed
        shouldClose = false;
        success = true;
        return rsp;
      }

      String procCt = processor.getContentType();
      if (procCt != null) {
        if (!contentType.equals(procCt)) {
          // unexpected content type
          String msg = "Expected content type " + procCt + " but got " + contentType + ".";
          Header encodingHeader = response.getEntity().getContentEncoding();
          String encoding;
          if (encodingHeader != null) {
            encoding = encodingHeader.getValue();
          } else {
            encoding = "UTF-8"; // try UTF-8
          }
          try {
            msg = msg + " " + IOUtils.toString(respBody, encoding);
          } catch (IOException e) {
            throw new RemoteSolrException(
                httpStatus, "Could not parse response with encoding " + encoding, e);
          }
          RemoteSolrException e = new RemoteSolrException(httpStatus, msg, null);
          throw e;
        }
      }

      //      if(true) {
      //        ByteArrayOutputStream copy = new ByteArrayOutputStream();
      //        IOUtils.copy(respBody, copy);
      //        String val = new String(copy.toByteArray());
      //        System.out.println(">RESPONSE>"+val+"<"+val.length());
      //        respBody = new ByteArrayInputStream(copy.toByteArray());
      //      }

      NamedList<Object> rsp = null;
      String charset = EntityUtils.getContentCharSet(response.getEntity());
      try {
        rsp = processor.processResponse(respBody, charset);
      } catch (Exception e) {
        throw new RemoteSolrException(httpStatus, e.getMessage(), e);
      }
      if (httpStatus != HttpStatus.SC_OK) {
        String reason = null;
        try {
          NamedList err = (NamedList) rsp.get("error");
          if (err != null) {
            reason = (String) err.get("msg");
            // TODO? get the trace?
          }
        } catch (Exception ex) {
        }
        if (reason == null) {
          StringBuilder msg = new StringBuilder();
          msg.append(response.getStatusLine().getReasonPhrase());
          msg.append("\n\n");
          msg.append("request: " + method.getURI());
          reason = java.net.URLDecoder.decode(msg.toString(), UTF_8);
        }
        throw new RemoteSolrException(httpStatus, reason, null);
      }
      success = true;
      return rsp;
    } catch (ConnectException e) {
      throw new SolrServerException("Server refused connection at: " + getBaseURL(), e);
    } catch (SocketTimeoutException e) {
      throw new SolrServerException(
          "Timeout occured while waiting response from server at: " + getBaseURL(), e);
    } catch (IOException e) {
      throw new SolrServerException(
          "IOException occured when talking to server at: " + getBaseURL(), e);
    } finally {
      if (respBody != null && shouldClose) {
        try {
          respBody.close();
        } catch (Throwable t) {
        } // ignore
        if (!success) {
          method.abort();
        }
      }
    }
  }
Esempio n. 7
0
  @SuppressWarnings("finally")
  public static LoginResultObj LoginQcwy(
      String ctmName, String userName, String password, String resumeId) {
    String ResumeId = resumeId;
    QcwyHttpUtil qcwyHttpUtil = new QcwyHttpUtil();
    LoginResultObj loginResultObj = new LoginResultObj();
    CloseableHttpClient httpClient = qcwyHttpUtil.getQcwyHttpClient();
    String result = "";
    HttpPost post = null;
    HttpGet resumePost = null;
    try {
      HttpGet get = new HttpGet("http://ehire.51job.com/MainLogin.aspx");
      HttpResponse response = httpClient.execute(get);
      HttpEntity entity = response.getEntity();
      result = EntityUtils.toString(entity, "gb2312");
      String langtype = "";
      String oldAccessKey = "";

      if (result.indexOf("hidLangType") > 0) {
        int start = result.indexOf("name=\"hidLangType\"");
        start = result.indexOf("value=\"", start) + 7;
        int end = result.indexOf("\"", start);
        langtype = result.substring(start, end);
      }

      if (result.indexOf("hidAccessKey") > 0) {
        int start = result.indexOf("name=\"hidAccessKey\"");
        start = result.indexOf("value=\"", start) + 7;
        int end = result.indexOf("\"", start);
        oldAccessKey = result.substring(start, end);
      }
      List<NameValuePair> testloginParames = new ArrayList<NameValuePair>();
      testloginParames.add(new BasicNameValuePair("ctmName", ctmName));
      testloginParames.add(new BasicNameValuePair("userName", userName));
      testloginParames.add(new BasicNameValuePair("password", password));
      testloginParames.add(new BasicNameValuePair("checkCode", ""));
      testloginParames.add(new BasicNameValuePair("langtype", langtype));
      testloginParames.add(new BasicNameValuePair("oldAccessKey", oldAccessKey));
      testloginParames.add(new BasicNameValuePair("isRememberMe", "false"));

      post = new HttpPost("https://ehirelogin.51job.com/Member/UserLogin.aspx");
      post.setHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
      post.setHeader("Accept-Encoding", "gzip, deflate, plain");
      post.setHeader("Accept-Language", "en-US,en;q=0.5");
      post.setHeader("Cache-Control", "max-age=0");
      post.setHeader("Connection", "keep-alive");
      post.setHeader("Content-Type", "application/x-www-form-urlencoded");

      post.setHeader(
          "User-Agent",
          "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:28.0) Gecko/20100101 Firefox/28.0");
      post.setHeader("Host", "ehirelogin.51job.com");
      post.setHeader("Origin", "http://ehire.51job.com/");
      post.setHeader("Referer", "http://ehire.51job.com/");
      HttpEntity he =
          new UrlEncodedFormEntity(
              testloginParames, Consts.UTF_8); // new UrlEncodedFormEntity(loginParames);
      post.setEntity(he);

      HttpResponse response2 = httpClient.execute(post);
      HttpEntity entity2 = response2.getEntity();

      result = EntityUtils.toString(entity2, "gb2312");
      Header[] headers = response2.getHeaders("set-cookie");
      String NET_SessionId = "";
      for (int i = 0; i < headers.length; i++) {
        String cookie = headers[i].toString();
        if (cookie.indexOf("ASP.NET_SessionId=") > 0) {
          int start = cookie.indexOf("ASP.NET_SessionId=") + 18;
          int end = cookie.indexOf(";", start);
          NET_SessionId = cookie.substring(start, end);
        }
      }

      String UserLoginJumpUrl = response2.getLastHeader("Location").getValue();
      HttpGet UserLoginJumpUrlGet = new HttpGet(UserLoginJumpUrl);
      UserLoginJumpUrlGet.setHeader("Host", "ehire.51job.com");
      UserLoginJumpUrlGet.setHeader("Referer", "http://ehire.51job.com/MainLogin.aspx");
      UserLoginJumpUrlGet.setHeader(
          "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
      UserLoginJumpUrlGet.setHeader(
          "User-Agent",
          "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 BIDUBrowser/6.x Safari/537.36");

      UserLoginJumpUrlGet.setHeader("Cache-Control", "max-age=0");
      UserLoginJumpUrlGet.setHeader("Accept-Encoding", "gzip,deflate");
      UserLoginJumpUrlGet.setHeader("Accept-Language", "zh-CN,zh;q=0.8");
      HttpResponse UserLoginJumpResponse = httpClient.execute(UserLoginJumpUrlGet);
      HttpEntity UserLoginJumpEntity = UserLoginJumpResponse.getEntity();
      result = EntityUtils.toString(UserLoginJumpEntity, "UTF-8");
      // System.out.println("====>>"+result);
      if (result.indexOf("对不起,您已通过其他浏览器登录到本系统") != -1) {

        String url = "", viewstate = "", gvOnLineUser = "", kickOut = "";

        Document document = Jsoup.parse(result);
        url = document.select("#form1").attr("action");
        viewstate = document.select("#form1").select("#__VIEWSTATE").attr("value");
        String reg = "<a href=\"javascript:__doPostBack(.+?)\">强制下线</a>";

        if (null != url && !"".equals(url)) {
          url = "https://ehirelogin.51job.com/Member/" + url;
          List<NameValuePair> parames = new ArrayList<NameValuePair>();
          parames.add(new BasicNameValuePair("__VIEWSTATE", viewstate));
          parames.add(new BasicNameValuePair("__EVENTTARGET", "gvOnLineUser"));
          parames.add(new BasicNameValuePair("__EVENTARGUMENT", "KickOut$0"));

          post = new HttpPost(url);
          post.setHeader("Host", "ehire.51job.com");
          post.setHeader("Origin", "http://ehire.51job.com");
          post.setHeader("Referer", url);

          HttpEntity kickOuthe =
              new UrlEncodedFormEntity(
                  parames, Consts.UTF_8); // new UrlEncodedFormEntity(loginParames);
          post.setEntity(kickOuthe);

          HttpResponse kickOutresponse = httpClient.execute(post);
          HttpEntity kickOutentity = kickOutresponse.getEntity();
          String tempResult = EntityUtils.toString(kickOutentity, "gb2312");
          // System.out.println(tempResult);
          if (tempResult.indexOf("UserLogin.aspx?ctmName") != -1) {
            return loginResultObj = LoginQcwy(ctmName, userName, password, ResumeId);
          }
        }
      }
      // 获取剩余简历数 剩余职位数
      HttpGet navigateGet = new HttpGet("http://ehire.51job.com/Navigate.aspx");
      navigateGet.setHeader("Host", "ehire.51job.com");
      navigateGet.setHeader("Referer", "http://ehire.51job.com/MainLogin.aspx");
      navigateGet.setHeader("Cache-Control", "max-age=0");
      navigateGet.setHeader("Accept-Encoding", "gzip,deflate");
      navigateGet.setHeader("Accept-Language", "zh-CN,zh;q=0.8");
      HttpResponse navigateResponse = httpClient.execute(navigateGet);
      HttpEntity navigateEntity = navigateResponse.getEntity();
      result = EntityUtils.toString(navigateEntity, "gb2312");
      HttpGet navigateGet_1 =
          new HttpGet("http://ehire.51job.com/Candidate/ResumeView.aspx?hidUserID=100000");
      HttpPost resume_post = new HttpPost("http://ehire.51job.com/Candidate/SearchResume.aspx");
      List<NameValuePair> namePairs = new ArrayList<NameValuePair>();
      namePairs.add(new BasicNameValuePair("ctrlSerach$txtUserID", "100000"));
      HttpEntity newenEntity = new UrlEncodedFormEntity(namePairs);
      resume_post.setEntity(newenEntity);

      HttpResponse httpResponse_1 = httpClient.execute(navigateGet_1);
      // HttpResponse httpResponse=httpClient.execute(resume_post);
      HttpEntity httpEntity = httpResponse_1.getEntity();
      System.out.println("=======================================");
      // System.out.println(EntityUtils.toString(httpEntity, "gb2312"));
      // System.out.println("================================>>"+result);
      String zhiwei = "";
      String jianli = "";
      if (result.indexOf("您还可发布职位:") != -1) {
        int zwstart = result.indexOf("您还可发布职位:");
        zwstart = result.indexOf("<b class='info_att'>", zwstart) + 20;
        int zwend = result.indexOf("</b>", zwstart);
        zhiwei = result.substring(zwstart, zwend);
        loginResultObj.setResult(true);
      }

      if (result.indexOf("您还可下载简历:") != -1) {
        int jlstart = result.indexOf("您还可下载简历:");
        jlstart = result.indexOf("<b class='info_att'>", jlstart) + 20;
        int jlend = result.indexOf("</b>", jlstart);
        jianli = result.substring(jlstart, jlend);
      }
      loginResultObj.setResumesnum(jianli);
      loginResultObj.setJobsnum(zhiwei);
      // HttpGet resumePost=new HttpGet("http://www.baidu.com");
      String responseString = "";
      StringBuffer sbBuffer = new StringBuffer();
      for (int i = 100000; i < 999999; i++) {
        resumePost =
            new HttpGet(
                "http://ehire.51job.com/Candidate/ResumeView.aspx?hidUserID="
                    + Integer.toString(i)
                    + "&hidEvents=23&hidKey=6dd65d2566c46662ee40b36b93cd7851");
        HttpResponse resumeResponse = httpClient.execute(resumePost);
        HttpEntity resumeResponseEntity = resumeResponse.getEntity();
        responseString = EntityUtils.toString(resumeResponseEntity, "gb2312");

        if (responseString.contains("公 司:")) sbBuffer.append(Integer.toString(i)).append("\r\n");

        if (i % 100 == 0) {
          System.out.println("正在检查id为" + i + "的简历。");
          String pathname = "E:/Temp/resumeId.txt";
          File file = new File(pathname);
          if (!file.exists()) {
            file.createNewFile();
          }
          BufferedWriter bw = new BufferedWriter(new FileWriter(file, true));
          bw.write(sbBuffer.toString());
          sbBuffer.setLength(0);
          bw.flush();
          bw.close();
        }

        // System.out.println(EntityUtils.toString(resumeResponseEntity, "gb2312"));
        // if(responseString.contains("公 司:")){
        // System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
        // System.out.println("ResumeId="+Integer.toString(i)+"有效");
        // String gongsi=responseString.substring(responseString.indexOf("<td
        // width=\"230\">")+16,responseString.indexOf("</td></tr><tr><td>",
        // responseString.indexOf("<td width=\"230\">")));
        // System.out.println(gongsi);
        // System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        // }

      }

      String pathname = "E:/Temp/resumeId.txt";
      File file = new File(pathname);
      if (!file.exists()) {
        file.createNewFile();
      }
      BufferedWriter bw = new BufferedWriter(new FileWriter(file, true));
      bw.write(sbBuffer.toString());
      bw.flush();
      bw.close();
      // resumePost=new
      // HttpGet("http://ehire.51job.com/Candidate/ResumeView.aspx?hidUserID="+ResumeId+"&hidEvents=23&hidKey=6dd65d2566c46662ee40b36b93cd7851");
      // HttpPost resumePost=new HttpPost("http://ehire.51job.com/Candidate/SearchResume.aspx");
      /*List<NameValuePair> resumePara = new ArrayList<NameValuePair>();
      resumePara.add(new BasicNameValuePair("hidValue", "ResumeID#100015"));
      HttpEntity resumtEntity=new UrlEncodedFormEntity(resumePara,"UTF-8");
      resume_post.setEntity(resumtEntity);*/

    } catch (Exception e) {
      if (post != null) {
        post.abort();
      }
      if (resumePost != null) {
        resumePost.abort();
      }
      e.printStackTrace();
    } finally {
      if (post != null) {
        post.abort();
      }
      return loginResultObj;
    }
  }