Visit a given path, and additionally check for HTTP response code 200.

@Given I am at :path
@When I visit :path

@throws UnsupportedDriverActionException
553987
public function assertAtPath($path)
    {
        $this->getSession()->visit($this->locatePath($path));

        // If available, add extra validation that this is a 200 response.
        try {
            $this->getSession()->getStatusCode();
            $this->assertHttpResponse('200');
        } catch (UnsupportedDriverActionException $e) {
            // Simply continue on, as this driver doesn't support HTTP response codes.
        }
    }
317779
def _checkpath(self, path):
        
        if path.startswith("/") or ".." in path or path.strip() != path:
            raise NotFoundException()
1312217
@Nullable
  private String parseDriveRoot(String path) {
    Matcher drivePathMatcher = DRIVE_LETTER_ROOT.matcher(path);
    if (drivePathMatcher.find()) {
      return path.substring(drivePathMatcher.start(), drivePathMatcher.end());
    }
    return null;
  }
1232419
public void setRequestPath(String mapping, String path) {
		this.requestPath = path;
		int paramStartIdx = requestPath.indexOf("?");
		if(StringUtils.isEmpty(mapping)){
			if(paramStartIdx != -1){
				this.servletPath = requestPath.substring(0, paramStartIdx);
			}else{
				this.servletPath = requestPath;
			}
		}else{
			this.servletPath = PathNormalizer.asPath(mapping);
			String pathInfo = removeServletMappingFromPath(path, mapping);
			this.pathInfo = pathInfo;
		}
		
		// Sets the request URI
		if(paramStartIdx == -1){
			this.requestURI = requestPath;
		}else{
			this.requestURI = requestPath.substring(0, paramStartIdx);
		}
		
		initParameters();
		
	}
864834
@Override
    public void setPath ( String path ) {
        if ( path.length() > 0 && path.charAt(0) == '\\' ) {
            path = path.substring(1);
        }
        // win8.1 returns ACCESS_DENIED if the trailing backslash is included
        if ( path.length() > 1 && path.charAt(path.length() - 1) == '\\' ) {
            path = path.substring(0, path.length() - 1);
        }
        this.name = path;
    }
720485
private static void createDirectory(Path path) throws IOException {
		try {
			Files.createDirectory(path);
		} catch (FileAlreadyExistsException e) {
			if (!Files.isDirectory(path)) {
				throw e;
			}
		}
	}
953129
public void setPath(String path) throws URIException {

        if (path == null || path.length() == 0) {
            _path = _opaque = (path == null) ? null : path.toCharArray();
            setURI();
            return;
        }
        // set the charset to do escape encoding
        String charset = getProtocolCharset();

        if (_is_net_path || _is_abs_path) {
            _path = encode(path, allowed_abs_path, charset);
        } else if (_is_rel_path) {
            StringBuffer buff = new StringBuffer(path.length());
            int at = path.indexOf('/');
            if (at == 0) { // never 0
                throw new URIException(URIException.PARSING,
                        "incorrect relative path");
            }
            if (at > 0) {
                buff.append(encode(path.substring(0, at), allowed_rel_path,
                            charset));
                buff.append(encode(path.substring(at), allowed_abs_path,
                            charset));
            } else {
                buff.append(encode(path, allowed_rel_path, charset));
            }
            _path = buff.toString().toCharArray();
        } else if (_is_opaque_part) {
            StringBuffer buf = new StringBuffer();
            buf.insert(0, encode(path.substring(0, 1), uric_no_slash, charset));
            buf.insert(1, encode(path.substring(1), uric, charset));
            _opaque = buf.toString().toCharArray();
        } else {
            throw new URIException(URIException.PARSING, "incorrect path");
        }
        setURI();
    }
14936
public static String ensureAbsolutePath(String path, String paramName) {
        requireNonNull(path, paramName);
        if (path.isEmpty() || path.charAt(0) != '/') {
            throw new IllegalArgumentException(paramName + ": " + path + " (expected: an absolute path)");
        }
        return path;
    }
115895
public boolean addPath(String path) throws MalformedURLException {
        File file = new File(path);
        return addPath( file );
    }
1277651
protected boolean checkExists(String path) {
        try {
            return client.checkExists().forPath(path) != null;
        } catch (Exception e) {
            throw new NiubiException(e);
        }
    }
300194
public static boolean isSubPath(org.apache.hadoop.fs.Path parent, org.apache.hadoop.fs.Path child) throws IOException {
    String childStr = child.toString();
    String parentStr = parent.toString();

    return childStr.startsWith(parentStr);
  }
1352372
public void openPath(String path) {

        if (!CmsStringUtil.isPrefixPath(m_root.getRootPath(), path)) {
            CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(path);
            if (site != null) {
                // the given path is a root path switch to the determined site
                getSiteSelector().setValue(site.getSiteRoot());
                path = m_currentCms.getRequestContext().removeSiteRoot(path);
            } else if (OpenCms.getSiteManager().startsWithShared(path)) {
                getSiteSelector().setValue(OpenCms.getSiteManager().getSharedFolder());
            } else if (path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) {
                Container container = getSiteSelector().getContainerDataSource();
                String newSiteRoot = null;
                for (String possibleSiteRoot : Arrays.asList("", "/", "/system", "/system/")) {
                    if (container.containsId(possibleSiteRoot)) {
                        newSiteRoot = possibleSiteRoot;
                        break;
                    }
                }
                if (newSiteRoot == null) {
                    LOG.warn(
                        "Couldn't open path in site selector because neither root site nor system folder are in the site selector. path="
                            + path);
                    return;
                }
                getSiteSelector().setValue(newSiteRoot);
            }
        }
        if (!"/".equals(path)) {
            List<CmsUUID> idsToOpen = Lists.newArrayList();
            try {
                CmsResource currentFolder = m_currentCms.readResource(CmsResource.getParentFolder(path));
                if (!m_root.getStructureId().equals(currentFolder.getStructureId())) {
                    idsToOpen.add(currentFolder.getStructureId());
                    CmsResource parentFolder = null;

                    do {
                        try {
                            parentFolder = m_currentCms.readParentFolder(currentFolder.getStructureId());
                            idsToOpen.add(parentFolder.getStructureId());
                            currentFolder = parentFolder;
                        } catch (CmsException | NullPointerException e) {
                            LOG.info(e.getLocalizedMessage(), e);
                            break;
                        }
                    } while (!parentFolder.getStructureId().equals(m_root.getStructureId()));
                    // we need to iterate from "top" to "bottom", so we reverse the list of folders
                    Collections.reverse(idsToOpen);

                    for (CmsUUID id : idsToOpen) {
                        m_fileTree.expandItem(id);
                    }
                }
            } catch (CmsException e) {
                LOG.debug("Can not read parent folder of current path.", e);
            }
        }
    }
160902
private static String checkPath(String path) {
        File file = new File(path);
        int idx = path.lastIndexOf(".");
        String post = "";
        if (idx > -1) {
            post = path.substring(idx);
            path = path.substring(0, idx);
        }
        int i = 0;
        while (file.exists()) {
            file = new File(path + "_" + (++i) + post);
        }
        return file.getAbsolutePath();
    }
418593
public void handle(String pathInContext,
                       String pathParams,
                       HttpRequest request,
                       HttpResponse response)
        throws HttpException, IOException
    {
        log.debug("Not Found");
        String method=request.getMethod();
        
        // Not found  requests.
        if (method.equals(HttpRequest.__GET)    ||
            method.equals(HttpRequest.__HEAD)   ||
            method.equals(HttpRequest.__POST)   ||
            method.equals(HttpRequest.__PUT)    ||
            method.equals(HttpRequest.__DELETE) ||
            method.equals(HttpRequest.__MOVE)   )
        {
            response.sendError(HttpResponse.__404_Not_Found,
                               request.getPath()+" Not Found");
        }
        
        else if (method.equals(HttpRequest.__OPTIONS))
        {
            // Handle OPTIONS request for entire server
            if ("*".equals(request.getPath()))
            {
                // 9.2
                response.setIntField(HttpFields.__ContentLength,0);
                response.setField(HttpFields.__Allow,
                                  "GET, HEAD, POST, PUT, DELETE, MOVE, OPTIONS, TRACE");
                response.commit();
            }
            else
                response.sendError(HttpResponse.__404_Not_Found);
        }
        else if (method.equals(HttpRequest.__TRACE))
        {
            handleTrace(request,response);
        }
        else
        {
            // Unknown METHOD
            response.setField(HttpFields.__Allow,
                              "GET, HEAD, POST, PUT, DELETE, MOVE, OPTIONS, TRACE");
            response.sendError(HttpResponse.__405_Method_Not_Allowed);
        }
    }
787538
protected void verifyThatPathIsEmpty(Stack<String> pPathStack) {
        if (pPathStack != null && pPathStack.size() > 0) {
            throw new IllegalArgumentException("Path contains extra elements not usable for a list request: " + pPathStack);
        }
    }
96934
public void checkAccess(JimfsPath path) throws IOException {
    // just check that the file exists
    lookUpWithLock(path, Options.FOLLOW_LINKS).requireExists(path);
  }
273115
public Resource addPath(String path)
        throws IOException,MalformedURLException
    {
        if (path==null)
            return null;

        path = URI.canonicalPath(path);

        return newResource(URI.addPaths(_url.toExternalForm(),path));
    }