Example usage for com.liferay.portal.util PropsValues WEBDAV_SERVLET_HTTPS_REQUIRED

List of usage examples for com.liferay.portal.util PropsValues WEBDAV_SERVLET_HTTPS_REQUIRED

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues WEBDAV_SERVLET_HTTPS_REQUIRED.

Prototype

boolean WEBDAV_SERVLET_HTTPS_REQUIRED

To view the source code for com.liferay.portal.util PropsValues WEBDAV_SERVLET_HTTPS_REQUIRED.

Click Source Link

Usage

From source file:com.liferay.dynamic.data.mapping.model.impl.DDMStructureImpl.java

License:Open Source License

/**
 * Returns the WebDAV URL to access the structure.
 *
 * @param  themeDisplay the theme display needed to build the URL. It can
 *         set HTTPS access, the server name, the server port, the path
 *         context, and the scope group.
 * @param  webDAVToken the WebDAV token for the URL
 * @return the WebDAV URL//from ww w  . ja  v  a2  s .co  m
 */
@Override
public String getWebDavURL(ThemeDisplay themeDisplay, String webDAVToken) {
    StringBundler sb = new StringBundler(11);

    boolean secure = false;

    if (themeDisplay.isSecure() || PropsValues.WEBDAV_SERVLET_HTTPS_REQUIRED) {

        secure = true;
    }

    String portalURL = PortalUtil.getPortalURL(themeDisplay.getServerName(), themeDisplay.getServerPort(),
            secure);

    sb.append(portalURL);

    sb.append(themeDisplay.getPathContext());
    sb.append(StringPool.SLASH);
    sb.append("webdav");

    Group group = themeDisplay.getScopeGroup();

    sb.append(group.getFriendlyURL());

    sb.append(StringPool.SLASH);
    sb.append(webDAVToken);
    sb.append(StringPool.SLASH);
    sb.append("Structures");
    sb.append(StringPool.SLASH);
    sb.append(getStructureId());

    return sb.toString();
}

From source file:com.liferay.dynamic.data.mapping.model.impl.DDMTemplateImpl.java

License:Open Source License

/**
 * Returns the WebDAV URL to access the template.
 *
 * @param  themeDisplay the theme display needed to build the URL. It can
 *         set HTTPS access, the server name, the server port, the path
 *         context, and the scope group.
 * @param  webDAVToken the WebDAV token for the URL
 * @return the WebDAV URL/*  w  w w.  j a  v a2 s .c  o m*/
 */
@Override
public String getWebDavURL(ThemeDisplay themeDisplay, String webDAVToken) {
    StringBundler sb = new StringBundler(11);

    boolean secure = false;

    if (themeDisplay.isSecure() || PropsValues.WEBDAV_SERVLET_HTTPS_REQUIRED) {

        secure = true;
    }

    String portalURL = PortalUtil.getPortalURL(themeDisplay.getServerName(), themeDisplay.getServerPort(),
            secure);

    sb.append(portalURL);

    sb.append(themeDisplay.getPathContext());
    sb.append(StringPool.SLASH);
    sb.append("webdav");

    Group group = themeDisplay.getScopeGroup();

    sb.append(group.getFriendlyURL());

    sb.append(StringPool.SLASH);
    sb.append(webDAVToken);
    sb.append(StringPool.SLASH);
    sb.append("Templates");
    sb.append(StringPool.SLASH);
    sb.append(getTemplateId());

    return sb.toString();
}

From source file:com.liferay.portlet.documentlibrary.util.DLImpl.java

License:Open Source License

@Override
public String getWebDavURL(ThemeDisplay themeDisplay, Folder folder, FileEntry fileEntry,
        boolean manualCheckInRequired, boolean openDocumentUrl) throws PortalException {

    StringBundler webDavURL = new StringBundler(8);

    boolean secure = false;

    if (themeDisplay.isSecure() || PropsValues.WEBDAV_SERVLET_HTTPS_REQUIRED) {

        secure = true;/*from   w ww . j ava 2  s . c  om*/
    }

    String portalURL = PortalUtil.getPortalURL(themeDisplay.getServerName(), themeDisplay.getServerPort(),
            secure);

    webDavURL.append(portalURL);

    webDavURL.append(themeDisplay.getPathContext());
    webDavURL.append("/webdav");

    if (manualCheckInRequired) {
        webDavURL.append(MANUAL_CHECK_IN_REQUIRED_PATH);
    }

    String fileEntryFileName = null;

    Group group = null;

    if (fileEntry != null) {
        fileEntryFileName = HtmlUtil.unescape(fileEntry.getFileName());

        group = GroupLocalServiceUtil.getGroup(fileEntry.getGroupId());
    } else {
        group = themeDisplay.getScopeGroup();
    }

    webDavURL.append(group.getFriendlyURL());
    webDavURL.append("/document_library");

    StringBuilder sb = new StringBuilder();

    if ((folder != null) && (folder.getFolderId() != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) {

        Folder curFolder = folder;

        while (true) {
            sb.insert(0, HttpUtil.encodeURL(curFolder.getName(), true));
            sb.insert(0, StringPool.SLASH);

            if (curFolder.getParentFolderId() == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {

                break;
            }

            curFolder = DLAppLocalServiceUtil.getFolder(curFolder.getParentFolderId());
        }
    }

    if (fileEntry != null) {
        sb.append(StringPool.SLASH);
        sb.append(HttpUtil.encodeURL(fileEntryFileName, true));
    }

    webDavURL.append(sb.toString());

    return webDavURL.toString();
}