2013-02-06 15:40:17 +01:00
/ * *
2016-05-05 13:00:04 +02:00
*
2013-02-06 15:40:17 +01:00
* /
package org.gcube.portlets.user.workspace.server.util ;
2016-05-31 17:11:53 +02:00
import javax.servlet.http.HttpServletRequest ;
2013-02-06 15:40:17 +01:00
import javax.servlet.http.HttpSession ;
2013-03-25 11:14:26 +01:00
import org.apache.commons.lang.StringUtils ;
2013-09-27 17:39:28 +02:00
import org.apache.log4j.Logger ;
2013-02-13 18:39:33 +01:00
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager ;
import org.gcube.applicationsupportlayer.social.NotificationsManager ;
2016-05-31 17:11:53 +02:00
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite ;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser ;
2013-09-27 17:39:28 +02:00
import org.gcube.common.homelibrary.home.HomeLibrary ;
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException ;
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException ;
import org.gcube.common.homelibrary.home.workspace.Workspace ;
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException ;
2016-11-25 12:03:25 +01:00
import org.gcube.common.portal.PortalContext ;
2013-09-27 17:39:28 +02:00
import org.gcube.common.scope.api.ScopeProvider ;
2016-09-14 14:30:33 +02:00
import org.gcube.portlets.user.urlshortener.UrlShortener ;
2013-09-03 15:49:22 +02:00
import org.gcube.portlets.user.workspace.client.model.InfoContactModel ;
2013-02-06 15:40:17 +01:00
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder ;
2013-02-13 18:39:33 +01:00
import org.gcube.portlets.user.workspace.server.notifications.NotificationsProducer ;
2016-01-13 15:38:33 +01:00
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex ;
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex.RESOLVER_TYPE ;
2014-03-05 18:28:49 +01:00
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader ;
2013-03-27 17:30:37 +01:00
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter ;
2016-11-25 12:03:25 +01:00
import org.gcube.vomanagement.usermanagement.model.GCubeUser ;
2013-02-06 15:40:17 +01:00
2014-10-28 17:12:40 +01:00
import com.liferay.portal.service.UserLocalServiceUtil ;
2013-02-06 15:40:17 +01:00
/ * *
2016-05-31 17:11:53 +02:00
* The Class WsUtil .
2016-05-05 13:00:04 +02:00
*
2014-02-18 14:40:19 +01:00
* @author Francesco Mangiacrapa francesco . mangiacrapa @isti.cnr.it
2016-11-25 12:03:25 +01:00
* Nov 25 , 2016
2013-02-06 15:40:17 +01:00
* /
2013-06-13 18:44:46 +02:00
public class WsUtil {
2013-02-06 15:40:17 +01:00
2016-11-25 12:16:32 +01:00
protected static Logger logger = Logger . getLogger ( WsUtil . class ) ;
2013-02-06 15:40:17 +01:00
public static final String FOLDERIMPORTER_ATTRIBUTE = " FOLDER_IMPORTER " ;
public static final String METADATACONVERTER_ATTRIBUTE = " METADATA_CONVERTER " ;
public static final String WORKSPACE_EVENT_COLLECTOR_ATTRIBUTE = " EVENT_COLLECTOR " ;
public static final String WORKSPACEBUILDER_ATTRIBUTE = " WORKSPACEBUILDER " ;
2013-08-28 14:55:26 +02:00
public static final String NOTIFICATION_MANAGER = " NOTIFICATION_MANAGER " ;
public static final String NOTIFICATION_PRODUCER = " NOTIFICATION_PRODUCER " ;
2013-02-14 15:06:34 +01:00
public static final String WS_RUN_IN_TEST_MODE = " WS_RUN_IN_TEST_MODE " ;
2013-03-27 17:30:37 +01:00
public static final String WORKSPACE_SCOPE_UTIL = " WORKSPACE_SCOPE_UTIL " ;
2013-07-01 15:54:54 +02:00
public static final String URL_SHORTENER_SERVICE = " URL_SHORTENER_SERVICE " ;
2013-07-08 17:42:08 +02:00
public static final String URI_RESOLVER_SERVICE = " URI_RESOLVER_SERVICE " ;
2014-03-05 18:28:49 +01:00
public static final String PROPERTY_SPECIAL_FOLDER = " PROPERTY_SPECIAL_FOLDER " ;
2014-02-19 18:43:29 +01:00
public static final String NOTIFICATION_PORTLET_CLASS_ID = " org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl " ; //IN DEV
2016-05-05 13:00:04 +02:00
2014-10-28 17:12:40 +01:00
/ * *
2016-11-25 12:16:32 +01:00
* Checks if is within portal .
*
* @return true if you ' re running into the portal , false if in development
* /
2015-01-28 15:02:18 +01:00
public static boolean isWithinPortal ( ) {
2014-10-28 17:12:40 +01:00
try {
UserLocalServiceUtil . getService ( ) ;
return true ;
2016-05-05 13:00:04 +02:00
}
catch ( Exception ex ) {
2014-10-28 17:12:40 +01:00
logger . trace ( " Development Mode ON " ) ;
return false ;
2016-05-05 13:00:04 +02:00
}
2014-10-28 17:12:40 +01:00
}
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
2016-05-31 17:11:53 +02:00
/ * *
2016-11-25 12:03:25 +01:00
* Gets the portal context .
2016-05-31 17:11:53 +02:00
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
* @return the portal context
2016-05-31 17:11:53 +02:00
* /
2016-11-25 12:03:25 +01:00
public static PortalContextInfo getPortalContext ( HttpServletRequest httpServletRequest ) {
PortalContext pContext = PortalContext . getConfiguration ( ) ;
//USER
GCubeUser user = pContext . getCurrentUser ( httpServletRequest ) ;
String username = user . getUsername ( ) ;
String fullName = user . getFullname ( ) ;
String email = user . getEmail ( ) ;
String avatarID = user . getUserAvatarId ( ) ;
String avatarURL = user . getUserAvatarURL ( ) ;
//SESSION
String currentScope = pContext . getCurrentScope ( httpServletRequest ) ;
String userToken = pContext . getCurrentUserToken ( httpServletRequest ) ;
long currGroupId = pContext . getCurrentGroupId ( httpServletRequest ) ;
return new PortalContextInfo ( username , fullName , email , avatarID , avatarURL , currentScope , userToken , currGroupId ) ;
2013-02-14 15:06:34 +01:00
}
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
2016-11-25 14:31:52 +01:00
/ * *
* Gets the portal context .
*
* @param httpServletRequest the http servlet request
* @param overrideScope the override scope
* @return the portal context
* /
public static PortalContextInfo getPortalContext ( HttpServletRequest httpServletRequest , String overrideScope ) {
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
info . setCurrentScope ( overrideScope ) ;
return info ;
}
2014-01-13 11:54:11 +01:00
/ * *
2016-05-31 17:11:53 +02:00
* Checks if is session expired .
2016-05-05 13:00:04 +02:00
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
* @return true , if is session expired
2016-05-31 17:11:53 +02:00
* @throws Exception the exception
2014-01-13 11:54:11 +01:00
* /
2016-11-25 12:03:25 +01:00
public static boolean isSessionExpired ( HttpServletRequest httpServletRequest ) throws Exception {
2014-01-13 11:54:11 +01:00
logger . trace ( " workspace session validating... " ) ;
2017-01-20 12:45:38 +01:00
return PortalContext . getConfiguration ( ) . getCurrentUser ( httpServletRequest ) = = null ;
2014-01-13 11:54:11 +01:00
}
2016-05-05 13:00:04 +02:00
2013-02-06 15:40:17 +01:00
2016-05-31 17:11:53 +02:00
/ * *
* Gets the workspace .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the workspace
* @throws InternalErrorException the internal error exception
* @throws HomeNotFoundException the home not found exception
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
* /
2016-11-25 12:03:25 +01:00
public static Workspace getWorkspace ( HttpServletRequest httpServletRequest ) throws InternalErrorException , HomeNotFoundException , WorkspaceFolderNotFoundException
2013-02-06 15:40:17 +01:00
{
2013-09-27 17:39:28 +02:00
logger . trace ( " Get Workspace " ) ;
2016-11-25 12:03:25 +01:00
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
logger . trace ( " PortalContextInfo: " + info ) ;
2013-02-06 15:40:17 +01:00
2016-11-25 12:03:25 +01:00
ScopeProvider . instance . set ( info . getCurrentScope ( ) ) ;
2013-09-27 17:39:28 +02:00
logger . trace ( " Scope provider instancied " ) ;
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
Workspace workspace = HomeLibrary . getUserWorkspace ( info . getUsername ( ) ) ;
2013-02-06 15:40:17 +01:00
return workspace ;
2016-05-13 11:14:42 +02:00
}
2013-02-06 15:40:17 +01:00
2016-11-25 14:31:52 +01:00
/ * *
* Gets the workspace .
*
* @param httpServletRequest the http servlet request
2016-12-21 14:55:54 +01:00
* @param contextID the context id
2017-01-20 12:45:38 +01:00
* @param user the user
2016-11-25 14:31:52 +01:00
* @return the workspace
* @throws InternalErrorException the internal error exception
* @throws HomeNotFoundException the home not found exception
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
* /
2017-01-20 12:45:38 +01:00
public static Workspace getWorkspace ( HttpServletRequest httpServletRequest , String contextID , GCubeUser user ) throws InternalErrorException , HomeNotFoundException , WorkspaceFolderNotFoundException
2016-11-25 14:31:52 +01:00
{
2017-01-20 12:45:38 +01:00
logger . info ( " Get workspace using contextID: " + contextID + " , current user: " + user . getUsername ( ) ) ;
2017-02-21 18:24:44 +01:00
String currentScope ;
if ( isWithinPortal ( ) )
currentScope = PortalContext . getConfiguration ( ) . getCurrentScope ( contextID ) ;
else {
currentScope = PortalContext . getConfiguration ( ) . getCurrentScope ( httpServletRequest ) ;
logger . warn ( " STARTING IN TEST MODE!!!! USING SCOPE: " + currentScope ) ;
}
2016-12-21 14:55:54 +01:00
logger . info ( " For ContextID: " + contextID + " , read scope from Portal Context: " + currentScope ) ;
PortalContextInfo info = getPortalContext ( httpServletRequest , currentScope ) ;
2016-11-25 14:31:52 +01:00
logger . trace ( " PortalContextInfo: " + info ) ;
ScopeProvider . instance . set ( info . getCurrentScope ( ) ) ;
logger . trace ( " Scope provider instancied " ) ;
2016-12-21 14:55:54 +01:00
String username = null ;
try {
2017-01-20 12:45:38 +01:00
if ( user . getUsername ( ) . compareTo ( info . getUsername ( ) ) ! = 0 ) {
logger . debug ( " Gcube user read from Portal Context " + user . getUsername ( ) + " is different by GCubeUser passed, using the second one: " + info . getUsername ( ) ) ;
username = user . getUsername ( ) ;
}
2016-12-21 14:55:54 +01:00
} catch ( Exception e ) {
2017-01-20 12:45:38 +01:00
logger . error ( " Error comparing username read from input parameter and Portal context " ) ;
2016-12-21 14:55:54 +01:00
}
2017-01-20 12:45:38 +01:00
if ( username ! = null )
info . setUsername ( username ) ;
2016-12-21 14:55:54 +01:00
2016-11-25 14:31:52 +01:00
Workspace workspace = HomeLibrary . getUserWorkspace ( info . getUsername ( ) ) ;
return workspace ;
}
2016-05-31 17:11:53 +02:00
/ * *
* Gets the GWT workspace builder .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the GWT workspace builder
* /
2016-11-25 12:03:25 +01:00
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder ( HttpServletRequest httpServletRequest )
2013-02-06 15:40:17 +01:00
{
2016-11-25 12:03:25 +01:00
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
logger . trace ( " PortalContextInfo: " + info ) ;
HttpSession session = httpServletRequest . getSession ( ) ;
2016-05-05 13:00:04 +02:00
GWTWorkspaceBuilder builder = ( GWTWorkspaceBuilder ) session . getAttribute ( WORKSPACEBUILDER_ATTRIBUTE ) ;
if ( builder = = null ) {
logger . info ( " Initializing the workspace area builder " ) ;
builder = new GWTWorkspaceBuilder ( ) ;
//ADDED 03/09/2013
2016-11-25 12:03:25 +01:00
builder . setUserLogged ( new InfoContactModel ( info . getUsername ( ) , info . getUsername ( ) , info . getUserFullName ( ) , false ) ) ;
2016-05-05 13:00:04 +02:00
session . setAttribute ( WORKSPACEBUILDER_ATTRIBUTE , builder ) ;
}
return builder ;
2013-02-06 15:40:17 +01:00
}
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
2016-05-31 17:11:53 +02:00
/ * *
* Gets the notification manager .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the notification manager
* /
2016-11-25 12:03:25 +01:00
public static NotificationsManager getNotificationManager ( HttpServletRequest httpServletRequest )
2013-02-13 18:39:33 +01:00
{
2016-11-25 12:03:25 +01:00
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
HttpSession session = httpServletRequest . getSession ( ) ;
2013-02-13 18:39:33 +01:00
NotificationsManager notifMng = ( NotificationsManager ) session . getAttribute ( NOTIFICATION_MANAGER ) ;
2016-05-05 13:00:04 +02:00
2013-02-13 18:39:33 +01:00
if ( notifMng = = null ) {
2014-02-18 14:40:19 +01:00
try {
2016-11-25 12:03:25 +01:00
logger . trace ( " Create new NotificationsManager for user: " + info . getUsername ( ) ) ;
2014-02-19 18:43:29 +01:00
logger . trace ( " New ApplicationNotificationsManager with portlet class name: " + NOTIFICATION_PORTLET_CLASS_ID ) ;
2016-11-25 12:03:25 +01:00
SocialNetworkingSite site = new SocialNetworkingSite ( httpServletRequest ) ;
SocialNetworkingUser curser = new SocialNetworkingUser ( info . getUsername ( ) , info . getUserEmail ( ) , info . getUserFullName ( ) , info . getUserAvatarID ( ) ) ;
notifMng = new ApplicationNotificationsManager ( site , info . getCurrentScope ( ) , curser , NOTIFICATION_PORTLET_CLASS_ID ) ;
2014-02-18 14:40:19 +01:00
session . setAttribute ( NOTIFICATION_MANAGER , notifMng ) ;
} catch ( Exception e ) {
2016-11-25 12:03:25 +01:00
logger . error ( " An error occurred instancing ApplicationNotificationsManager for user: " + info . getUsername ( ) , e ) ;
2014-02-18 14:40:19 +01:00
}
2013-02-13 18:39:33 +01:00
}
2016-05-05 13:00:04 +02:00
2013-02-13 18:39:33 +01:00
return notifMng ;
}
2016-05-05 13:00:04 +02:00
2016-05-31 17:11:53 +02:00
/ * *
* Gets the notification producer .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the notification producer
* /
2016-11-25 12:03:25 +01:00
public static NotificationsProducer getNotificationProducer ( HttpServletRequest httpServletRequest )
2013-02-13 18:39:33 +01:00
{
2016-11-25 12:03:25 +01:00
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
HttpSession session = httpServletRequest . getSession ( ) ;
2013-02-13 18:39:33 +01:00
NotificationsProducer notifProducer = ( NotificationsProducer ) session . getAttribute ( NOTIFICATION_PRODUCER ) ;
2016-05-05 13:00:04 +02:00
2013-02-13 18:39:33 +01:00
if ( notifProducer = = null ) {
2016-11-25 12:03:25 +01:00
logger . trace ( " Create new Notification Producer for user: " + info . getUsername ( ) ) ;
notifProducer = new NotificationsProducer ( httpServletRequest ) ;
2013-02-13 18:39:33 +01:00
session . setAttribute ( NOTIFICATION_PRODUCER , notifProducer ) ;
}
return notifProducer ;
}
2016-11-25 12:03:25 +01:00
2016-05-31 17:11:53 +02:00
/ * *
* Gets the user id .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the user id
* /
2016-11-25 12:03:25 +01:00
public static String getUserId ( HttpServletRequest httpServletRequest ) {
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
return info . getUsername ( ) ;
2013-02-13 18:39:33 +01:00
}
2016-05-05 13:00:04 +02:00
2016-05-31 17:11:53 +02:00
/ * *
* Checks if is vre .
*
2016-11-25 12:03:25 +01:00
* @param scope the scope
2016-05-31 17:11:53 +02:00
* @return true , if is vre
* /
2016-11-25 12:03:25 +01:00
public static boolean isVRE ( String scope ) {
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
int slashCount = StringUtils . countMatches ( scope , " / " ) ;
2016-05-05 13:00:04 +02:00
2013-03-25 11:14:26 +01:00
if ( slashCount < 3 ) {
2013-10-04 13:58:07 +02:00
logger . trace ( " currentScope is not VRE " ) ;
2013-03-25 11:14:26 +01:00
return false ;
}
2016-05-05 13:00:04 +02:00
2013-10-04 13:58:07 +02:00
logger . trace ( " currentScope is VRE " ) ;
2013-03-25 11:14:26 +01:00
return true ;
2016-05-05 13:00:04 +02:00
2013-03-25 11:14:26 +01:00
}
2016-05-05 13:00:04 +02:00
2016-05-31 17:11:53 +02:00
/ * *
* Gets the scope util filter .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the scope util filter
* /
2016-11-25 12:03:25 +01:00
public static ScopeUtilFilter getScopeUtilFilter ( HttpServletRequest httpServletRequest ) {
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
HttpSession session = httpServletRequest . getSession ( ) ;
2013-03-27 17:30:37 +01:00
ScopeUtilFilter scopeUtil = null ;
try {
2013-06-13 18:44:46 +02:00
scopeUtil = ( ScopeUtilFilter ) session . getAttribute ( WsUtil . WORKSPACE_SCOPE_UTIL ) ;
2016-05-05 13:00:04 +02:00
2013-03-27 17:30:37 +01:00
if ( scopeUtil = = null ) {
2016-11-25 12:03:25 +01:00
scopeUtil = new ScopeUtilFilter ( info . getCurrentScope ( ) , true ) ;
2016-05-05 13:00:04 +02:00
2013-03-27 17:30:37 +01:00
}
} catch ( Exception e ) {
2013-10-04 13:58:07 +02:00
logger . error ( " an error occurred in getscope filter " + e ) ;
2013-03-27 17:30:37 +01:00
}
2016-05-05 13:00:04 +02:00
2013-03-27 17:30:37 +01:00
return scopeUtil ;
}
2013-02-06 15:40:17 +01:00
2013-07-01 15:54:54 +02:00
/ * *
2016-05-31 17:11:53 +02:00
* Gets the url shortener .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the url shortener
2013-07-01 15:54:54 +02:00
* /
2016-11-25 12:03:25 +01:00
public static UrlShortener getUrlShortener ( HttpServletRequest httpServletRequest ) {
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
HttpSession session = httpServletRequest . getSession ( ) ;
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
2013-07-01 15:54:54 +02:00
UrlShortener shortener = null ;
try {
shortener = ( UrlShortener ) session . getAttribute ( WsUtil . URL_SHORTENER_SERVICE ) ;
2016-05-05 13:00:04 +02:00
2013-07-01 15:54:54 +02:00
if ( shortener = = null ) {
2016-09-30 11:42:52 +02:00
shortener = new UrlShortener ( ) ;
2013-07-01 15:54:54 +02:00
session . setAttribute ( URL_SHORTENER_SERVICE , shortener ) ;
}
2016-05-05 13:00:04 +02:00
2013-07-01 15:54:54 +02:00
} catch ( Exception e ) {
2013-10-04 13:58:07 +02:00
logger . error ( " an error occurred in instancing url shortener " , e ) ;
2013-07-01 15:54:54 +02:00
}
2013-07-01 17:58:57 +02:00
return shortener ;
2013-07-01 15:54:54 +02:00
}
2013-07-08 17:42:08 +02:00
/ * *
2016-05-31 17:11:53 +02:00
* Gets the uri resolver .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @return the uri resolver
2013-07-08 17:42:08 +02:00
* /
2016-11-25 12:03:25 +01:00
public static UriResolverReaderParameterForResolverIndex getUriResolver ( HttpServletRequest httpServletRequest ) {
2016-05-05 13:00:04 +02:00
2016-11-25 12:03:25 +01:00
HttpSession session = httpServletRequest . getSession ( ) ;
PortalContextInfo info = getPortalContext ( httpServletRequest ) ;
2016-01-13 15:38:33 +01:00
UriResolverReaderParameterForResolverIndex uriResolver = null ;
2013-07-08 17:42:08 +02:00
try {
2016-01-13 15:38:33 +01:00
uriResolver = ( UriResolverReaderParameterForResolverIndex ) session . getAttribute ( WsUtil . URI_RESOLVER_SERVICE ) ;
2016-05-05 13:00:04 +02:00
2013-07-08 17:42:08 +02:00
if ( uriResolver = = null ) {
2016-11-25 12:03:25 +01:00
uriResolver = new UriResolverReaderParameterForResolverIndex ( info . getCurrentScope ( ) , RESOLVER_TYPE . SMP_ID ) ;
2013-07-08 17:42:08 +02:00
session . setAttribute ( URI_RESOLVER_SERVICE , uriResolver ) ;
}
2016-05-05 13:00:04 +02:00
2013-07-08 17:42:08 +02:00
} catch ( Exception e ) {
2014-03-05 18:28:49 +01:00
logger . error ( " an error occurred instancing URI Resolver " , e ) ;
2013-07-08 17:42:08 +02:00
}
return uriResolver ;
}
2014-03-05 18:28:49 +01:00
/ * *
2016-05-31 17:11:53 +02:00
* Gets the property special folder reader .
*
2016-11-25 12:03:25 +01:00
* @param httpServletRequest the http servlet request
2016-05-31 17:11:53 +02:00
* @param pathProperty the path property
* @return the property special folder reader
2014-03-05 18:28:49 +01:00
* /
2016-11-25 12:03:25 +01:00
public static PropertySpecialFolderReader getPropertySpecialFolderReader ( HttpServletRequest httpServletRequest , String pathProperty ) {
HttpSession session = httpServletRequest . getSession ( ) ;
2016-05-05 13:00:04 +02:00
2014-03-05 18:28:49 +01:00
PropertySpecialFolderReader psFolderReader = null ;
try {
psFolderReader = ( PropertySpecialFolderReader ) session . getAttribute ( WsUtil . PROPERTY_SPECIAL_FOLDER ) ;
2016-05-05 13:00:04 +02:00
2014-03-05 18:28:49 +01:00
if ( psFolderReader = = null ) {
psFolderReader = new PropertySpecialFolderReader ( pathProperty ) ;
session . setAttribute ( PROPERTY_SPECIAL_FOLDER , psFolderReader ) ;
}
2016-05-05 13:00:04 +02:00
2014-03-05 18:28:49 +01:00
} catch ( Exception e ) {
logger . error ( " an error occurred instancing PropertySpecialFolderReader " , e ) ;
}
return psFolderReader ;
}
2013-02-06 15:40:17 +01:00
}