VFSContext oldVFSContext = handler.getVFSContext();
// create new handler
FileSystemContext fileSystemContext = new TempContext(copy, oldVFSContext, path);
// merge old options
Options newOptions = fileSystemContext.getOptions();
if (newOptions != null) // shouldn't be null, but we check anyway
{
Options oldOptions = oldVFSContext.getOptions();
if (oldOptions != null && oldOptions.size() > 0)
newOptions.merge(oldOptions);
newOptions.addOption(VFSUtils.IS_TEMP_FILE, Boolean.TRUE);
// save old handler
newOptions.addOption(VirtualFileHandler.class.getName(), handler);