本文整理汇总了Java中org.apache.jackrabbit.webdav.DavServletResponse类的典型用法代码示例。如果您正苦于以下问题:Java DavServletResponse类的具体用法?Java DavServletResponse怎么用?Java DavServletResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DavServletResponse类属于org.apache.jackrabbit.webdav包,在下文中一共展示了DavServletResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: testDeleteNonExistantResourceShould404
import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Test
public void testDeleteNonExistantResourceShould404()
throws Exception
{
Path dir = baseDir.resolve( "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:apache,项目名称:archiva,代码行数:17,代码来源:DavResourceTest.java
示例17: setHeaders
import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
private void setHeaders( DavServletResponse response, DavResourceLocator locator, DavResource resource,
boolean group )
{
// [MRM-503] - Metadata file need Pragma:no-cache response
// header.
if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || ( resource instanceof ArchivaDavResource
&& ( ArchivaDavResource.class.cast( resource ).getLocalResource().isDirectory() ) ) )
{
response.setHeader( "Pragma", "no-cache" );
response.setHeader( "Cache-Control", "no-cache" );
response.setDateHeader( "Last-Modified", new Date().getTime() );
}
// if the resource is a directory don't cache it as new groupId deployed will be available
// without need of refreshing browser
else if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || (
resource instanceof ArchivaVirtualDavResource && ( new File(
ArchivaVirtualDavResource.class.cast( resource ).getLogicalResource() ).isDirectory() ) ) )
{
response.setHeader( "Pragma", "no-cache" );
response.setHeader( "Cache-Control", "no-cache" );
response.setDateHeader( "Last-Modified", new Date().getTime() );
}
else if ( group )
{
if ( resource instanceof ArchivaVirtualDavResource )
{
//MRM-1854 here we have a directory so force "Last-Modified"
response.setDateHeader( "Last-Modified", new Date().getTime() );
}
}
else
{
// We need to specify this so connecting wagons can work correctly
response.setDateHeader( "Last-Modified", resource.getModificationTime() );
}
// TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots)
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:38,代码来源:ArchivaDavResourceFactory.java
示例18: copy
import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
public void copy( DavResource destination, boolean shallow )
throws DavException
{
if ( !exists() )
{
throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource to copy does not exist." );
}
if ( shallow && isCollection() )
{
throw new DavException( DavServletResponse.SC_FORBIDDEN, "Unable to perform shallow copy for collection" );
}
try
{
ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( destination );
if ( isCollection() )
{
FileUtils.copyDirectory( getLocalResource(), resource.getLocalResource() );
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_DIRECTORY );
}
else
{
FileUtils.copyFile( getLocalResource(), resource.getLocalResource() );
triggerAuditEvent( remoteAddr, locator.getRepositoryId(), logicalResource, AuditEvent.COPY_FILE );
}
log.debug( "{}{}' copied to '{}' (current user '{)')", ( isCollection() ? "Directory '" : "File '" ),
getLocalResource().getName(), destination, this.principal );
}
catch ( IOException e )
{
throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
}
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:40,代码来源:ArchivaDavResource.java
示例19: createResource
import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
public DavResource createResource( DavResourceLocator locator, DavServletRequest request,
DavServletResponse response )
throws DavException
{
throw new UnsupportedOperationException( "Not supported yet." );
}
开发者ID:ruikom,项目名称:apache-archiva,代码行数:8,代码来源:DavResourceTest.java
示例20: alterProperties
import org.apache.jackrabbit.webdav.DavServletResponse; //导入依赖的package包/类
@Override
public
@Nullable
MultiStatusResponse alterProperties( @Nullable List<? extends PropEntry> changeList ) throws DavException {
if( !exists() ) {
throw new DavException( DavServletResponse.SC_NOT_FOUND );
}
MultiStatusResponse response = new MultiStatusResponse( getHref(), null );
/*
* loop over list of properties/names that were successfully altered
* and add them to the multistatus response respecting the result of the
* complete action. in case of failure set the status to 'failed-dependency'
* in order to indicate, that altering those names/properties would
* have succeeded, if no other error occurred.
*/
for( PropEntry propEntry : n1( changeList ) ) {
int statusCode = DavServletResponse.SC_OK;
if( propEntry instanceof DavProperty ) {
DavProperty<?> dprop = (DavProperty<?>) propEntry;
if( dprop.getName().equals( new DefaultDavProperty<>( DavPropertyName.GETLASTMODIFIED, "1" ).getName() ) ) {
Filess.setLastModifiedTime( file, FileTime.fromMillis( LocalDateTime.parse( (String) dprop.getValue(), DateTimeFormatter.RFC_1123_DATE_TIME ).toEpochSecond( ZoneOffset.ofTotalSeconds( 0 ) ) * 1000 ) );
}
// response.add( ( dprop ).getName(), statusCode );
response.add( dprop );
} else {
response.add( (DavPropertyName) propEntry, statusCode );
}
}
return response;
}
开发者ID:openCage,项目名称:niodav,代码行数:33,代码来源:DavPath.java
注:本文中的org.apache.jackrabbit.webdav.DavServletResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论