Example usage for com.liferay.portal.kernel.util ContentTypes APPLICATION_ATOM_XML

List of usage examples for com.liferay.portal.kernel.util ContentTypes APPLICATION_ATOM_XML

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util ContentTypes APPLICATION_ATOM_XML.

Prototype

String APPLICATION_ATOM_XML

To view the source code for com.liferay.portal.kernel.util ContentTypes APPLICATION_ATOM_XML.

Click Source Link

Usage

From source file:com.liferay.google.apps.connector.GHelperUtil.java

License:Open Source License

public static void submitAdd(GAuthenticator gAuthenticator, String url, Document document)
        throws GoogleAppsException {

    try {//from  w w  w . j  av  a  2s . com
        String body = document.formattedString();

        if (_log.isInfoEnabled()) {
            _log.info("submitAdd request url " + url);
            _log.info("submitAdd request body " + body);
        }

        Http.Options options = _getOptions(gAuthenticator);

        options.setBody(body, ContentTypes.APPLICATION_ATOM_XML, StringPool.UTF8);
        options.setLocation(url);
        options.setPost(true);

        String response = HttpUtil.URLtoString(options);

        if (_log.isInfoEnabled()) {
            _log.info("submitAdd response " + response);
        }
    } catch (IOException ioe) {
        throw new GoogleAppsException(ioe);
    }
}

From source file:com.liferay.google.apps.connector.GHelperUtil.java

License:Open Source License

public static void submitUpdate(GAuthenticator gAuthenticator, String url, Document document)
        throws GoogleAppsException {

    try {/*from  ww w  .j ava 2s.co m*/
        String body = document.formattedString();

        if (_log.isInfoEnabled()) {
            _log.info("submitUpdate request url " + url);
            _log.info("submitUpdate request body " + body);
        }

        Http.Options options = _getOptions(gAuthenticator);

        options.setBody(body, ContentTypes.APPLICATION_ATOM_XML, StringPool.UTF8);
        options.setLocation(url);
        options.setPut(true);

        String response = HttpUtil.URLtoString(options);

        if (_log.isInfoEnabled()) {
            _log.info("submitUpdate response " + response);
        }
    } catch (IOException ioe) {
        throw new GoogleAppsException(ioe);
    }
}