Java Code Examples for org.apache.jackrabbit.webdav.DavException#printStackTrace()

The following examples show how to use org.apache.jackrabbit.webdav.DavException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VersionControlledResourceImpl.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Returns the {@link javax.jcr.version.VersionHistory} associated with the
 * repository node. If the node is not versionable an exception is thrown.
 * 
 * @return the {@link VersionHistoryResource} associated with this resource.
 * @see org.apache.jackrabbit.webdav.version.VersionControlledResource#getVersionHistory()
 * @see javax.jcr.Node#getVersionHistory()
 */
public VersionHistoryResource getVersionHistory() {

	DavResourceLocator loc = getLocatorFromResource(resource);

	try {
		return new VersionHistoryResourceImpl(loc, factory, session, config, resource);
	} catch (DavException e) {
		e.printStackTrace();
	}

	throw new RuntimeException("");

}
 
Example 2
Source File: ArchivaDavResourceFactoryTest.java    From archiva with Apache License 2.0 4 votes vote down vote up
@Test
public void testRequestArtifactMetadataThreePartsRepoHasDefaultLayout()
    throws Exception
{
    // should fetch metadata 
    DavResourceLocator locator =
        new ArchivaDavResourceLocator( "", "/repository/" + INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml",
                                       INTERNAL_REPO, new ArchivaDavLocatorFactory() );

    ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );

    // use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
    MavenRepositoryRequestInfo repoRequest = new MavenRepositoryRequestInfo(internalRepo.getRepository() );

    try
    {
        archivaConfigurationControl.reset();

        expect( request.getMethod() ).andReturn( "GET" ).times( 4 );

        expect( request.getRemoteAddr() ).andReturn( "http://localhost:8080" ).times( 3 );

        expect( request.getContextPath() ).andReturn( "" ).times( 1 );

        expect( request.getDavSession() ).andReturn( new ArchivaDavSession() ).times( 2 );

        expect( request.getRequestURI() ).andReturn( "http://localhost:8080/archiva/repository/" + INTERNAL_REPO + "/eclipse/jdtcore/maven-metadata.xml" );
        response.setHeader( "Pragma", "no-cache" );

        expectLastCall();

        response.setHeader( "Cache-Control", "no-cache" );

        expectLastCall();

        response.setDateHeader( eq("Last-Modified"), anyLong() );
        expectLastCall();

        archivaConfigurationControl.replay();
        repoContentFactoryControl.replay();
        requestControl.replay();
        responseControl.replay();

        resourceFactory.createResource( locator, request, response );

        archivaConfigurationControl.verify();
        repoContentFactoryControl.verify();
        requestControl.verify();
        responseControl.verify();
    }
    catch ( DavException e )
    {
        e.printStackTrace();
        fail( "A DavException should not have been thrown! "+e.getMessage() );
    }
}