this.directory = directory;
this.handler = handler;
	public DirectoryResource(DirectoryHandler directory, String resourcePath)			throws IOException	{		// Update the member variables		this.directory = directory;		// Compute the base resource URI		this.targetUri = new Reference(directory.getRootUri() + resourcePath)				.getTargetRef().toString();		if (!this.targetUri.startsWith(directory.getRootUri()))		{			// Prevent the client from accessing resources in upper directories			this.targetUri = directory.getRootUri();		}		// Try to detect the presence of a directory		Call call = getDirectory().getContextClient().get(this.targetUri);		if ((call.getOutput() != null)				&& call.getOutput().getMediaType().equals(MediaTypes.TEXT_URI_LIST))		{			this.directoryContent = new ReferenceList(call.getOutput());			// Append the index name			if (getDirectory().getIndexName() != null)			{				this.directoryUri = this.targetUri;				this.baseName = getDirectory().getIndexName();				this.targetUri = this.directoryUri + this.baseName;			}		}		else		{			int lastSlashIndex = targetUri.lastIndexOf('/');			if (lastSlashIndex == -1)			{				this.directoryUri = "";				this.baseName = targetUri;			}			else			{				this.directoryUri = targetUri.substring(0, lastSlashIndex + 1);				this.baseName = targetUri.substring(lastSlashIndex + 1);			}			call = getDirectory().getContextClient().get(this.directoryUri);			if ((call.getOutput() != null)					&& call.getOutput().getMediaType().equals(							MediaTypes.TEXT_URI_LIST))			{				this.directoryContent = new ReferenceList(call.getOutput());			}		}		// Remove the extensions from the base name		int firstDotIndex = this.baseName.indexOf('.');		if (firstDotIndex != -1)		{			// Store the set of extensions			this.baseExtensions = getExtensions(this.baseName);			// Remove stored extensions from the base name			this.baseName = this.baseName.substring(0, firstDotIndex);		}		// Log results		logger.info("Converted base path: " + this.targetUri);		logger.info("Converted base name: " + this.baseName);	}