Example usage for com.liferay.portal.kernel.util FileUtil stripExtension

List of usage examples for com.liferay.portal.kernel.util FileUtil stripExtension

Introduction

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

Prototype

public static String stripExtension(String fileName) 

Source Link

Usage

From source file:com.liferay.resourcesimporter.util.FileSystemImporter.java

License:Open Source License

protected String getJournalId(String fileName) {
    String id = FileUtil.stripExtension(fileName);

    id = StringUtil.toUpperCase(id);/*  w  w  w  .j a  va  2 s .c om*/

    return StringUtil.replace(id, StringPool.SPACE, StringPool.DASH);
}

From source file:com.liferay.resourcesimporter.util.ResourceImporter.java

License:Open Source License

@Override
protected void addDDLStructures(String dirName) throws Exception {
    Set<String> resourcePaths = servletContext.getResourcePaths(resourcesDir.concat(dirName));

    if (resourcePaths == null) {
        return;//from  www  .  java  2  s  .c om
    }

    for (String resourcePath : resourcePaths) {
        File file = new File(resourcePath);

        URL url = servletContext.getResource(resourcePath);

        URLConnection urlConnection = url.openConnection();

        addDDMStructures(FileUtil.stripExtension(file.getName()), urlConnection.getInputStream());
    }
}

From source file:com.liferay.wiki.web.internal.portlet.action.GetPageAttachmentAction.java

License:Open Source License

protected void getFile(long nodeId, String title, String fileName, int status, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

    WikiPage wikiPage = _wikiPageService.getPage(nodeId, title);

    FileEntry fileEntry = PortletFileRepositoryUtil.getPortletFileEntry(wikiPage.getGroupId(),
            wikiPage.getAttachmentsFolderId(), fileName);

    if ((status != WorkflowConstants.STATUS_IN_TRASH) && fileEntry.isInTrash()) {

        return;/*from   w  ww  .j a v  a  2 s .  com*/
    }

    if (fileEntry.isInTrash()) {
        fileName = TrashUtil.getOriginalTitle(fileEntry.getTitle());
    }

    InputStream is = fileEntry.getContentStream();

    FlashMagicBytesUtil.Result flashMagicBytesUtilResult = FlashMagicBytesUtil.check(is);

    if (flashMagicBytesUtilResult.isFlash()) {
        fileName = FileUtil.stripExtension(fileName) + ".swf";
    }

    is = flashMagicBytesUtilResult.getInputStream();

    ServletResponseUtil.sendFile(request, response, fileName, is, fileEntry.getSize(), fileEntry.getMimeType());
}