trying to solve [Support #16430]

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@178839 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-04-04 13:28:47 +00:00
parent 9add4d4413
commit 6bb6bfcc3f
4 changed files with 232 additions and 62 deletions

View File

@ -1,9 +1,12 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-25-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-25-0"
date="2019-02-04">
<Change>Updated to StorageHub [ticket: #13226]</Change>
<Change>[Support #16430] fixed</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-24-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-24-1"
date="${buildDate}">
<Change>Updated regular expression to validate Folder and File names
</Change>
@ -13,7 +16,8 @@
<Change>[Task #13106] Provide public links for versioned files
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-23-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-23-0"
date="${buildDate}">
<Change>[Task #12521] Migrate the tree view
</Change>
@ -39,7 +43,8 @@
<Change>[Incident #12922] Workspace get link not working
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-22-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-22-0"
date="2018-09-14">
<Change>[Task #12489] Migrate delete operation to StorageHub
</Change>
@ -47,65 +52,76 @@
Switchboard service discovery
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-21-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-21-1"
date="2018-07-02">
<Change>[Task #12089] Migrate to workspace-uploader 2.0
</Change>
<Change>[Release #12006] Removed Send to
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-21-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-21-0"
date="2018-06-07">
<Change>[Project Activity #11690] Integrated with Task Executor Widget
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-20-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-20-1"
date="2018-04-19">
<Change>Managed case of Exception in order to avoid failure on
checkItemLocked
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-20-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-20-0"
date="2018-03-01">
<Change>[Task #11127] Porting to new ws-thredds engine</Change>
<Change>[Feature #11325] Workspace: add New URL feature in the context
menu of right pane
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-19-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-19-0"
date="2018-01-09">
<Change>Issue #10831, Workspace download folder tomcat temp occupation
issue
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-18-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-18-0"
date="2017-09-29">
<Change>Feature #9760: WS-Thredds synch folder integration</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-2"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-17-2"
date="2017-09-13">
<Change>Incident #9676: fixed. Removed check on get sub-folder public
link when operation is performed by an administrator
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-17-1"
date="2017-07-10">
<Change>Added regex in order to remove list of chars when renaming or
creating new item. It is different for folder and item name
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-17-0"
date="2017-05-22">
<Change>[Feature #5207] Integrate Image Preview Widget</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-16-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-16-1"
date="2017-04-11">
<Change>Quick fix to set folder as public</Change>
<Change>Updated messages to history including version of file if it is
present
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-16-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-16-0"
date="2017-03-03">
<Change>Removed no longer used dependency: accesslogger</Change>
<Change>[Feature #7006] File Versioning</Change>
@ -115,7 +131,8 @@
<Change>[Task #7382] Added a quick fix to 'Edit Permissions'</Change>
<Change>'Edit Permissions' can be performed by Administrators</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-15-2"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-15-2"
date="2016-01-20">
<Change>Added a loader on share window when contacts are loading from
server
@ -124,12 +141,14 @@
external servlets
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-15-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-15-1"
date="2016-01-05">
<Change>Removed message box shown in case of failure on getAllContatcs
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-15-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-15-0"
date="2016-11-29">
<Change>[Feature #5873] Remove ASL Session from the Workspace and its
components
@ -138,7 +157,8 @@
access is granted for owner or admin
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-14-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-14-0"
date="2016-09-29">
<Change>[Feature #2335] Added "Get Folder Link" facility</Change>
<Change>[Incident #4878] Fixed: Workspace tree not displaying user's
@ -155,33 +175,39 @@
</Change>
<Change>[Bug #5218] Fixed return to the Workspace root Folder</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-13-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-13-0"
date="2016-05-31">
<Change>[Feature #4128] Migration to Liferay 6.2</Change>
<Change>Data Catalogue publishing supported</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-12-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-12-0"
date="2016-05-16">
<Change>Integrated with new workspace uploader</Change>
<Change>Bug fixed: Css for Dialog Cancel multiple files</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-11-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-11-1"
date="2016-02-24">
<Change>Added icons for: .odt, .ods, .ott, .odg, .odp
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-11-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-11-0"
date="2016-01-20">
<Change>[Feature #1925] Added, new public link format:
http://host/storageID
</Change>
<Change>[Feature #1298] Update public link generation</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-10-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-10-1"
date="2015-12-16">
<Change>Bug Fixing - #1804; #1808; #1822; #1333</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-10-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-10-0"
date="2015-11-19">
<Change>[Feature #124] Remove a user from shared folder</Change>
<Change>[Feature #1259] Enhancement to workspace item history</Change>
@ -194,7 +220,8 @@
</Change>
<Change>[Bug: #1459] Fixed: get link disabled</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-9-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-9-0"
date="2015-10-30">
<Change>[Bug #718] Fixed breadcrumb path</Change>
<Change>[Bug #546] Fixed bug</Change>
@ -205,7 +232,8 @@
after an delete multiple
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-8-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-8-0"
date="2015-07-06">
<Change>[Feature #129] Porting to HL 2.0
</Change>
@ -213,12 +241,14 @@
complete link
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-7-2"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-7-2"
date="2015-04-15">
<Change>Integrated with Contact Edit Permissions
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-7-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-7-1"
date="2014-10-29">
<Change>Added user storage usage
</Change>
@ -226,14 +256,16 @@
shared folder
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-6-7"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-6-7"
date="2014-09-01">
<Change>Support Ticket #813: Broken Breadcrumb for long path
</Change>
<Change>Ticket #3053: Load current ACL stored to Shared Folder
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-6-6"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-6-6"
date="2014-07-02">
<Change>#2798 Sharing Panel usability improved
</Change>
@ -241,7 +273,8 @@
https://support.social.isti.cnr.it/ticket/126
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-6-5"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-6-5"
date="2014-06-04">
<Change>Added Trash:
https://issue.imarine.research-infrastructures.eu/ticket/2497
@ -250,7 +283,8 @@
3.2)
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-6-4"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-6-4"
date="2014-05-22">
<Change>Fixed:
https://support.d4science.research-infrastructures.eu/ticket/843
@ -259,12 +293,14 @@
https://issue.imarine.research-infrastructures.eu/ticket/282
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-6-2"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-6-2"
date="2014-3-17">
<Change>Management of My Special Folder</Change>
<Change>Added change permissions to VRE shared folder</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-6-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-6-0"
date="2014-2-07">
<Change>#2634 Workspace: support for setting permissions over shared
folders
@ -274,18 +310,21 @@
session validation
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-5-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-5-1"
date="2013-12-12">
<Change>Changed several labels into Logger
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-5-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-5-0"
date="2013-10-21">
<Change>#Ticket 2223. This project was enhancements to gwt 2.5.1
</Change>
<Change>GCF dependency was removed</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-4-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-4-0"
date="2013-09-16">
<Change>Provide support for public link, Related ticket: #1993
</Change>
@ -294,20 +333,23 @@
</Change>
<Change>Fixed bug on shared links, Ticket #630 </Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-3-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-3-0"
date="2013-07-08">
<Change>Provide support for share link, Related ticket: #1504</Change>
<Change>Edit description on sharing, Related ticket: #1822 </Change>
<Change>Bugs fixed, Related Tickets: #628, #633, #630</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-2-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-2-0"
date="2013-05-29">
<Change>Provide support for accounting, related ticket: #1752</Change>
<Change>Enable notification for file upload in shared folder, related
ticket: #1732
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-1-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-1-0"
date="2013-04-19">
<Change>Workspace portlet was enhanced to meet the requests coming
from the User Community
@ -316,20 +358,23 @@
#1497, #1536
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-0-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.6-0-0"
date="2013-03-05">
<Change>#1247 The workspace tree was mavenized</Change>
<Change>#230, #205 The Workspace environment now supports the sharing
of folder between users
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.5-1-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.5-1-0"
date="2012-09-21">
<Change>Old Send Message removed, added support for new mail sender
</Change>
<Change>Bug fixed: upload file/archive</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.5-0-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.5-0-0"
date="2012-05-04">
<Change>#216 New version of Workspace Tree is developed using the GXT
framework
@ -337,38 +382,45 @@
<Change>#216 New tree is asynchronous</Change>
<Change>#216 Reviews tree GUI and adding new features</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.4-3-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.4-3-0"
date="2011-09-01">
<Change>#1740: ICIS / Download csv / added extension .xlw</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.4-2-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.4-2-0"
date="2011-07-01">
<Change>#1555: WorkflowTemplate and WorkflowReport required in
Workspace Portlet
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.4-1-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.4-1-0"
date="2011-05-06">
<Change>Synch with others changes in HomeLibrary</Change>
<Change>GWT 2.2.0</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.4-0-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.4-0-0"
date="2011-02-07">
<Change>Removed Workspace and Basket type, replaced with folder option
</Change>
<Change>Synch with others changes in HomeLibrary</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.3-2-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.3-2-1"
date="2010-11-09">
<Change>Added more checks on GWT model construction</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.3-2-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.3-2-0"
date="2010-10-22">
<Change>Enabled details panel for Report, ReportTemplate and
AquaMapsItem workspace items
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.3-1-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.3-1-0"
date="2010-09-03">
<Change>#36: ICIS / Workspace / Upload an archive</Change>
<Change>Merged ThumbnailServlet and ImageServlet</Change>
@ -376,13 +428,15 @@
link not working
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.3-0-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.3-0-0"
date="2010-07-16">
<Change>Ported to GWT 2.0</Change>
<Change>Updated project structure to WebPortlet</Change>
<Change>Update to LifeRay portal</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-6-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-6-0"
date="2010-05-14">
<Change>#424: Workspace code refactoring an enanchement</Change>
<Change>refactored code</Change>
@ -391,35 +445,43 @@
Report Template
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-5-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-5-0"
date="2010-01-29">
<Change>gcube release 1.7.0</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-4-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-4-0"
date="2009-11-30">
<Change>gcube release 1.6.0</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-3-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-3-0"
date="2009-11-16">
<Change>gcube release 1.5.0</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-2-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-2-0"
date="2009-10-16">
<Change>gcube release</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-1-1"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-1-1"
date="2009-07-29">
<Change>gcube release 1.2.2</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-1-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-1-0"
date="2009-07-14">
<Change>gcube release 1.2.0</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.2-0-0"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.2-0-0"
date="2009-05-19">
<Change>gcube release 1.2.0 rc1</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.1-1-2"
<Changeset
component="org.gcube.portlets-user.workspace-portlet-tree.1-1-2"
date="2009-01-12">
<Change>first release</Change>
</Changeset>

View File

@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@ -29,6 +30,7 @@ import org.gcube.common.storagehubwrapper.shared.tohl.items.PDFFileItem;
import org.gcube.common.storagehubwrapper.shared.tohl.items.URLFileItem;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.server.property.PortalUrlGroupGatewayProperty;
import org.gcube.portlets.user.workspace.server.util.AllowedMimeTypeToInline;
import org.gcube.portlets.user.workspace.server.util.WsUtil;
import org.gcube.portlets.user.workspace.shared.HandlerResultMessage;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
@ -296,10 +298,24 @@ public class DownloadServlet extends HttpServlet{
String itemName = MimeTypeUtil.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType());
logger.info("Downloading default item: "+workspaceFileItem);
//String contentDisposition = viewContent?"inline":"attachment";
//Support #16430
//The 'inline' option may be badly managed by browser, so I'm forcing the 'attachment' option
//The 'inline' option may be badly managed by browser
String contentDisposition = "attachment";
List<String> allowedPrefixes = AllowedMimeTypeToInline.getAllowedMimeTypePrefixes();
if(viewContent) {
logger.info("Checking if the mime type "+workspaceFileItem.getMimeType()+" exists among Mime Type Prefixes");
for (String prefix : allowedPrefixes) {
if(workspaceFileItem.getMimeType().startsWith(prefix)) {
logger.info("yes, the prefix "+prefix+" is matching the mimetype "+workspaceFileItem.getMimeType()+", so returning 'Content-Disposition' at 'inline'");
contentDisposition = "inline";
break;
}
}
}
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
if(workspaceFileItem.getSize()!=null && workspaceFileItem.getSize()>0)
resp = setContentLength(resp, workspaceFileItem.getSize());

View File

@ -0,0 +1,86 @@
package org.gcube.portlets.user.workspace.server.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import org.apache.log4j.Logger;
/**
* The Class AllowedMimeTypeToInline.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Apr 4, 2019
*/
public class AllowedMimeTypeToInline {
public static final String filename = "MimeTypePrefixToInline.properties";
protected static Logger logger = Logger.getLogger(WsUtil.class);
/**
* Load mime type prefix.
*
* @return the properties
*/
private static Properties loadMimeTypePrefix(){
Properties prop = new Properties();
InputStream input = null;
try {
input = AllowedMimeTypeToInline.class.getClassLoader().getResourceAsStream(filename);
if(input==null){
logger.error("Sorry, unable to find " + filename);
return null;
}
//load a properties file from class path, inside static method
prop.load(input);
return prop;
} catch (IOException ex) {
logger.error("Sorry, error: ", ex);
return null;
} finally{
if(input!=null){
try {
input.close();
} catch (IOException e) {
//silent
}
}
}
}
/**
* Gets the allowed mime type prefixes.
*
* @return the allowed mime type prefixes
*/
public static List<String> getAllowedMimeTypePrefixes(){
Properties prop = loadMimeTypePrefix();
List<String> prefixes = new ArrayList<String>();
if(prop==null)
return prefixes;
for (Object keyObj : prop.keySet()) {
prefixes.add((String) keyObj);
}
return prefixes;
}
}

View File

@ -0,0 +1,6 @@
image=prefix to image file
text=prefix to text file
video=prefix to video file
application/pdf=prefix to pdf file
application/xml=prefix to xml file
application/json=prefix to json file