Package com.bradmcevoy.http.exceptions

Examples of com.bradmcevoy.http.exceptions.ConflictException


            } else {
                log.warn("not found or not CollectionResource: " + r);
            }
            if( target == null ) {
                log.warn( "No PutableResource with that path: " + sFolder );
                throw new ConflictException( target );
            }
            try {
                if( command.equals( "GetFolders" ) ) {
                    processGetFoldersCommand( false );
                } else if( command.equals( "GetFoldersAndFiles" ) ) {
                    processGetFoldersCommand( true );
                } else if( command.equals( "CreateFolder" ) ) {
                    processCreateFolderCommand();
                } else if( command.equals( "FileUpload" ) ) {
                    processUploadFolderCommand();
                } else {
                    log.warn( "Unknown command: " + command );
                    throw new ConflictException( target );
                }
            } finally {
                writer.flush();
            }
        }
View Full Code Here


            if( r instanceof PutableResource ) {
                target = (PutableResource) r;
            }
            if( target == null ) {
                log.warn( "No putable folder with that path: " + sFolder );
                throw new ConflictException( target );
            }

            String name = f.getName(); //utilFile().sanitiseName(f.getName());
            log.debug( "processFileUpload: " + name );
            boolean isFirst = true;
            while( target.child( name ) != null ) {
                name = FileUtils.incrementFileName( name, isFirst );
                newName = name;
                isFirst = false;
            }

            PutableResource putable;
            if( target instanceof PutableResource) {
                putable = (PutableResource) target;
            } else {
                log.warn("The collection is not putable: " + r.getName() + " - " + r.getClass().getCanonicalName());
                throw new ConflictException( r );
            }

            long size = f.getSize();
            try {
                Resource newRes = putable.createNew( name, f.getInputStream(), size, null );
View Full Code Here

                    log.trace("file exists, and overwrite parameters is set, so allow overwrite: " + initialName);
                    return initialName;
                } else {
                    if (!autoname) {
                        log.warn("Conflict: Can't create resource with name " + initialName + " because it already exists. To rename automatically use request parameter: " + PARAM_AUTONAME + ", or to overwrite use " + PARAM_OVERWRITE);
                        throw new ConflictException(this);
                    } else {
                        log.trace("file exists and autoname is set, so will find acceptable name");
                    }
                }
            }
View Full Code Here

        } else {
            if (i < 100) {
                return findAcceptableName(baseName, ext, i + 1);
            } else {
                log.warn("Too many files with similar names: " + candidateName);
                throw new ConflictException(this);
            }
        }
    }
View Full Code Here

                    if (rChild instanceof DeletableResource) {
                        DeletableResource rChildDel = (DeletableResource) rChild;
                        delete(rChildDel);
                    } else {
                        log.warn( "Couldnt delete child resource: " + rChild.getName() + " of type; " + rChild.getClass().getName() + " because it does not implement: " + DeletableResource.class.getCanonicalName());
                        throw new ConflictException( rChild );
                    }
                }
            }
            r.delete();
           
View Full Code Here

        XmldbURI destCollection = ((MiltonCollection) rDest).getXmldbUri();
        try {
            existDocument.resourceCopyMove(destCollection, newName, Mode.MOVE);

        } catch (EXistException ex) {
            throw new ConflictException(this);
        }
    }
View Full Code Here

            LOG.debug(ex.getMessage());
            throw new NotAuthorizedException(this);

        } catch (CollectionExistsException | EXistException ex) {
            LOG.debug(ex.getMessage());
            throw new ConflictException(this);

        }

        return collection;
    }
View Full Code Here

            resource = new MiltonDocument(host, resourceURI, brokerPool, subject);

        } catch (PermissionDeniedException | CollectionDoesNotExistException | IOException e) {
            LOG.debug(e.getMessage());
            throw new ConflictException(this);

        }
        return resource;
    }
View Full Code Here

        XmldbURI destCollection = ((MiltonCollection) rDest).getXmldbUri();
        try {
            existCollection.resourceCopyMove(destCollection, newName, Mode.MOVE);

        } catch (EXistException ex) {
            throw new ConflictException(this);
        }
    }
View Full Code Here

      V7File child = file.createChild(inputStream, newName, contentType);

      return new FileResource(child, factory);
    }
    if (existingChild instanceof FolderResource) {
      throw new ConflictException(existingChild,
          "already exists and is a folder");
    }

    if (length != null)
      ((FileResource) existingChild).file.setContent(inputStream, length,
View Full Code Here

TOP

Related Classes of com.bradmcevoy.http.exceptions.ConflictException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.