Package slash.navigation.rest.exception

Examples of slash.navigation.rest.exception.UnAuthorizedException


        Post request = new Post(getUsersUrl(), credentials);
        request.addFile("file", xml.getBytes());

        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot add user " + userName, getUsersUrl());
        if (request.isForbidden())
            throw new DuplicateNameException("Cannot add user " + userName, getUsersUrl());
        if (!request.isSuccessful())
            throw new IOException("POST on " + getUsersUrl() + " with payload " + userName + "," + firstName + "," + lastName + "," + email + " not successful: " + result);
        return request.getLocation();
View Full Code Here


        if (file != null)
            request.addFile("file", file);

        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot send error report " + (file != null ? ", file " + file.getAbsolutePath() : ""), getErrorReportUrl());
        if (!request.isSuccessful())
            throw new IOException("POST on " + getErrorReportUrl() + " with log " + logOutput.length() + " characters" +
                    ", description \"" + description + "\", file " + file + " not successful: " + result);
        return request.getLocation();
    }
View Full Code Here

        Post request = new Post(getDataSourcesUrl(), credentials);
        request.addFile("file", xml.getBytes());

        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot send checksums ", getDataSourcesUrl());
        if (!request.isSuccessful())
            throw new IOException("POST on " + getDataSourcesUrl() + " for data source " + dataSource +
                    " not successful: " + result);

        log.info(format("Sent checksum for %s filtered with %s with result:\n%s", fileAndChecksums, printArrayToDialogString(filterUrls), result));
View Full Code Here

    String addCategory(String categoryUrl, String name) throws IOException {
        Post request = prepareAddCategory(categoryUrl, name);
        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot add category " + name, categoryUrl);
        if (request.isNotFound())
            throw new NotFoundException("Cannot add category " + name, categoryUrl);
        if (request.isForbidden())
            throw new DuplicateNameException("Cannot add category " + name, categoryUrl);
        if (!request.isSuccessful())
View Full Code Here

    String updateCategory(String categoryUrl, String parentUrl, String name) throws IOException {
        Put request = prepareUpdateCategory(categoryUrl, parentUrl, name);
        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot update category to " + name, categoryUrl);
        if (request.isNotFound())
            throw new NotFoundException("Cannot update category to " + name, categoryUrl);
        if (request.isForbidden())
            throw new NotOwnerException("Cannot update category to " + name, categoryUrl);
        if (!request.isSuccessful())
View Full Code Here

    void deleteCategory(String categoryUrl) throws IOException {
        Delete request = prepareDelete(categoryUrl);
        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot delete category", categoryUrl);
        if (request.isNotFound())
            throw new NotFoundException("Cannot delete category", categoryUrl);
        if (request.isForbidden())
            throw new NotOwnerException("Cannot delete category", categoryUrl);
        if (!request.isSuccessful())
View Full Code Here

    public String addFile(File file) throws IOException {
        Post request = prepareAddFile(file);
        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot add file " + file.getAbsolutePath(), getFilesUrl());
        if (request.isForbidden())
            throw new DuplicateNameException("Cannot add file " + file.getAbsolutePath(), getFilesUrl());
        if (!request.isSuccessful())
            throw new IOException("POST on " + getFilesUrl() + " with file " + file.getAbsolutePath() + " not successful: " + result);
        return request.getLocation();
View Full Code Here

        }

        Delete request = prepareDelete(fileUrl);
        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot delete file", fileUrl);
        if (request.isNotFound())
            throw new NotFoundException("Cannot delete file", fileUrl);
        if (request.isForbidden())
            throw new NotOwnerException("Cannot delete file", fileUrl);
        if (!request.isSuccessful())
View Full Code Here

    public String addRoute(String categoryUrl, String description, String fileUrl) throws IOException {
        Post request = prepareAddRoute(categoryUrl, description, fileUrl);
        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot add route " + description, getRoutesUrl());
        if (request.isForbidden())
            throw new NotOwnerException("Cannot add route " + description, getRoutesUrl());
        if (!request.isSuccessful())
            throw new IOException("POST on " + getRoutesUrl() + " with route " + description + "," + categoryUrl + "," + fileUrl + " not successful: " + result);
        return request.getLocation();
View Full Code Here

    public void updateRoute(String categoryUrl, String routeUrl, String description, String fileUrl) throws IOException {
        Put request = prepareUpdateRoute(categoryUrl, routeUrl, description, fileUrl);
        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot update route to " + description, routeUrl);
        if (request.isNotFound())
            throw new NotFoundException("Cannot update route to " + description, routeUrl);
        if (request.isForbidden())
            throw new NotOwnerException("Cannot update route to " + description, routeUrl);
        if (!request.isSuccessful())
View Full Code Here

TOP

Related Classes of slash.navigation.rest.exception.UnAuthorizedException

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.