当前位置: 首页>>代码示例>>Java>>正文


Java DavServletResponse类代码示例

本文整理汇总了Java中org.apache.jackrabbit.webdav.DavServletResponse的典型用法代码示例。如果您正苦于以下问题:Java DavServletResponse类的具体用法?Java DavServletResponse怎么用?Java DavServletResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DavServletResponse类属于org.apache.jackrabbit.webdav包,在下文中一共展示了DavServletResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refreshLock

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
public ActiveLock refreshLock( LockInfo lockInfo, String lockToken )
    throws DavException
{
    if ( !exists() )
    {
        throw new DavException( DavServletResponse.SC_NOT_FOUND );
    }
    ActiveLock lock = getLock( lockInfo.getType(), lockInfo.getScope() );
    if ( lock == null )
    {
        throw new DavException( DavServletResponse.SC_PRECONDITION_FAILED,
                                "No lock with the given type/scope present on resource " + getResourcePath() );
    }

    lock = lockManager.refreshLock( lockInfo, lockToken, this );

    return lock;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:20,代码来源:ArchivaDavResource.java

示例2: unlock

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
public void unlock( String lockToken )
    throws DavException
{
    ActiveLock lock = getLock( Type.WRITE, Scope.EXCLUSIVE );
    if ( lock == null )
    {
        throw new DavException( HttpServletResponse.SC_PRECONDITION_FAILED );
    }
    else if ( lock.isLockedByToken( lockToken ) )
    {
        lockManager.releaseLock( lockToken, this );
    }
    else
    {
        throw new DavException( DavServletResponse.SC_LOCKED );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:19,代码来源:ArchivaDavResource.java

示例3: testDeleteNonExistantResourceShould404

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Test
public void testDeleteNonExistantResourceShould404()
    throws Exception
{
    File dir = new File( baseDir, "testdir" );
    try
    {
        DavResource directoryResource = getDavResource( "/testdir", dir );
        directoryResource.getCollection().removeMember( directoryResource );
        fail( "Did not throw DavException" );
    }
    catch ( DavException e )
    {
        assertEquals( DavServletResponse.SC_NOT_FOUND, e.getErrorCode() );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:17,代码来源:DavResourceTest.java

示例4: testRefreshLockThrowsExceptionIfNoLockIsPresent

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Test
public void testRefreshLockThrowsExceptionIfNoLockIsPresent()
    throws Exception
{
    LockInfo info = new LockInfo( Scope.EXCLUSIVE, Type.WRITE, "/", 0, false );

    assertEquals( 0, resource.getLocks().length );

    try
    {
        lockManager.refreshLock( info, "notoken", resource );
        fail( "Did not throw dav exception" );
    }
    catch ( DavException e )
    {
        assertEquals( DavServletResponse.SC_PRECONDITION_FAILED, e.getErrorCode() );
    }

    assertEquals( 0, resource.getLocks().length );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:21,代码来源:DavResourceTest.java

示例5: testUnlockThrowsDavExceptionIfNotLocked

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Test
public void testUnlockThrowsDavExceptionIfNotLocked()
    throws Exception
{
    LockInfo info = new LockInfo( Scope.EXCLUSIVE, Type.WRITE, "/", 0, false );

    assertEquals( 0, resource.getLocks().length );

    lockManager.createLock( info, resource );

    assertEquals( 1, resource.getLocks().length );

    try
    {
        lockManager.releaseLock( "BLAH", resource );
        fail( "Did not throw DavException" );
    }
    catch ( DavException e )
    {
        assertEquals( DavServletResponse.SC_LOCKED, e.getErrorCode() );
    }

    assertEquals( 1, resource.getLocks().length );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:25,代码来源:DavResourceTest.java

示例6: testUnlockThrowsDavExceptionIfResourceNotLocked

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Test
public void testUnlockThrowsDavExceptionIfResourceNotLocked()
    throws Exception
{
    assertEquals( 0, resource.getLocks().length );

    try
    {
        lockManager.releaseLock( "BLAH", resource );
        fail( "Did not throw DavException" );
    }
    catch ( DavException e )
    {
        assertEquals( DavServletResponse.SC_PRECONDITION_FAILED, e.getErrorCode() );
    }

    assertEquals( 0, resource.getLocks().length );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:19,代码来源:DavResourceTest.java

示例7: processResponseBody

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
/**
 * Overridden to process the sync-token. Adapted from DavMethodBase.
 *
 * @see DavMethodBase#processResponseBody(HttpState, HttpConnection)
 */
@Override
protected void processResponseBody(HttpState httpState, HttpConnection httpConnection) {
	if (getStatusCode() == DavServletResponse.SC_MULTI_STATUS) {
		try {
			Document document = getResponseBodyAsDocument();
			if (document != null) {
				synctoken = DomUtil.getChildText(document.getDocumentElement(), SyncReportInfo.XML_SYNC_TOKEN, DavConstants.NAMESPACE);
				log.info("Sync-Token for REPORT: " + synctoken);

				multiStatus = MultiStatus.createFromXml(document.getDocumentElement());
				processMultiStatusBody(multiStatus, httpState, httpConnection);
			}
		} catch (IOException e) {
			log.error("Error while parsing sync-token.", e);
			setSuccess(false);
		}
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:24,代码来源:SyncMethod.java

示例8: move

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
    public void move( @Nullable DavResource destination ) throws DavException {
        // todo check on path
//        if( !( file instanceof Renameable ) ) {
//            throw new DavException( DavServletResponse.SC_FORBIDDEN );
//        }
        if( !exists() ) {
            throw new DavException( DavServletResponse.SC_NOT_FOUND );
        }

        try {
            Files.move( file, ( checkPath( destination ) ).file );

        } catch( IOException e ) {
            throw new DavException( DavServletResponse.SC_FORBIDDEN );
        }
    }
 
开发者ID:openCage,项目名称:niodav,代码行数:18,代码来源:DavPath.java

示例9: copy

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
    public void copy( @Nullable DavResource destination, boolean shallow ) throws DavException {
        // todo folders ?
        // todo shallow
        if( !exists() ) {
            throw new DavException( DavServletResponse.SC_NOT_FOUND );
        }

//        if( !( destination instanceof DavPath ) ) {
//            throw new UnsupportedOperationException( "can't copy to resource outside: " + destination );
//        }

        try {
            Files.copy( file, checkPath( destination ).file );

        } catch( IOException e ) {
            throw new DavException( DavServletResponse.SC_FORBIDDEN );
        }
    }
 
开发者ID:openCage,项目名称:niodav,代码行数:20,代码来源:DavPath.java

示例10: removeMember

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
public void removeMember( @Nullable DavResource member ) throws DavException {
    if( isDirectory ) {
        if( !exists() ) {
            throw new DavException( DavServletResponse.SC_NOT_FOUND );
        }

        DavPath davPath = checkPath( member );

        try {
            Pathss.deleteRecursive( davPath.file );
        } catch( Exception e ) {
            throw new DavException( DavServletResponse.SC_FORBIDDEN, e );
        }

    } else {
        throw new UnsupportedOperationException( "Not implemented" );
    }
}
 
开发者ID:openCage,项目名称:niodav,代码行数:20,代码来源:DavPath.java

示例11: removeMember

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
public void removeMember(DavResource resource) throws DavException {
    final AbstractDavResource cassandraResource = (AbstractDavResource) resource;
    final String path = cassandraResource.getPath();
    if (path.equals("/")) {
        return;
    }

    if (cassandraResource.isCollection()) {
        final List<String> siblings = getCassandraService().getSiblings(path);
        if (!siblings.isEmpty()) {
            throw new DavException(DavServletResponse.SC_CONFLICT, "You cannot delete collection with content");
        }
        getCassandraService().deleteDirectory(path);
    } else {
        getFileStorageService().deleteFile(path);
    }
}
 
开发者ID:Benky,项目名称:webdav-cassandra,代码行数:19,代码来源:DavCollectionResource.java

示例12: createFile

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
public void createFile(final String fullFilePath, final InputContext inputContext) throws DavException {
    if (cassandraDao.getFile(fullFilePath) != null) {
        throw new DavException(DavServletResponse.SC_CONFLICT);
    }
    final String parentDirectory = getParentDirectory(fullFilePath);
    final String fileName = PathUtils.getFileName(fullFilePath);
    final UUID parentId = cassandraDao.getFile(parentDirectory);
    try {
        final UUID fileUUID = cassandraFileDao.createFile(parentId, fileName);
        if (inputContext.hasStream() && inputContext.getContentLength() >= 0) {

            final CountingInputStream countingInputStream = new CountingInputStream(inputContext.getInputStream());
            cassandraFileDao.writeFile(fileUUID, countingInputStream);
            cassandraFileDao.updateFileInfo(fileUUID, countingInputStream.getCount());
        }
    } catch (ConnectionException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:Benky,项目名称:webdav-cassandra,代码行数:20,代码来源:FileStorageService.java

示例13: RegistryResource

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
public RegistryResource(RegistryWebDavContext webdavContext,
		DavResourceLocator locator) throws DavException {
	this.registry = webdavContext.getRegistry();
	if(registry == null){
		throw new DavException(DavServletResponse.SC_FORBIDDEN, "Registry Not Found");
	}
	this.locator = locator;
	this.resourceCache = webdavContext;
	String path = locator.getResourcePath();
	if(path.startsWith("/registry/resourcewebdav")){
		path = path.substring("/registry/resourcewebdav".length());
	}
	if(path.trim().length() == 0){
		path = "/";
	}
	this.path = path.trim();
	//this.session = session;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:19,代码来源:RegistryResource.java

示例14: refreshLock

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
public ActiveLock refreshLock(LockInfo lockInfo, String lockToken) throws DavException{
	if(lockable){
		if (!exists()) {
            throw new DavException(DavServletResponse.SC_NOT_FOUND);
        }
        ActiveLock lock = getLock(lockInfo.getType(), lockInfo.getScope());
        if (lock == null) {
            throw new DavException(DavServletResponse.SC_PRECONDITION_FAILED, "No lock with the given type/scope present on resource " + getResourcePath());
        }
        lock = lockManager.refreshLock(lockInfo, lockToken, this);
        /* since lock has infinite lock (simple) or undefined timeout (jcr)
           return the lock as retrieved from getLock. */
        return lock;
	}else{
		throw new UnsupportedOperationException();	
	}
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:18,代码来源:RegistryResource.java

示例15: alterProperties

import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
public MultiStatusResponse alterProperties(List changeList)
		throws DavException {
        if (!exists()) {
            throw new DavException(DavServletResponse.SC_NOT_FOUND);
        }
        
        MultiStatusResponse msr = new MultiStatusResponse(getHref(), null);
        
        Iterator it = changeList.iterator();
        while(it.hasNext()){
        	DavProperty property = (DavProperty)it.next();
        	try{
        		getUnderlineResource().setProperty(property.getName().getName(), (String)property.getValue());
        		msr.add(property, DavServletResponse.SC_OK);
        	}catch (Exception e) {
        		e.printStackTrace();
        		msr.add(property, DavServletResponse.SC_BAD_REQUEST);
			}
        }
        return msr;
        
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:23,代码来源:RegistryResource.java


注:本文中的org.apache.jackrabbit.webdav.DavServletResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。