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

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

Introduction

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

Prototype

String TEXT_CSV

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

Click Source Link

Usage

From source file:com.rivetlogic.event.portlet.EventsManagementPortlet.java

License:Open Source License

private boolean checkIsCSV(ActionRequest request, InputStream inputStream, String fileName) {
    boolean isCSV = false;

    if (Validator.isNotNull(inputStream) && Validator.isNotNull(fileName)) {
        String mimeType = MimeTypesUtil.getContentType(inputStream, fileName);

        if (_log.isDebugEnabled())
            _log.debug(DEBUG_MESSAGE_MIME_TYPE + mimeType);

        if (mimeType.equals(ContentTypes.TEXT_CSV) || mimeType.equals(ContentTypes.TEXT_CSV_UTF8)) {

            isCSV = true;/*from  w w  w .  j  a  v a 2s.co m*/

        } else {
            SessionErrors.add(request, ERROR_INVALID_CSV);
        }
    }

    return isCSV;
}