예제 #1
0
 @Override
 public Result get(HttpUrl url, String encoding, String cookie, Map<String, String> headers) {
   String realUrl = url.toUrlString();
   GetMethod method = new GetMethod(realUrl);
   Result result = excuteMethod(method, cookie, headers);
   result.setResultEncoding(encoding);
   return result;
 }
예제 #2
0
파일: Redirect.java 프로젝트: chenjw/spider
 public void execute(Context context, Navigator navigator) {
   TurbineRunDataInternal runData =
       (TurbineRunDataInternal) TurbineUtil.getTurbineRunData(request);
   ParameterParser param = runData.getParameters();
   String url = param.getString("url");
   HttpUrl httpUrl = UrlParseUtils.parseUrl(url);
   for (String key : param.keySet()) {
     if (!"url".equals(key)) {
       httpUrl.getQueryParam().put(key, param.getString(key));
     }
   }
   url = httpUrl.toUrlString();
   runData.redirectToLocation(url);
 }