[Feature #9926] read the scope from environment variable
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/workspace-explorer-app@155116 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c3f8cb442d
commit
9e497e92a6
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/workspace-explorer-app-1.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/workspace-explorer-app-1.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/workspace-explorer-app-1.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/workspace-explorer-app-1.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -33,5 +33,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/workspace-explorer-app-1.0.1-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/workspace-explorer-app-1.0.2-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets-user.workspace-explorer-app.1-1-0"
|
||||||
|
date="2017-10-11">
|
||||||
|
<Change>[Feature #9926] read the scope from environment variable</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.workspace-explorer-app.1-0-2"
|
<Changeset component="org.gcube.portlets-user.workspace-explorer-app.1-0-2"
|
||||||
date="2017-10-10">
|
date="2017-10-10">
|
||||||
<Change>Removed markAsRead method. It is performed by HL</Change>
|
<Change>Removed markAsRead method. It is performed by HL</Change>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -9,7 +9,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>workspace-explorer-app</artifactId>
|
<artifactId>workspace-explorer-app</artifactId>
|
||||||
<version>1.0.2-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -25,7 +25,8 @@ import org.slf4j.LoggerFactory;
|
||||||
public class WsUtil {
|
public class WsUtil {
|
||||||
|
|
||||||
public static final Logger logger = LoggerFactory.getLogger(WsUtil.class);
|
public static final Logger logger = LoggerFactory.getLogger(WsUtil.class);
|
||||||
public static final String SCOPE = "scope";
|
public static final String ENVIRONMENT_VARIABLE_SCOPE_NAME = "EnvironmentVariableScope";
|
||||||
|
public static final String SESSION_SCOPE = "session_scope";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workspace.
|
* Gets the workspace.
|
||||||
|
@ -53,16 +54,18 @@ public class WsUtil {
|
||||||
* @return the scope
|
* @return the scope
|
||||||
*/
|
*/
|
||||||
public static String getScope(HttpSession httpSession){
|
public static String getScope(HttpSession httpSession){
|
||||||
String scope = (String) httpSession.getAttribute(SCOPE);
|
String scope = (String) httpSession.getAttribute(SESSION_SCOPE);
|
||||||
logger.info(SCOPE + " read from httpsession is: "+scope);
|
logger.info("Variable "+SESSION_SCOPE + " read from httpsession is: "+scope);
|
||||||
|
|
||||||
if(scope==null){
|
if(scope==null){
|
||||||
logger.info(SCOPE + " is null reading from context");
|
logger.info("Variable "+SESSION_SCOPE + " is null reading from web.xml context");
|
||||||
scope = httpSession.getServletContext().getInitParameter(SCOPE);
|
String variableScopeName = httpSession.getServletContext().getInitParameter(ENVIRONMENT_VARIABLE_SCOPE_NAME);
|
||||||
logger.info(SCOPE + " read from context is: "+scope);
|
logger.info("Found param-value '"+variableScopeName+"' from web context, reading its value from ENVIRONMENT");
|
||||||
|
scope = System.getenv(variableScopeName);
|
||||||
|
logger.info("Value of "+variableScopeName+" from ENVIRONMENT is: "+scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
httpSession.setAttribute(SCOPE, scope);
|
httpSession.setAttribute(ENVIRONMENT_VARIABLE_SCOPE_NAME, scope);
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
version="2.5">
|
version="2.5">
|
||||||
<context-param>
|
<context-param>
|
||||||
<description>scope for using HL</description>
|
<description>Scope used ton instance the HL</description>
|
||||||
<param-name>scope</param-name>
|
<param-name>EnvironmentVariableScope</param-name>
|
||||||
<!-- <param-value>/d4science.research-infrastructures.eu</param-value> -->
|
<!-- <param-value>/d4science.research-infrastructures.eu</param-value> -->
|
||||||
<param-value>/gcube</param-value>
|
<param-value>SCOPE</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>workspaceExplorerAppServlet</servlet-name>
|
<servlet-name>workspaceExplorerAppServlet</servlet-name>
|
||||||
|
|
Loading…
Reference in New Issue