String path = ctxt.getPath(); if (path.endsWith("/")) path = path.substring(0, path.length()-1); int pos = path.lastIndexOf('/'); if (pos == -1) throw new DavException("invalid path", HttpServletResponse.SC_CONFLICT, null); String col = path.substring(0, pos); String item = path.substring(pos+1); DavResource rsc; try { rsc = UrlNamespace.getResourceAt(ctxt, col); } catch (DavException de) { throw new DavException("no collection at "+col, HttpServletResponse.SC_CONFLICT, de); } if (!rsc.isCollection()) throw new DavException(col+" is not a collection", HttpServletResponse.SC_CONFLICT, null); Collection collection = (Collection) rsc; collection.mkCol(ctxt, item);
String user = ctxt.getUser(); String name = ctxt.getItem();  if (user == null || name == null) throw new DavException("invalid uri", HttpServletResponse.SC_NOT_ACCEPTABLE, null);  Collection col = UrlNamespace.getCollectionAtUrl(ctxt); col.mkCol(ctxt, name);
	public void handle(DavContext ctxt) throws DavException, IOException {		String path = ctxt.getPath();		if (path.endsWith("/"))			path = path.substring(0, path.length()-1);		int pos = path.lastIndexOf('/');		if (pos == -1)			throw new DavException("invalid path", HttpServletResponse.SC_CONFLICT, null);		String col = path.substring(0, pos);		String item = path.substring(pos+1);		DavResource rsc;		try {			rsc = UrlNamespace.getResourceAt(ctxt, col);		} catch (DavException de) {			throw new DavException("no collection at "+col, HttpServletResponse.SC_CONFLICT, de);		}		if (!rsc.isCollection())			throw new DavException(col+" is not a collection", HttpServletResponse.SC_CONFLICT, null);		Collection collection = (Collection) rsc;		collection.mkCol(ctxt, item);		ctxt.setStatus(HttpServletResponse.SC_CREATED);	}