test_class.declarator: defaultHttpContext
test_class.modifier: protected
test_class.original_string: protected HttpContext defaultHttpContext;
test_class.type: HttpContext
test_class.var_name: defaultHttpContext
test_class.declarator: httpContext
test_class.modifier: protected
test_class.original_string: protected SecurityDelegatingHttpContext httpContext;
test_class.type: SecurityDelegatingHttpContext
test_class.var_name: httpContext
test_class.declarator: commitFilter
test_class.modifier: protected
test_class.original_string: protected CommitResponseFilter commitFilter;
test_class.type: CommitResponseFilter
test_class.var_name: commitFilter
test_class.declarator: doNothingFilter
test_class.modifier: protected
test_class.original_string: protected DoNothingFilter doNothingFilter;
test_class.type: DoNothingFilter
test_class.var_name: doNothingFilter
test_class.declarator: accessDeniedFilter
test_class.modifier: protected
test_class.original_string: protected AccessDeniedFilter accessDeniedFilter;
test_class.type: AccessDeniedFilter
test_class.var_name: accessDeniedFilter
test_class.declarator: mimeType
test_class.modifier: protected
test_class.original_string: protected String mimeType;
test_class.type: String
test_class.var_name: mimeType
test_class.declarator: url
test_class.modifier: protected
test_class.original_string: protected URL url;
test_class.type: URL
test_class.var_name: url
test_class.file: common/src/test/java/org/apache/cxf/dosgi/common/httpservice/SecurityDelegatingHttpContextTest.java
test_class.identifier: SecurityDelegatingHttpContextTest
test_case.body: @Test
      public void testFilterChain() throws Exception {
          // Mock up the service references
          ServiceReference filterReference = EasyMock.createNiceMock(ServiceReference.class);
          EasyMock.replay(filterReference);
          ServiceReference[] serviceReferences = {filterReference, filterReference};
  
          // Mock up the bundle context
          BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
          EasyMock.expect(bundleContext.getServiceReferences((String)EasyMock.anyObject(), (String)EasyMock.anyObject()))
              .andReturn(serviceReferences);
          EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(doNothingFilter);
          EasyMock.expect(bundleContext.getService((ServiceReference)EasyMock.anyObject())).andReturn(commitFilter);
          EasyMock.replay(bundleContext);
  
          // Set up the secure http context
          httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
  
          // Ensure that the httpContext returns false, since the filter has committed the response
          HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
          EasyMock.replay(request);
          HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
          EasyMock.expect(response.isCommitted()).andReturn(false); // doNothingFilter should not commit the response
          EasyMock.expect(response.getWriter()).andReturn(new PrintWriter(System.out));
          EasyMock.expect(response.isCommitted()).andReturn(false);
          EasyMock.expect(response.isCommitted()).andReturn(true); // the commit filter indicating that it committed the
                                                                   // response
          EasyMock.replay(response);
          assertFalse(httpContext.handleSecurity(request, response));
  
          // Ensure that the appropriate filters were called
          assertTrue(doNothingFilter.called);
          assertTrue(commitFilter.called);
          assertFalse(accessDeniedFilter.called);
      }
test_case.class_method_signature: SecurityDelegatingHttpContextTest.testFilterChain()
test_case.full_signature: @Test public void testFilterChain()
test_case.identifier: testFilterChain
test_case.invocations: createNiceMock replay createNiceMock andReturn expect getServiceReferences anyObject anyObject andReturn expect getService anyObject andReturn expect getService anyObject replay createNiceMock replay createNiceMock andReturn expect isCommitted andReturn expect getWriter andReturn expect isCommitted andReturn expect isCommitted replay assertFalse handleSecurity assertTrue assertTrue assertFalse
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFilterChain()
focal_class.declarator: FILTER_PROP = "org.apache.cxf.httpservice.filter"
focal_class.modifier: public static final
focal_class.original_string: public static final String FILTER_PROP = "org.apache.cxf.httpservice.filter";
focal_class.type: String
focal_class.var_name: FILTER_PROP
focal_class.declarator: FILTER_REQUIRED_PROP = "org.apache.cxf.httpservice.requirefilter"
focal_class.modifier: public static final
focal_class.original_string: public static final String FILTER_REQUIRED_PROP = "org.apache.cxf.httpservice.requirefilter";
focal_class.type: String
focal_class.var_name: FILTER_REQUIRED_PROP
focal_class.declarator: LOG = LoggerFactory.getLogger(SecurityDelegatingHttpContext.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(SecurityDelegatingHttpContext.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: FILTER_FILTER = "(" + FILTER_PROP + "=*)"
focal_class.modifier: private static final
focal_class.original_string: private static final String FILTER_FILTER = "(" + FILTER_PROP + "=*)";
focal_class.type: String
focal_class.var_name: FILTER_FILTER
focal_class.declarator: bundleContext
focal_class.original_string: BundleContext bundleContext;
focal_class.type: BundleContext
focal_class.var_name: bundleContext
focal_class.declarator: delegate
focal_class.original_string: HttpContext delegate;
focal_class.type: HttpContext
focal_class.var_name: delegate
focal_class.declarator: requireFilter
focal_class.original_string: boolean requireFilter;
focal_class.type: boolean
focal_class.var_name: requireFilter
focal_class.file: common/src/main/java/org/apache/cxf/dosgi/common/httpservice/SecurityDelegatingHttpContext.java
focal_class.identifier: SecurityDelegatingHttpContext
focal_class.interfaces: implements HttpContext
focal_class.class_method_signature: SecurityDelegatingHttpContext.SecurityDelegatingHttpContext(BundleContext bundleContext, HttpContext delegate)
focal_class.full_signature:   SecurityDelegatingHttpContext(BundleContext bundleContext, HttpContext delegate)
focal_class.identifier: SecurityDelegatingHttpContext
focal_class.parameters: (BundleContext bundleContext, HttpContext delegate)
focal_class.signature:  SecurityDelegatingHttpContext(BundleContext bundleContext, HttpContext delegate)
focal_class.class_method_signature: SecurityDelegatingHttpContext.getMimeType(String name)
focal_class.full_signature: @Override public String getMimeType(String name)
focal_class.identifier: getMimeType
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: String
focal_class.signature: String getMimeType(String name)
focal_class.class_method_signature: SecurityDelegatingHttpContext.getResource(String name)
focal_class.full_signature: @Override public URL getResource(String name)
focal_class.identifier: getResource
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: URL
focal_class.signature: URL getResource(String name)
focal_class.class_method_signature: SecurityDelegatingHttpContext.handleSecurity(HttpServletRequest request, HttpServletResponse response)
focal_class.full_signature: @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response)
focal_class.identifier: handleSecurity
focal_class.modifiers: @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public
focal_class.parameters: (HttpServletRequest request, HttpServletResponse response)
focal_class.return: boolean
focal_class.signature: boolean handleSecurity(HttpServletRequest request, HttpServletResponse response)
focal_method.body: @Override
      @SuppressWarnings({
       "unchecked", "rawtypes"
      })
      public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
          ServiceReference[] refs;
          try {
              refs = bundleContext.getServiceReferences(Filter.class.getName(), FILTER_FILTER);
          } catch (InvalidSyntaxException e) {
              LOG.warn(e.getMessage(), e);
              return false;
          }
          if (refs == null || refs.length == 0) {
              LOG.info("No filter registered.");
              return !requireFilter;
          }
          Filter[] filters = new Filter[refs.length];
          try {
              for (int i = 0; i < refs.length; i++) {
                  filters[i] = (Filter)bundleContext.getService(refs[i]);
              }
              try {
                  new Chain(filters).doFilter(request, response);
                  return !response.isCommitted();
              } catch (ServletException e) {
                  LOG.warn(e.getMessage(), e);
                  return false;
              }
          } finally {
              for (int i = 0; i < refs.length; i++) {
                  if (filters[i] != null) {
                      bundleContext.ungetService(refs[i]);
                  }
              }
          }
      }
focal_method.class_method_signature: SecurityDelegatingHttpContext.handleSecurity(HttpServletRequest request, HttpServletResponse response)
focal_method.full_signature: @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response)
focal_method.identifier: handleSecurity
focal_method.invocations: getServiceReferences getName warn getMessage info getService doFilter isCommitted warn getMessage ungetService
focal_method.modifiers: @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public
focal_method.parameters: (HttpServletRequest request, HttpServletResponse response)
focal_method.return: boolean
focal_method.signature: boolean handleSecurity(HttpServletRequest request, HttpServletResponse response)