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


Java DavException类代码示例

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


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

示例1: checkLocatorIsInstanceOfRepositoryLocator

import org.apache.jackrabbit.webdav.DavException; //导入依赖的package包/类
private ArchivaDavResourceLocator checkLocatorIsInstanceOfRepositoryLocator( DavResourceLocator locator )
    throws DavException
{
    if ( !( locator instanceof ArchivaDavResourceLocator ) )
    {
        throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                                "Locator does not implement RepositoryLocator" );
    }

    // Hidden paths
    if ( locator.getResourcePath().startsWith( ArchivaDavResource.HIDDEN_PATH_PREFIX ) )
    {
        throw new DavException( HttpServletResponse.SC_NOT_FOUND );
    }

    ArchivaDavResourceLocator archivaLocator = (ArchivaDavResourceLocator) locator;

    // MRM-419 - Windows Webdav support. Should not 404 if there is no content.
    if ( StringUtils.isEmpty( archivaLocator.getRepositoryId() ) )
    {
        throw new DavException( HttpServletResponse.SC_NO_CONTENT );
    }
    return archivaLocator;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:25,代码来源:ArchivaDavResourceFactory.java

示例2: getCollection

import org.apache.jackrabbit.webdav.DavException; //导入依赖的package包/类
@Override
public DavResource getCollection()
{
    DavResource parent = null;
    if ( getResourcePath() != null && !getResourcePath().equals( "/" ) )
    {
        String parentPath = Text.getRelativeParent( getResourcePath(), 1 );
        if ( parentPath.equals( "" ) )
        {
            parentPath = "/";
        }
        DavResourceLocator parentloc =
            locator.getFactory().createResourceLocator( locator.getPrefix(), parentPath );
        try
        {
            // go back to ArchivaDavResourceFactory!
            parent = factory.createResource( parentloc, null );
        }
        catch ( DavException e )
        {
            // should not occur
        }
    }
    return parent;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:26,代码来源:ArchivaVirtualDavResource.java

示例3: getCollection

import org.apache.jackrabbit.webdav.DavException; //导入依赖的package包/类
@Override
public DavResource getCollection()
{
    DavResource parent = null;
    if ( getResourcePath() != null && !getResourcePath().equals( "/" ) )
    {
        String parentPath = Text.getRelativeParent( getResourcePath(), 1 );
        if ( parentPath.equals( "" ) )
        {
            parentPath = "/";
        }
        DavResourceLocator parentloc =
            locator.getFactory().createResourceLocator( locator.getPrefix(), parentPath );
        try
        {
            parent = factory.createResource( parentloc, session );
        }
        catch ( DavException e )
        {
            // should not occur
        }
    }
    return parent;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:25,代码来源:ArchivaDavResource.java

示例4: refreshLock

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例5: unlock

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例6: testDeleteNonExistantResourceShould404

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例7: testRefreshLockThrowsExceptionIfNoLockIsPresent

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例8: testUnlockThrowsDavExceptionIfNotLocked

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例9: testUnlockThrowsDavExceptionIfResourceNotLocked

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例10: internalSyncItems

import org.apache.jackrabbit.webdav.DavException; //导入依赖的package包/类
@Override
DavMethodBase internalSyncItems() throws IOException, DavException {
	//Calendar already inited.

	DavPropertyNameSet properties = new DavPropertyNameSet();
	properties.add(DNAME_GETCTAG);

	PropFindMethod method = new PropFindMethod(path, properties, CalDAVConstants.DEPTH_0);
	client.executeMethod(method);

	if (method.succeeded()) {
		for (MultiStatusResponse response : method.getResponseBodyAsMultiStatus().getResponses()) {
			DavPropertySet set = response.getProperties(SC_OK);
			String ctag = AppointmentManager.getTokenFromProperty(set.get(DNAME_GETCTAG));

			if (ctag != null && !ctag.equals(calendar.getToken())) {
				EtagsHandler etagsHandler = new EtagsHandler(path, calendar, client, appointmentDao, utils);
				etagsHandler.syncItems();
				calendar.setToken(ctag);
			}
		}
	} else {
		log.error("Error executing PROPFIND Method, with status Code: {}", method.getStatusCode());
	}
	return method;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:27,代码来源:CtagHandler.java

示例11: move

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例12: copy

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例13: addMember

import org.apache.jackrabbit.webdav.DavException; //导入依赖的package包/类
@Override
public void addMember( @Nullable DavResource davResource, @Nullable InputContext inputContext ) throws DavException {
    if( !isDirectory ) {
        throw new UnsupportedOperationException( "Not implemented: addMember to file" );
    }

    DavPath davPath = checkPath( davResource );

    //DavSession session = davPath.getSession();

    if( inputContext != null && inputContext.hasStream() ) { //session.isPutRequest() ) { // todo check
        createFile( n1( inputContext ), davPath );
    } else {
        createDir( davPath );

    }

}
 
开发者ID:openCage,项目名称:niodav,代码行数:19,代码来源:DavPath.java

示例14: removeMember

import org.apache.jackrabbit.webdav.DavException; //导入依赖的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

示例15: delete

import org.apache.jackrabbit.webdav.DavException; //导入依赖的package包/类
/**
 * 
 * {@inheritDoc}
 */
public void delete(DavRequest request,
                   DavResponse response,
                   WebDavResource resource)
    throws CosmoDavException, IOException {
    if (! resource.exists()){
        throw new NotFoundException();
    }
    checkNoRequestBody(request);

    int depth = getDepth(request);
    if (depth != DEPTH_INFINITY){
        throw new BadRequestException("Depth for DELETE must be infinity");
    }

    try {
        resource.getParent().removeMember(resource);
        response.setStatus(204);
    } catch (DavException e) {
        throw new CosmoDavException(e);
    }
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:26,代码来源:BaseProvider.java


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