Package com.subgraph.vega.api.model.web

Examples of com.subgraph.vega.api.model.web.IWebPath


    } else if(entity instanceof IWebHost) {
      return scopeManager.getActiveScope().filter(((IWebHost)entity).getUri());
    } else if(entity instanceof IWebPath) {
      return scopeManager.getActiveScope().filter(((IWebPath)entity).getUri());
    } else if(entity instanceof IWebResponse){
      IWebPath path = ((IWebResponse)entity).getPathEntity();
      return scopeManager.getActiveScope().filter(path.getUri());
    } else {
      return false;
    }
  }
View Full Code Here


public class WebHostTreeStrategy implements ITreeAdapter<IWebHost> {
  private final WebPathTreeStrategy pathTreeStrategy = new WebPathTreeStrategy();
 
  @Override
  public Object[] getChildren(IWebHost item) {
    IWebPath rootPath = item.getRootPath();
    boolean noResponses = (rootPath.getGetResponses().size() == 0) && (rootPath.getPostResponses().size() == 0);

    Collection<IWebPath> childPaths = rootPath.getChildPaths();
   
    if(childPaths.isEmpty() && noResponses)
      return new Object[] { rootPath };
    else if(childPaths.isEmpty())
      return Iterables.toArray(childPaths, Object.class);
View Full Code Here

    }
  }

  @Override
  public IWebPath addGetTarget(VegaURI uri) {
    final IWebPath path = getWebPathByUri(uri);
    if (path != null) {
      List<NameValuePair> params = URLEncodedUtils.parse(uri.getQuery(), Consts.UTF_8);
      path.addGetParameterList(params);
    }
    return path;
  }
View Full Code Here

  private Object collapsedNode(IWebPath root, IWebPath p) {
    boolean noResponses = (p.getGetResponses().size() == 0) && (p.getPostResponses().size() == 0);
    if(p.getChildPaths().size() == 1 && noResponses)
      return collapsedNode(root, p.getChildPaths().iterator().next());
    else if(p.getChildPaths().isEmpty() && !noResponses) {
      IWebPath pp = p.getParentPath();
      if(pp == null || pp == root)
        return null;
      else
        return pp;
    } else {
View Full Code Here

      return prevLabel(item) + "/" + item.getPathComponent();
    }
  }
 
  private String prevLabel(IWebPath item) {
    IWebPath pp = item.getParentPath();
    if(pp.getChildPaths().size() == 1 && pp.getParentPath() != null)
      return getLabel(pp);
    else
      return "";
  }
View Full Code Here

    pathStateManager.setInjectionModules(injectionModules);
  }

  public IPathState processUri(VegaURI uri) {
    final IWebHost webHost = getWebHost(uri.getTargetHost());
    final IWebPath rootPath = webHost.getRootPath();
    IWebPath path = rootPath;
    final boolean hasTrailingSlash = uri.getPath().endsWith("/");

    String[] parts = uri.getPath().split("/");
    IWebPath childPath = null;
    for(int i = 1; i < parts.length; i++) {
      synchronized(path) {
        childPath = path.getChildPath(parts[i]);
        if(childPath == null) {
          childPath = path.addChildPath(parts[i]);
View Full Code Here

    processWebHost(webHost);
    return webHost;
  }

  private void processWebHost(IWebHost webHost) {
    final IWebPath rootPath = webHost.getRootPath();
    synchronized(pathStateManager) {
      if(!pathStateManager.hasSeenPath(rootPath)) {
        pathStateManager.createStateForPath(rootPath, directoryProcessor);
      }
    }
View Full Code Here

    return isProxyScan;
  }

  /* called with modelToScanState lock */
  private PathState getParentDirectoryState(IWebPath path) {
    final IWebPath parentPath = path.getParentPath();
    if(parentPath == null)
      return null;
    if(!modelToScanState.containsKey(parentPath)) {
      if(parentPath.getPathType() != PathType.PATH_DIRECTORY)
        parentPath.setPathType(PathType.PATH_DIRECTORY);
      final PathState parentState = createStateForPathNoChecks(parentPath, directoryFetchCallback);
      modelToScanState.put(parentPath, parentState);
      return parentState;
    }
    return modelToScanState.get(parentPath);
View Full Code Here

    if(addToRequestLog) {
      workspace.getRequestLog().addRequestResponse(response);
    }

    final VegaURI uri = VegaURI.fromHostAndRequest(response.getHost(), response.getOriginalRequest());
    final IWebPath path = workspace.getWebModel().getWebPathByUri(uri);
    path.setVisited(true);
   
    result.setDeclaredMimeType(mimeDetector.getDeclaredMimeType(response));
    result.setSniffedMimeType(mimeDetector.getSniffedMimeType(response));
   
    final String mimeType = getBestMimeType(result);
    if(mimeType != null && path.getMimeType() == null) {
      path.setMimeType(mimeType);
    }
   
    if(scrapePage)
      runExtractUrls(result, response, workspace.getWebModel());
    runResponseProcessingModules(response.getOriginalRequest(), response, result.getDeclaredMimeType(), result.getSniffedMimeType(), workspace);
View Full Code Here

    final HttpUriRequest req = createRequest(ps);
    ctx.submitRequest(req, this, 0);
  }
 
  private boolean hasSuitablePath(IPathState ps) {
    final IWebPath parentPath = ps.getPath().getParentPath();
    return(parentPath != null && parentPath.getParentPath() != null);
  }
View Full Code Here

TOP

Related Classes of com.subgraph.vega.api.model.web.IWebPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.