コード例 #1
0
 protected void ssoLogin1(SimpleObject context) {
   Request req1 = ContextUtil.getRequest(context);
   Integer scode = (Integer) req1.getExtra(Request.STATUS_CODE);
   if (HttpUtil.isMovedStatusCode(scode)) {
     HttpResponse resp = ContextUtil.getResponse(context);
     Header h1 = resp.getFirstHeader("Location");
     String nexturl = h1.getValue();
     if (nexturl == null) {
       logger.error("Error : No Redirect URL");
     } else {
       Request req = new Request(nexturl);
       req.setCharset(UAM_CHAR_SET);
       req.addObjservers(
           new AbstractProcessorObserver(util, WaringConstaint.ZGDX_7) {
             @Override
             public void afterRequest(SimpleObject context) {
               ssoLogin1(context);
             }
           });
       spider.addRequest(req);
     }
   } else {
     endSSOLogin(context);
   }
 }
コード例 #2
0
 protected void parseLoginPage(SimpleObject context, final String prefix, final String phone) {
   Request req1 = ContextUtil.getRequest(context);
   Integer scode = (Integer) req1.getExtra(Request.STATUS_CODE);
   // DebugUtil.printCookieData(ContextUtil.getCookieStore(context), null);
   if (HttpUtil.isMovedStatusCode(scode)) {
     HttpResponse resp = ContextUtil.getResponse(context);
     Header h1 = resp.getFirstHeader("Location");
     String nexturl = h1.getValue();
     if (nexturl == null) {
       logger.error("Error : No Redirect URL");
     } else {
       nexturl = fixedFullUrl(nexturl);
       Request req = new Request(nexturl.replaceAll(" ", "%20"));
       req.setCharset(UAM_CHAR_SET);
       req.putHeader("Referer", "http://www.189.cn/dqmh/login/loginJT.jsp");
       req.addObjservers(
           new AbstractProcessorObserver(util, WaringConstaint.ZGDX_2) {
             @Override
             public void afterRequest(SimpleObject context) {
               parseLoginPage(context, prefix, phone);
             }
           });
       spider.addRequest(req);
     }
   } else {
     if (prefix != null) {
       // com.lkb.debug.DebugUtil.printCookieData(ContextUtil.getCookieStore(context), null);
       saveVerifyImage(context, prefix, phone);
     } else {
       parseLoginStep2(context);
     }
   }
 }
コード例 #3
0
 private void ssoLogin2(SimpleObject context) {
   Request req1 = ContextUtil.getRequest(context);
   Integer scode = (Integer) req1.getExtra(Request.STATUS_CODE);
   if (HttpUtil.isMovedStatusCode(scode)) {
     HttpResponse resp = ContextUtil.getResponse(context);
     Header h1 = resp.getFirstHeader("Location");
     String nexturl = h1.getValue();
     if (nexturl == null) {
       logger.error("Error : No Redirect URL");
     } else {
       ssoLogin2(context);
     }
   } else {
     completeLogin(context);
   }
 }