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 testFilterRequired() throws Exception {
          // Mock up the service references
          ServiceReference[] serviceReferences = {};
  
          // Mock up the bundle context
          BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
          EasyMock.expect(bundleContext.getServiceReferences(Filter.class.getName(),
                                                             "(org.apache.cxf.httpservice.filter=true)"))
              .andReturn(serviceReferences);
          EasyMock.replay(bundleContext);
  
          // Set up the secure http context
          httpContext = new SecurityDelegatingHttpContext(bundleContext, defaultHttpContext);
          httpContext.requireFilter = true;
  
          // Ensure that the httpContext doesn't allow the request to be processed, since there are no registered servlet
          // filters
          HttpServletRequest request = EasyMock.createNiceMock(HttpServletRequest.class);
          EasyMock.replay(request);
          HttpServletResponse response = EasyMock.createNiceMock(HttpServletResponse.class);
          EasyMock.replay(response);
          boolean requestAllowed = httpContext.handleSecurity(request, response);
          assertFalse(requestAllowed);
  
          // Ensure that the httpContext returns true if there is no requirement for registered servlet filters
          httpContext.requireFilter = false;
          requestAllowed = httpContext.handleSecurity(request, response);
          assertTrue(requestAllowed);
      }
test_case.class_method_signature: SecurityDelegatingHttpContextTest.testFilterRequired()
test_case.full_signature: @Test public void testFilterRequired()
test_case.identifier: testFilterRequired
test_case.invocations: createNiceMock andReturn expect getServiceReferences getName replay createNiceMock replay createNiceMock replay handleSecurity assertFalse handleSecurity assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFilterRequired()
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)