jcabrerizo commented on a change in pull request #1079: Adding logic to manage a max session age URL: https://github.com/apache/brooklyn-server/pull/1079#discussion_r365734620
########## File path: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java ########## @@ -80,36 +95,53 @@ private static final String KEY_PREFERRED_SESSION_HANDLER_INSTANCE = "org.apache.brooklyn.server.PreferredSessionHandlerInstance"; private static final String KEY_IS_PREFERRED = "org.apache.brooklyn.server.IsPreferred"; - private static final int MAX_INACTIVE_INTERVAL = 3601; + public final static ConfigKey<Long> MAX_SESSION_AGE = ConfigKeys.newLongConfigKey( + "org.apache.brooklyn.server.maxSessionAge", "Max session age in seconds"); - private static final Object PREFERRED_SYMBOLIC_NAME = + public final static ConfigKey<Integer> MAX_INACTIVE_INTERVAL = ConfigKeys.newIntegerConfigKey( + "org.apache.brooklyn.server.maxInactiveInterval", "Max inactive interval in seconds", + 3601); + + private static final Object PREFERRED_SYMBOLIC_NAME = "org.apache.cxf.cxf-rt-transports-http"; //// our bundle here doesn't have a session handler; sessions to the REST API get the handler from CXF //"org.apache.brooklyn.rest.rest-resources"; private final HttpSession preferredSession; private final HttpSession localSession; + private final ManagementContext mgmt; private boolean silentlyAcceptLocalOnlyValues = false; private boolean setLocalValuesAlso = false; private boolean setAllKnownSessions = false; private static final Factory FACTORY = new Factory(); - protected MultiSessionAttributeAdapter(HttpSession preferredSession, HttpSession localSession) { + protected MultiSessionAttributeAdapter(HttpSession preferredSession, HttpSession localSession, HttpServletRequest request) { this.preferredSession = preferredSession; this.localSession = localSession; + ServletContext servletContext = request!=null ? request.getServletContext() : localSession!=null ? localSession.getServletContext() : preferredSession!=null ? preferredSession.getServletContext() : null; Review comment: Yes it is, but replace with if or wrapping it on a method with three parameters seems to be unclear too. I'll separate in different lines to emphasize the different possible values ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services