test_class.declarator: servletContext
test_class.modifier: private
test_class.original_string: private ServletContext servletContext;
test_class.type: ServletContext
test_class.var_name: servletContext
test_class.declarator: sessionHelpers
test_class.modifier: private
test_class.original_string: private SessionHelpers sessionHelpers;
test_class.type: SessionHelpers
test_class.var_name: sessionHelpers
test_class.declarator: sessionManager
test_class.modifier: private
test_class.original_string: private SessionManager sessionManager;
test_class.type: SessionManager
test_class.var_name: sessionManager
test_class.declarator: sessionConfiguration
test_class.modifier: private
test_class.original_string: private SessionConfiguration sessionConfiguration;
test_class.type: SessionConfiguration
test_class.var_name: sessionConfiguration
test_class.file: session-replacement/src/test/java/com/amadeus/session/servlet/TestSessionHelpers.java
test_class.identifier: TestSessionHelpers
test_case.body: @Test
    public void testPrepareRequestNotInitializedFilter() {
      ServletRequest request = mock(HttpServletRequest.class);
      when(request.getServletContext()).thenReturn(servletContext);
      ServletResponse response = mock(HttpServletResponse.class);
      ServletRequest result = SessionHelpersFacade.prepareRequest(request, response, null);
      assertNotNull(result);
      assertNotSame(request, result);
      assertTrue(result instanceof HttpRequestWrapper);
      verify(request).setAttribute(eq(SessionHelpers.REQUEST_WRAPPED_ATTRIBUTE), refEq(result));
    }
test_case.class_method_signature: TestSessionHelpers.testPrepareRequestNotInitializedFilter()
test_case.full_signature: @Test public void testPrepareRequestNotInitializedFilter()
test_case.identifier: testPrepareRequestNotInitializedFilter
test_case.invocations: mock thenReturn when getServletContext mock prepareRequest assertNotNull assertNotSame assertTrue setAttribute verify eq refEq
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPrepareRequestNotInitializedFilter()
focal_class.declarator: logger = LoggerFactory.getLogger(SessionHelpers.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(SessionHelpers.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: DUMMY_ATTRIBUTE = "com.amadeus.session.dummy"
focal_class.modifier: static final
focal_class.original_string: static final String DUMMY_ATTRIBUTE = "com.amadeus.session.dummy";
focal_class.type: String
focal_class.var_name: DUMMY_ATTRIBUTE
focal_class.declarator: SESSION_HELPER_METHODS = "com.amadeus.session.servlet.SessionHelpers.methods"
focal_class.modifier: static final
focal_class.original_string: static final String SESSION_HELPER_METHODS = "com.amadeus.session.servlet.SessionHelpers.methods";
focal_class.type: String
focal_class.var_name: SESSION_HELPER_METHODS
focal_class.declarator: DEFAULT_REPOSITORY_FACTORY = "com.amadeus.session.repository.inmemory.InMemoryRepositoryFactory"
focal_class.modifier: static final
focal_class.original_string: static final String DEFAULT_REPOSITORY_FACTORY = "com.amadeus.session.repository.inmemory.InMemoryRepositoryFactory";
focal_class.type: String
focal_class.var_name: DEFAULT_REPOSITORY_FACTORY
focal_class.declarator: INTROSPECTING_LISTENERS = "com.amadeus.session.introspected.listeners"
focal_class.modifier: static final
focal_class.original_string: static final String INTROSPECTING_LISTENERS = "com.amadeus.session.introspected.listeners";
focal_class.type: String
focal_class.var_name: INTROSPECTING_LISTENERS
focal_class.declarator: REQUEST_WRAPPED_ATTRIBUTE = HttpRequestWrapper.class.getName()
focal_class.modifier: static final
focal_class.original_string: static final String REQUEST_WRAPPED_ATTRIBUTE = HttpRequestWrapper.class.getName();
focal_class.type: String
focal_class.var_name: REQUEST_WRAPPED_ATTRIBUTE
focal_class.declarator: SESSION_CONFIGURATION = SessionConfiguration.class.getName()
focal_class.modifier: static final
focal_class.original_string: static final String SESSION_CONFIGURATION = SessionConfiguration.class.getName();
focal_class.type: String
focal_class.var_name: SESSION_CONFIGURATION
focal_class.declarator: SESSION_HELPERS = SessionHelpers.class.getName()
focal_class.modifier: static final
focal_class.original_string: static final String SESSION_HELPERS = SessionHelpers.class.getName();
focal_class.type: String
focal_class.var_name: SESSION_HELPERS
focal_class.declarator: interceptListeners
focal_class.modifier: private
focal_class.original_string: private boolean interceptListeners;
focal_class.type: boolean
focal_class.var_name: interceptListeners
focal_class.file: session-replacement/src/main/java/com/amadeus/session/servlet/SessionHelpers.java
focal_class.identifier: SessionHelpers
focal_class.class_method_signature: SessionHelpers.prepareRequest(ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)
focal_class.full_signature: public ServletRequest prepareRequest(ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)
focal_class.identifier: prepareRequest
focal_class.modifiers: public
focal_class.parameters: (ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)
focal_class.return: ServletRequest
focal_class.signature: ServletRequest prepareRequest(ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)
focal_class.class_method_signature: SessionHelpers.wrapResponse(ServletResponse response, HttpRequestWrapper wrappedRequest)
focal_class.full_signature: private static HttpResponseWrapper wrapResponse(ServletResponse response, HttpRequestWrapper wrappedRequest)
focal_class.identifier: wrapResponse
focal_class.modifiers: private static
focal_class.parameters: (ServletResponse response, HttpRequestWrapper wrappedRequest)
focal_class.return: HttpResponseWrapper
focal_class.signature: HttpResponseWrapper wrapResponse(ServletResponse response, HttpRequestWrapper wrappedRequest)
focal_class.class_method_signature: SessionHelpers.wrapRequest(ServletRequest request, ServletContext servletContext)
focal_class.full_signature: private static HttpRequestWrapper wrapRequest(ServletRequest request, ServletContext servletContext)
focal_class.identifier: wrapRequest
focal_class.modifiers: private static
focal_class.parameters: (ServletRequest request, ServletContext servletContext)
focal_class.return: HttpRequestWrapper
focal_class.signature: HttpRequestWrapper wrapRequest(ServletRequest request, ServletContext servletContext)
focal_class.class_method_signature: SessionHelpers.prepareResponse(ServletRequest request, ServletResponse response)
focal_class.full_signature: public ServletResponse prepareResponse(ServletRequest request, ServletResponse response)
focal_class.identifier: prepareResponse
focal_class.modifiers: public
focal_class.parameters: (ServletRequest request, ServletResponse response)
focal_class.return: ServletResponse
focal_class.signature: ServletResponse prepareResponse(ServletRequest request, ServletResponse response)
focal_class.class_method_signature: SessionHelpers.initSessionManagement(ServletContext servletContext)
focal_class.full_signature: public MethodHandle[] initSessionManagement(ServletContext servletContext)
focal_class.identifier: initSessionManagement
focal_class.modifiers: public
focal_class.parameters: (ServletContext servletContext)
focal_class.return: MethodHandle[]
focal_class.signature: MethodHandle[] initSessionManagement(ServletContext servletContext)
focal_class.class_method_signature: SessionHelpers.initSessionManagement(ServletContext servletContext, boolean reset)
focal_class.full_signature: public MethodHandle[] initSessionManagement(ServletContext servletContext, boolean reset)
focal_class.identifier: initSessionManagement
focal_class.modifiers: public
focal_class.parameters: (ServletContext servletContext, boolean reset)
focal_class.return: MethodHandle[]
focal_class.signature: MethodHandle[] initSessionManagement(ServletContext servletContext, boolean reset)
focal_class.class_method_signature: SessionHelpers.prepareMethodCalls(ServletContext servletContext)
focal_class.full_signature: private MethodHandle[] prepareMethodCalls(ServletContext servletContext)
focal_class.identifier: prepareMethodCalls
focal_class.modifiers: private
focal_class.parameters: (ServletContext servletContext)
focal_class.return: MethodHandle[]
focal_class.signature: MethodHandle[] prepareMethodCalls(ServletContext servletContext)
focal_class.class_method_signature: SessionHelpers.getTracking(ServletContext servletContext, SessionConfiguration sessionConfiguration)
focal_class.full_signature: static SessionTracking getTracking(ServletContext servletContext, SessionConfiguration sessionConfiguration)
focal_class.identifier: getTracking
focal_class.modifiers: static
focal_class.parameters: (ServletContext servletContext, SessionConfiguration sessionConfiguration)
focal_class.return: SessionTracking
focal_class.signature: SessionTracking getTracking(ServletContext servletContext, SessionConfiguration sessionConfiguration)
focal_class.class_method_signature: SessionHelpers.trackingFromEnum(String sessionTracking)
focal_class.full_signature: static SessionTracking trackingFromEnum(String sessionTracking)
focal_class.identifier: trackingFromEnum
focal_class.modifiers: static
focal_class.parameters: (String sessionTracking)
focal_class.return: SessionTracking
focal_class.signature: SessionTracking trackingFromEnum(String sessionTracking)
focal_class.class_method_signature: SessionHelpers.repository(ServletContext servletContext, SessionConfiguration conf)
focal_class.full_signature: static SessionRepository repository(ServletContext servletContext, SessionConfiguration conf)
focal_class.identifier: repository
focal_class.modifiers: static
focal_class.parameters: (ServletContext servletContext, SessionConfiguration conf)
focal_class.return: SessionRepository
focal_class.signature: SessionRepository repository(ServletContext servletContext, SessionConfiguration conf)
focal_class.class_method_signature: SessionHelpers.repositoryOrDefault(String repositoryFactory, ServletContext context,
        SessionConfiguration conf)
focal_class.full_signature: static SessionRepository repositoryOrDefault(String repositoryFactory, ServletContext context,
        SessionConfiguration conf)
focal_class.identifier: repositoryOrDefault
focal_class.modifiers: static
focal_class.parameters: (String repositoryFactory, ServletContext context,
        SessionConfiguration conf)
focal_class.return: SessionRepository
focal_class.signature: SessionRepository repositoryOrDefault(String repositoryFactory, ServletContext context,
        SessionConfiguration conf)
focal_class.class_method_signature: SessionHelpers.newInstance(ServletContext servletContext, String implementationClass)
focal_class.full_signature: private static Object newInstance(ServletContext servletContext, String implementationClass)
focal_class.identifier: newInstance
focal_class.modifiers: private static
focal_class.parameters: (ServletContext servletContext, String implementationClass)
focal_class.return: Object
focal_class.signature: Object newInstance(ServletContext servletContext, String implementationClass)
focal_class.class_method_signature: SessionHelpers.classLoader(ServletContext servletContext)
focal_class.full_signature: private static ClassLoader classLoader(ServletContext servletContext)
focal_class.identifier: classLoader
focal_class.modifiers: private static
focal_class.parameters: (ServletContext servletContext)
focal_class.return: ClassLoader
focal_class.signature: ClassLoader classLoader(ServletContext servletContext)
focal_class.class_method_signature: SessionHelpers.initConf(final ServletContext context)
focal_class.full_signature: static SessionConfiguration initConf(final ServletContext context)
focal_class.identifier: initConf
focal_class.modifiers: static
focal_class.parameters: (final ServletContext context)
focal_class.return: SessionConfiguration
focal_class.signature: SessionConfiguration initConf(final ServletContext context)
focal_class.class_method_signature: SessionHelpers.commitRequest(ServletRequest request, ServletRequest oldRequest)
focal_class.full_signature: public void commitRequest(ServletRequest request, ServletRequest oldRequest)
focal_class.identifier: commitRequest
focal_class.modifiers: public
focal_class.parameters: (ServletRequest request, ServletRequest oldRequest)
focal_class.return: void
focal_class.signature: void commitRequest(ServletRequest request, ServletRequest oldRequest)
focal_class.class_method_signature: SessionHelpers.findListenersByIntercepting(ServletContext context, HttpServletRequest request)
focal_class.full_signature: static void findListenersByIntercepting(ServletContext context, HttpServletRequest request)
focal_class.identifier: findListenersByIntercepting
focal_class.modifiers: static
focal_class.parameters: (ServletContext context, HttpServletRequest request)
focal_class.return: void
focal_class.signature: void findListenersByIntercepting(ServletContext context, HttpServletRequest request)
focal_class.class_method_signature: SessionHelpers.interceptHttpListener(EventListener caller, HttpSessionEvent event)
focal_class.full_signature: @SuppressWarnings("unchecked") public void interceptHttpListener(EventListener caller, HttpSessionEvent event)
focal_class.identifier: interceptHttpListener
focal_class.modifiers: @SuppressWarnings("unchecked") public
focal_class.parameters: (EventListener caller, HttpSessionEvent event)
focal_class.return: void
focal_class.signature: void interceptHttpListener(EventListener caller, HttpSessionEvent event)
focal_class.class_method_signature: SessionHelpers.getDescriptor(ServletContext servletContext)
focal_class.full_signature: private ServletContextDescriptor getDescriptor(ServletContext servletContext)
focal_class.identifier: getDescriptor
focal_class.modifiers: private
focal_class.parameters: (ServletContext servletContext)
focal_class.return: ServletContextDescriptor
focal_class.signature: ServletContextDescriptor getDescriptor(ServletContext servletContext)
focal_class.class_method_signature: SessionHelpers.onAddListener(ServletContext servletContext, Object listener)
focal_class.full_signature: public void onAddListener(ServletContext servletContext, Object listener)
focal_class.identifier: onAddListener
focal_class.modifiers: public
focal_class.parameters: (ServletContext servletContext, Object listener)
focal_class.return: void
focal_class.signature: void onAddListener(ServletContext servletContext, Object listener)
focal_class.class_method_signature: SessionHelpers.setupContext(ServletContext context)
focal_class.full_signature: static void setupContext(ServletContext context)
focal_class.identifier: setupContext
focal_class.modifiers: static
focal_class.parameters: (ServletContext context)
focal_class.return: void
focal_class.signature: void setupContext(ServletContext context)
focal_method.body: public ServletRequest prepareRequest(ServletRequest request, ServletResponse response,
        ServletContext originalServletContext) {
      // Only execute this code once per request
      if (request instanceof HttpServletRequest && response instanceof HttpServletResponse) {
        HttpRequestWrapper wrappedRequest = (HttpRequestWrapper)request.getAttribute(REQUEST_WRAPPED_ATTRIBUTE);
        ServletContext servletContext = originalServletContext;
        if (servletContext == null) {
          logger.info("ServletContext was null when prepareRequest() was called from Filter. "
              + "This means that filter's init() method was not called at initialization time. "
              + "This may result in unexpected behavior if this filter was invoked after"
              + "servlet dispatch forward() and include() calls.");
          servletContext = ((HttpServletRequest)request).getServletContext();
        }
  
        // for following we actually test that servlet context points to same
        // references, and so we don't use equals() method
        if (wrappedRequest == null || servletContext != wrappedRequest.getServletContext()) { // NOSONAR
          if (interceptListeners) {
            findListenersByIntercepting(servletContext, (HttpServletRequest)request);
          }
          wrappedRequest = wrapRequest(request, servletContext);
          wrappedRequest.setResponse(wrapResponse(response, wrappedRequest));
          request.setAttribute(REQUEST_WRAPPED_ATTRIBUTE, wrappedRequest);
          return wrappedRequest;
        }
      }
      return request;
    }
focal_method.class_method_signature: SessionHelpers.prepareRequest(ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)
focal_method.full_signature: public ServletRequest prepareRequest(ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)
focal_method.identifier: prepareRequest
focal_method.invocations: getAttribute info getServletContext getServletContext findListenersByIntercepting wrapRequest setResponse wrapResponse setAttribute
focal_method.modifiers: public
focal_method.parameters: (ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)
focal_method.return: ServletRequest
focal_method.signature: ServletRequest prepareRequest(ServletRequest request, ServletResponse response,
        ServletContext originalServletContext)