[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"?>
|
||||
<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>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</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>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -33,5 +33,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</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>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<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"
|
||||
date="2017-10-10">
|
||||
<Change>Removed markAsRead method. It is performed by HL</Change>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -9,7 +9,7 @@
|
|||
</parent>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>workspace-explorer-app</artifactId>
|
||||
<version>1.0.2-SNAPSHOT</version>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<description>
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.slf4j.LoggerFactory;
|
|||
public class WsUtil {
|
||||
|
||||
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.
|
||||
|
@ -53,16 +54,18 @@ public class WsUtil {
|
|||
* @return the scope
|
||||
*/
|
||||
public static String getScope(HttpSession httpSession){
|
||||
String scope = (String) httpSession.getAttribute(SCOPE);
|
||||
logger.info(SCOPE + " read from httpsession is: "+scope);
|
||||
String scope = (String) httpSession.getAttribute(SESSION_SCOPE);
|
||||
logger.info("Variable "+SESSION_SCOPE + " read from httpsession is: "+scope);
|
||||
|
||||
if(scope==null){
|
||||
logger.info(SCOPE + " is null reading from context");
|
||||
scope = httpSession.getServletContext().getInitParameter(SCOPE);
|
||||
logger.info(SCOPE + " read from context is: "+scope);
|
||||
logger.info("Variable "+SESSION_SCOPE + " is null reading from web.xml context");
|
||||
String variableScopeName = httpSession.getServletContext().getInitParameter(ENVIRONMENT_VARIABLE_SCOPE_NAME);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
version="2.5">
|
||||
<context-param>
|
||||
<description>scope for using HL</description>
|
||||
<param-name>scope</param-name>
|
||||
<description>Scope used ton instance the HL</description>
|
||||
<param-name>EnvironmentVariableScope</param-name>
|
||||
<!-- <param-value>/d4science.research-infrastructures.eu</param-value> -->
|
||||
<param-value>/gcube</param-value>
|
||||
<param-value>SCOPE</param-value>
|
||||
</context-param>
|
||||
<servlet>
|
||||
<servlet-name>workspaceExplorerAppServlet</servlet-name>
|
||||
|
|
Loading…
Reference in New Issue