Package net.sprd.sampleapps.common.http

Examples of net.sprd.sampleapps.common.http.HttpCallCommand


        BasketDTO basket = objectFactory.createBasketDTO();
        basket.setToken(UUID.randomUUID().toString());
        /*Reference shopRef = objectFactory.createReference();
        shopRef.setId(shop.getId());
        basket.setShop(shopRef);*/
        HttpCallCommand command = factory.createJaxbHttpCallCommand(shop.getBaskets().getHref(), HttpMethod.POST, null);
        command.setApiKeyProtected(true);
        command.setInput(objectFactory.createBasket(basket));
        command.execute();
        log.info(command.getLocation());
        log.info("" + command.getStatus());
        log.info(command.getErrorMessage());
        if (command.getStatus() != 201)
            throw new IllegalArgumentException("Could not create Basket!");
        log.info("Basket location is: " + command.getLocation());
        return getBasket(command.getLocation().substring(command.getLocation().lastIndexOf("/") + 1));
    }
View Full Code Here


        log.info("Basket location is: " + command.getLocation());
        return getBasket(command.getLocation().substring(command.getLocation().lastIndexOf("/") + 1));
    }

    public BasketDTO getBasket(String basketId) {
        HttpCallCommand command = factory.createJaxbHttpCallCommand(shop.getBaskets().getHref() + "/" + basketId, HttpMethod.GET, null);
        command.setApiKeyProtected(true);
        command.execute();
        if (command.getStatus() != 200)
            throw new IllegalArgumentException("Could not retrieve basket!");

        return (BasketDTO) ((JAXBElement) command.getOutput()).getValue();
    }
View Full Code Here

        return (BasketDTO) ((JAXBElement) command.getOutput()).getValue();
    }

    public void updateBasket(BasketDTO basket) {
        HttpCallCommand command = factory.createJaxbHttpCallCommand(shop.getBaskets().getHref() + "/" + basket.getId(), HttpMethod.PUT, null);
        command.setApiKeyProtected(true);
        command.setInput(objectFactory.createBasket(basket));
        command.execute();
        if (command.getStatus() != 200)
            throw new IllegalArgumentException("Could not create Basket!");
    }
View Full Code Here

        if (command.getStatus() != 200)
            throw new IllegalArgumentException("Could not create Basket!");
    }

    public String getBasketCheckoutUrl(String id) {
        HttpCallCommand command =
                factory.createJaxbHttpCallCommand(shop.getBaskets().getHref() + "/" + id + "/checkout", HttpMethod.GET, null);
        command.setApiKeyProtected(true);
        command.execute();
        if (command.getStatus() != 200)
            throw new IllegalArgumentException("Could not retrieve checkout reference!");

        Reference reference = (Reference) ((JAXBElement) command.getOutput()).getValue();
        return reference.getHref();
    }
View Full Code Here

TOP

Related Classes of net.sprd.sampleapps.common.http.HttpCallCommand

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.