Example usage for com.liferay.portal.kernel.exception RemoteOptionsException setRemotePathContext

List of usage examples for com.liferay.portal.kernel.exception RemoteOptionsException setRemotePathContext

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.exception RemoteOptionsException setRemotePathContext.

Prototype

public void setRemotePathContext(String remotePathContext) 

Source Link

Usage

From source file:com.liferay.exportimport.staging.StagingImpl.java

License:Open Source License

@Override
public void validateRemote(long groupId, String remoteAddress, int remotePort, String remotePathContext,
        boolean secureConnection, long remoteGroupId) throws PortalException {

    RemoteOptionsException roe = null;

    if (!Validator.isDomain(remoteAddress) && !Validator.isIPAddress(remoteAddress)) {

        roe = new RemoteOptionsException(RemoteOptionsException.REMOTE_ADDRESS);

        roe.setRemoteAddress(remoteAddress);

        throw roe;
    }//from  w  w w. j  av  a 2s  . c om

    if ((remotePort < 1) || (remotePort > 65535)) {
        roe = new RemoteOptionsException(RemoteOptionsException.REMOTE_PORT);

        roe.setRemotePort(remotePort);

        throw roe;
    }

    if (Validator.isNotNull(remotePathContext) && (!remotePathContext.startsWith(StringPool.FORWARD_SLASH)
            || remotePathContext.endsWith(StringPool.FORWARD_SLASH))) {

        roe = new RemoteOptionsException(RemoteOptionsException.REMOTE_PATH_CONTEXT);

        roe.setRemotePathContext(remotePathContext);

        throw roe;
    }

    validateRemoteGroup(groupId, remoteGroupId, remoteAddress, remotePort, remotePathContext, secureConnection);
}