Package net.sprd.tutorials.common.http

Examples of net.sprd.tutorials.common.http.HttpCallCommand.execute()


        // create design data using xml
        HttpCallCommand createCommand =
                commandFactory.createFileHttpCallCommand(UPLOAD_URL, HttpMethod.POST, null, new File(UPLOAD_XML), null);
        createCommand.setApiKeyProtected(true);
        createCommand.execute();
        if (createCommand.getStatus() >= 400) {
            throw new Exception("Could not create design xml!");
        }
        log.info("XML location is: " + createCommand.getUrl());
View Full Code Here


        log.info("XML location is: " + createCommand.getUrl());

        // get created design xml
        HttpCallCommand getCommand =
                commandFactory.createPlainHttpCallCommand(createCommand.getLocation(), HttpMethod.GET, null);
        getCommand.execute();
        if (createCommand.getStatus() >= 400) {
            throw new Exception("Could not retrieve design xml from " + createCommand.getLocation() + "!");
        }
        String message = (String) getCommand.getOutput();
View Full Code Here

        // upload image
        HttpCallCommand uploadCommand =
                commandFactory.createFileHttpCallCommand(uploadUrl, HttpMethod.PUT, null, new File(UPLOAD_IMAGE), null);
        uploadCommand.setApiKeyProtected(true);
        uploadCommand.execute();
        if (uploadCommand.getStatus() >= 400) {
            log.error(uploadCommand.getErrorMessage());
            throw new Exception("Status above 400 expected but status was " + uploadCommand.getStatus() + "!");
        }
    }
View Full Code Here

        // create design data using xml
        HttpCallCommand createDesignCommand =
                commandFactory.createPlainHttpCallCommand(UPLOAD_URL, HttpMethod.POST, null);
        createDesignCommand.setInput(getXMLData(UPLOAD_XML));
        createDesignCommand.setApiKeyProtected(true);
        createDesignCommand.execute();
        if (createDesignCommand.getStatus() >= 400) {
            throw new Exception("Could not create design xml!");
        }
        log.info("XML location is: " + createDesignCommand.getUrl());
View Full Code Here

        log.info("XML location is: " + createDesignCommand.getUrl());

        // get created design xml
        HttpCallCommand getDesignCommand =
                commandFactory.createPlainHttpCallCommand(createDesignCommand.getLocation(), HttpMethod.GET, null);
        getDesignCommand.execute();
        if (createDesignCommand.getStatus() >= 400) {
            throw new Exception("Could not retrieve design xml from " + createDesignCommand.getLocation() + "!");
        }
        String message = (String) getDesignCommand.getOutput();
View Full Code Here

        // upload image
        HttpCallCommand uploadDesignCommand =
                commandFactory.createFileHttpCallCommand(uploadUrl, HttpMethod.PUT, null, new File(UPLOAD_IMAGE), null);
        uploadDesignCommand.setApiKeyProtected(true);
        uploadDesignCommand.execute();
        if (uploadDesignCommand.getStatus() >= 400) {
            log.error(uploadDesignCommand.getErrorMessage());
            throw new Exception("Status above 400 expected but status was " + uploadDesignCommand.getStatus() + "!");
        }
View Full Code Here

        String productData = getXMLData(PRODUCT_XML);
        // use id from fetched design xml here -> my solution is only a hack
        productData = productData.replace("THE_DESIGN_ID", "u" + uploadUrl.substring(uploadUrl.lastIndexOf('/') + 1));
        createProductCommand.setInput(productData);
        createProductCommand.setApiKeyProtected(true);
        createProductCommand.execute();
        if (createProductCommand.getStatus() >= 400) {
            throw new Exception("Could not create product xml!");
        }
        log.info("XML location is: " + createProductCommand.getLocation());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.