|
|
|
@ -8,8 +8,6 @@ import javax.servlet.http.HttpSession;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.gcube.application.framework.core.session.ASLSession;
|
|
|
|
|
import org.gcube.application.framework.core.session.SessionManager;
|
|
|
|
|
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
|
|
|
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
|
|
|
|
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
|
|
|
|
@ -19,8 +17,8 @@ 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;
|
|
|
|
|
import org.gcube.common.portal.PortalContext;
|
|
|
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
|
|
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|
|
|
|
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
|
|
|
|
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
|
|
|
|
import org.gcube.portlets.user.workspace.server.GWTWorkspaceBuilder;
|
|
|
|
@ -29,6 +27,7 @@ import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParame
|
|
|
|
|
import org.gcube.portlets.user.workspace.server.resolver.UriResolverReaderParameterForResolverIndex.RESOLVER_TYPE;
|
|
|
|
|
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
|
|
|
|
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
|
|
|
|
|
|
|
|
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
|
|
|
|
|
|
|
|
@ -37,11 +36,10 @@ import com.liferay.portal.service.UserLocalServiceUtil;
|
|
|
|
|
* The Class WsUtil.
|
|
|
|
|
*
|
|
|
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
* @Feb 18, 2014
|
|
|
|
|
* Nov 25, 2016
|
|
|
|
|
*/
|
|
|
|
|
public class WsUtil {
|
|
|
|
|
|
|
|
|
|
public static final String USERNAME_ATTRIBUTE = ScopeHelper.USERNAME_ATTRIBUTE;
|
|
|
|
|
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";
|
|
|
|
@ -55,20 +53,11 @@ public class WsUtil {
|
|
|
|
|
public static final String PROPERTY_SPECIAL_FOLDER = "PROPERTY_SPECIAL_FOLDER";
|
|
|
|
|
public static final String NOTIFICATION_PORTLET_CLASS_ID = "org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl"; //IN DEV
|
|
|
|
|
|
|
|
|
|
// public static final String TEST_SCOPE = "/d4science.research-infrastructures.eu";
|
|
|
|
|
// public static final String TEST_TOKEN = "57b42a99-6239-44c4-9a68-591c18363222-843339462"; //username Francesco Mangiacrapa scope: BiodiversityLab
|
|
|
|
|
public static final String TEST_SCOPE = "/gcube";
|
|
|
|
|
public static final String TEST_TOKEN = "89257623-0570-4fbe-a15b-458bb84f4902-98187548"; //username Francesco Mangiacrapa scope: NextNext
|
|
|
|
|
|
|
|
|
|
// public static final String TEST_USER = "pasquale.pagano";
|
|
|
|
|
// public static final String TEST_USER = "federico.defaveri";
|
|
|
|
|
// public static final String TEST_USER = "massimiliano.assante";
|
|
|
|
|
// public static final String TEST_USER = "pasquale.pagano";
|
|
|
|
|
// public static final String TEST_USER = "aureliano.gentile";
|
|
|
|
|
// public static final String TEST_USER = "antonio.gioia";
|
|
|
|
|
|
|
|
|
|
//COMMENT THIS FOR RELEASE
|
|
|
|
|
// public static final String TEST_USER = "francesco.mangiacrapa";
|
|
|
|
|
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
|
|
|
|
|
|
|
|
|
//UNCOMMENT THIS FOR RELEASE
|
|
|
|
|
public static String TEST_USER = "test.user";
|
|
|
|
|
public static String TEST_USER_FULL_NAME = "Test User";
|
|
|
|
@ -94,103 +83,64 @@ public class WsUtil {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the asl session.
|
|
|
|
|
* Gets the portal context.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @return the asl session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the portal context
|
|
|
|
|
*/
|
|
|
|
|
public static ASLSession getAslSession(HttpSession httpSession)
|
|
|
|
|
{
|
|
|
|
|
String sessionID = httpSession.getId();
|
|
|
|
|
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
|
|
|
|
|
ASLSession session;
|
|
|
|
|
|
|
|
|
|
if (user == null) {
|
|
|
|
|
|
|
|
|
|
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
|
|
|
|
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
|
|
|
|
user=TEST_USER;
|
|
|
|
|
|
|
|
|
|
if (!isWithinPortal()) { //DEV MODE
|
|
|
|
|
user = "francesco.mangiacrapa";
|
|
|
|
|
TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
|
|
|
|
//SecurityTokenProvider.instance.set(TEST_TOKEN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
|
|
|
|
logger.warn("session id: "+sessionID);
|
|
|
|
|
logger.warn("TEST_USER: "+user);
|
|
|
|
|
logger.warn("TEST_SCOPE: "+TEST_SCOPE);
|
|
|
|
|
logger.warn("USERNAME_ATTRIBUTE: "+USERNAME_ATTRIBUTE);
|
|
|
|
|
session = SessionManager.getInstance().getASLSession(sessionID, user);
|
|
|
|
|
session.setScope(TEST_SCOPE);
|
|
|
|
|
session.setSecurityToken(TEST_TOKEN);
|
|
|
|
|
|
|
|
|
|
//MANDATORY FOR SOCIAL LIBRARY
|
|
|
|
|
session.setUserAvatarId(user + "Avatar");
|
|
|
|
|
session.setUserFullName(TEST_USER_FULL_NAME);
|
|
|
|
|
session.setUserEmailAddress(user + "@mail.test");
|
|
|
|
|
|
|
|
|
|
//SET HTTP SESSION ATTRIBUTE
|
|
|
|
|
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
|
|
|
|
|
|
|
|
|
// withoutPortal = true;
|
|
|
|
|
|
|
|
|
|
return session;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if is session expired.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @return true if current username into ASL session is WsUtil.TEST_USER, false otherwise
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return true, if is session expired
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public static boolean isSessionExpired(HttpSession httpSession) throws Exception {
|
|
|
|
|
public static boolean isSessionExpired(HttpServletRequest httpServletRequest) throws Exception {
|
|
|
|
|
logger.trace("workspace session validating...");
|
|
|
|
|
//READING USERNAME FROM ASL SESSION
|
|
|
|
|
String userUsername = getAslSession(httpSession).getUsername();
|
|
|
|
|
boolean isTestUser = userUsername.compareTo(WsUtil.TEST_USER)==0;
|
|
|
|
|
|
|
|
|
|
//TODO UNCOMMENT THIS FOR RELEASE
|
|
|
|
|
logger.trace("Is "+WsUtil.TEST_USER+" test user? "+isTestUser);
|
|
|
|
|
|
|
|
|
|
if(isTestUser){
|
|
|
|
|
logger.error("workspace session is expired! username is: "+WsUtil.TEST_USER);
|
|
|
|
|
return true; //is TEST_USER, session is expired
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.trace("workspace session is valid! current username is: "+userUsername);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
return info.getUsername()==null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the workspace.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the workspace
|
|
|
|
|
* @throws InternalErrorException the internal error exception
|
|
|
|
|
* @throws HomeNotFoundException the home not found exception
|
|
|
|
|
* @throws WorkspaceFolderNotFoundException the workspace folder not found exception
|
|
|
|
|
*/
|
|
|
|
|
public static Workspace getWorkspace(final HttpSession httpSession) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
|
|
|
|
|
public static Workspace getWorkspace(HttpServletRequest httpServletRequest) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
|
|
|
|
|
{
|
|
|
|
|
logger.trace("Get Workspace");
|
|
|
|
|
final ASLSession session = getAslSession(httpSession);
|
|
|
|
|
logger.trace("ASLSession scope: "+session.getScope() + " username: "+session.getUsername());
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
logger.trace("PortalContextInfo: "+info);
|
|
|
|
|
|
|
|
|
|
ScopeProvider.instance.set(session.getScope());
|
|
|
|
|
ScopeProvider.instance.set(info.getCurrentScope());
|
|
|
|
|
logger.trace("Scope provider instancied");
|
|
|
|
|
|
|
|
|
|
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
|
|
|
|
|
Workspace workspace = HomeLibrary.getUserWorkspace(info.getUsername());
|
|
|
|
|
return workspace;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -199,72 +149,72 @@ public class WsUtil {
|
|
|
|
|
/**
|
|
|
|
|
* Gets the GWT workspace builder.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the GWT workspace builder
|
|
|
|
|
*/
|
|
|
|
|
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder(HttpSession httpSession)
|
|
|
|
|
public static GWTWorkspaceBuilder getGWTWorkspaceBuilder(HttpServletRequest httpServletRequest)
|
|
|
|
|
{
|
|
|
|
|
ASLSession session = getAslSession(httpSession);
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
logger.trace("PortalContextInfo: "+info);
|
|
|
|
|
|
|
|
|
|
HttpSession session = httpServletRequest.getSession();
|
|
|
|
|
|
|
|
|
|
GWTWorkspaceBuilder builder = (GWTWorkspaceBuilder) session.getAttribute(WORKSPACEBUILDER_ATTRIBUTE);
|
|
|
|
|
if (builder == null){
|
|
|
|
|
logger.info("Initializing the workspace area builder");
|
|
|
|
|
builder = new GWTWorkspaceBuilder();
|
|
|
|
|
//ADDED 03/09/2013
|
|
|
|
|
builder.setUserLogged(new InfoContactModel(session.getUsername(), session.getUsername(), session.getUserFullName(), false));
|
|
|
|
|
builder.setUserLogged(new InfoContactModel(info.getUsername(), info.getUsername(), info.getUserFullName(), false));
|
|
|
|
|
session.setAttribute(WORKSPACEBUILDER_ATTRIBUTE, builder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the notification manager.
|
|
|
|
|
*
|
|
|
|
|
* @param session the session
|
|
|
|
|
* @param request the request
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the notification manager
|
|
|
|
|
*/
|
|
|
|
|
public static NotificationsManager getNotificationManager(ASLSession session, HttpServletRequest request)
|
|
|
|
|
public static NotificationsManager getNotificationManager(HttpServletRequest httpServletRequest)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
HttpSession session = httpServletRequest.getSession();
|
|
|
|
|
NotificationsManager notifMng = (NotificationsManager) session.getAttribute(NOTIFICATION_MANAGER);
|
|
|
|
|
|
|
|
|
|
if (notifMng == null) {
|
|
|
|
|
try{
|
|
|
|
|
logger.trace("Create new NotificationsManager for user: "+session.getUsername());
|
|
|
|
|
logger.trace("Create new NotificationsManager for user: "+info.getUsername());
|
|
|
|
|
logger.trace("New ApplicationNotificationsManager with portlet class name: "+NOTIFICATION_PORTLET_CLASS_ID);
|
|
|
|
|
SocialNetworkingSite site = new SocialNetworkingSite(request);
|
|
|
|
|
SocialNetworkingUser curser = new SocialNetworkingUser(session.getUsername(), session.getUserEmailAddress(), session.getUserFullName(), session.getUserAvatarId());
|
|
|
|
|
notifMng = new ApplicationNotificationsManager(site, session.getScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
|
|
|
|
|
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);
|
|
|
|
|
session.setAttribute(NOTIFICATION_MANAGER, notifMng);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+session.getUsername(),e);
|
|
|
|
|
logger.error("An error occurred instancing ApplicationNotificationsManager for user: "+info.getUsername(),e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return notifMng;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SocialNetworkingSite site = new SocialNetworkingSite(request);
|
|
|
|
|
// SocialNetworkingUser curser = new SocialNetworkingUser(session.getUsername(), session.getUserEmailAddress(), session.getUserFullName(), session.getUserAvatarId());
|
|
|
|
|
// return new ApplicationNotificationsManager(site, session.getScope(), curser, NOTIFICATION_PORTLET_CLASS_ID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the notification producer.
|
|
|
|
|
*
|
|
|
|
|
* @param session the session
|
|
|
|
|
* @param request the request
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the notification producer
|
|
|
|
|
*/
|
|
|
|
|
public static NotificationsProducer getNotificationProducer(ASLSession session, HttpServletRequest request)
|
|
|
|
|
public static NotificationsProducer getNotificationProducer(HttpServletRequest httpServletRequest)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
HttpSession session = httpServletRequest.getSession();
|
|
|
|
|
NotificationsProducer notifProducer = (NotificationsProducer) session.getAttribute(NOTIFICATION_PRODUCER);
|
|
|
|
|
|
|
|
|
|
if (notifProducer == null) {
|
|
|
|
|
logger.trace("Create new Notification Producer for user: "+session.getUsername());
|
|
|
|
|
notifProducer = new NotificationsProducer(session, request);
|
|
|
|
|
logger.trace("Create new Notification Producer for user: "+info.getUsername());
|
|
|
|
|
notifProducer = new NotificationsProducer(httpServletRequest);
|
|
|
|
|
session.setAttribute(NOTIFICATION_PRODUCER, notifProducer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -273,30 +223,30 @@ public class WsUtil {
|
|
|
|
|
//return new NotificationsProducer(session, request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the user id.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the user id
|
|
|
|
|
*/
|
|
|
|
|
public static String getUserId(HttpSession httpSession) {
|
|
|
|
|
public static String getUserId(HttpServletRequest httpServletRequest) {
|
|
|
|
|
|
|
|
|
|
ASLSession session = getAslSession(httpSession);
|
|
|
|
|
|
|
|
|
|
return session.getUsername();
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
return info.getUsername();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if is vre.
|
|
|
|
|
*
|
|
|
|
|
* @param session the session
|
|
|
|
|
* @param scope the scope
|
|
|
|
|
* @return true, if is vre
|
|
|
|
|
*/
|
|
|
|
|
public static boolean isVRE(ASLSession session){
|
|
|
|
|
|
|
|
|
|
String currentScope = session.getScopeName();
|
|
|
|
|
public static boolean isVRE(String scope){
|
|
|
|
|
|
|
|
|
|
int slashCount = StringUtils.countMatches(currentScope, "/");
|
|
|
|
|
int slashCount = StringUtils.countMatches(scope, "/");
|
|
|
|
|
|
|
|
|
|
if(slashCount < 3){
|
|
|
|
|
logger.trace("currentScope is not VRE");
|
|
|
|
@ -308,21 +258,23 @@ public class WsUtil {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the scope util filter.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the scope util filter
|
|
|
|
|
*/
|
|
|
|
|
public static ScopeUtilFilter getScopeUtilFilter(HttpSession httpSession){
|
|
|
|
|
public static ScopeUtilFilter getScopeUtilFilter(HttpServletRequest httpServletRequest){
|
|
|
|
|
|
|
|
|
|
ASLSession session = getAslSession(httpSession);
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
HttpSession session = httpServletRequest.getSession();
|
|
|
|
|
ScopeUtilFilter scopeUtil = null;
|
|
|
|
|
try{
|
|
|
|
|
scopeUtil = (ScopeUtilFilter) session.getAttribute(WsUtil.WORKSPACE_SCOPE_UTIL);
|
|
|
|
|
|
|
|
|
|
if(scopeUtil==null){
|
|
|
|
|
scopeUtil = new ScopeUtilFilter(session.getScopeName(),true);
|
|
|
|
|
scopeUtil = new ScopeUtilFilter(info.getCurrentScope(),true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
@ -336,12 +288,13 @@ public class WsUtil {
|
|
|
|
|
/**
|
|
|
|
|
* Gets the url shortener.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the url shortener
|
|
|
|
|
*/
|
|
|
|
|
public static UrlShortener getUrlShortener(HttpSession httpSession) {
|
|
|
|
|
public static UrlShortener getUrlShortener(HttpServletRequest httpServletRequest) {
|
|
|
|
|
|
|
|
|
|
ASLSession session = getAslSession(httpSession);
|
|
|
|
|
HttpSession session = httpServletRequest.getSession();
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
UrlShortener shortener = null;
|
|
|
|
|
try{
|
|
|
|
|
shortener = (UrlShortener) session.getAttribute(WsUtil.URL_SHORTENER_SERVICE);
|
|
|
|
@ -362,19 +315,19 @@ public class WsUtil {
|
|
|
|
|
/**
|
|
|
|
|
* Gets the uri resolver.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @return the uri resolver
|
|
|
|
|
*/
|
|
|
|
|
public static UriResolverReaderParameterForResolverIndex getUriResolver(HttpSession httpSession) {
|
|
|
|
|
|
|
|
|
|
ASLSession session = getAslSession(httpSession);
|
|
|
|
|
public static UriResolverReaderParameterForResolverIndex getUriResolver(HttpServletRequest httpServletRequest) {
|
|
|
|
|
|
|
|
|
|
HttpSession session = httpServletRequest.getSession();
|
|
|
|
|
PortalContextInfo info = getPortalContext(httpServletRequest);
|
|
|
|
|
UriResolverReaderParameterForResolverIndex uriResolver = null;
|
|
|
|
|
try{
|
|
|
|
|
uriResolver = (UriResolverReaderParameterForResolverIndex) session.getAttribute(WsUtil.URI_RESOLVER_SERVICE);
|
|
|
|
|
|
|
|
|
|
if(uriResolver==null){
|
|
|
|
|
uriResolver = new UriResolverReaderParameterForResolverIndex(session.getScope().toString(),RESOLVER_TYPE.SMP_ID);
|
|
|
|
|
uriResolver = new UriResolverReaderParameterForResolverIndex(info.getCurrentScope(),RESOLVER_TYPE.SMP_ID);
|
|
|
|
|
session.setAttribute(URI_RESOLVER_SERVICE, uriResolver);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -388,12 +341,12 @@ public class WsUtil {
|
|
|
|
|
/**
|
|
|
|
|
* Gets the property special folder reader.
|
|
|
|
|
*
|
|
|
|
|
* @param httpSession the http session
|
|
|
|
|
* @param httpServletRequest the http servlet request
|
|
|
|
|
* @param pathProperty the path property
|
|
|
|
|
* @return the property special folder reader
|
|
|
|
|
*/
|
|
|
|
|
public static PropertySpecialFolderReader getPropertySpecialFolderReader(HttpSession httpSession, String pathProperty) {
|
|
|
|
|
ASLSession session = getAslSession(httpSession);
|
|
|
|
|
public static PropertySpecialFolderReader getPropertySpecialFolderReader(HttpServletRequest httpServletRequest, String pathProperty) {
|
|
|
|
|
HttpSession session = httpServletRequest.getSession();
|
|
|
|
|
|
|
|
|
|
PropertySpecialFolderReader psFolderReader = null;
|
|
|
|
|
try{
|
|
|
|
|