test_class.declarator: CONTENT_TYPE_HEADER = HttpHeaders.CONTENT_TYPE
test_class.modifier: private static final
test_class.original_string: private static final String CONTENT_TYPE_HEADER = HttpHeaders.CONTENT_TYPE;
test_class.type: String
test_class.var_name: CONTENT_TYPE_HEADER
test_class.declarator: ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers"
test_class.modifier: private static final
test_class.original_string: private static final String ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers";
test_class.type: String
test_class.var_name: ACCESS_CONTROL_REQUEST_HEADERS
test_class.declarator: ECLIPSE_ORIGIN = "http://eclipse.org"
test_class.modifier: private static final
test_class.original_string: private static final String ECLIPSE_ORIGIN = "http://eclipse.org";
test_class.type: String
test_class.var_name: ECLIPSE_ORIGIN
test_class.declarator: VARY_HEADER_VALUE = "Content-Type"
test_class.modifier: private static final
test_class.original_string: private static final String VARY_HEADER_VALUE = "Content-Type";
test_class.type: String
test_class.var_name: VARY_HEADER_VALUE
test_class.declarator: REQUEST_HEADERS = "X-Custom, X-Mine"
test_class.modifier: private static final
test_class.original_string: private static final String REQUEST_HEADERS = "X-Custom, X-Mine";
test_class.type: String
test_class.var_name: REQUEST_HEADERS
test_class.declarator: filter
test_class.modifier: private
test_class.original_string: private CorsFilter filter;
test_class.type: CorsFilter
test_class.var_name: filter
test_class.declarator: responseHeaders = new MultivaluedHashMap<>()
test_class.modifier: private
test_class.original_string: private MultivaluedMap<String, String> responseHeaders = new MultivaluedHashMap<>();
test_class.type: MultivaluedMap<String, String>
test_class.var_name: responseHeaders
test_class.declarator: requestContext
test_class.modifier: private @Mock
test_class.original_string: private @Mock ContainerRequestContext requestContext;
test_class.type: ContainerRequestContext
test_class.var_name: requestContext
test_class.declarator: responseContext
test_class.modifier: private @Mock
test_class.original_string: private @Mock ContainerResponseContext responseContext;
test_class.type: ContainerResponseContext
test_class.var_name: responseContext
test_class.file: bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/CorsFilterTest.java
test_class.identifier: CorsFilterTest
test_case.body: @Test
      public void partialCorsPreflightRequestTest() throws IOException {
          setupRequestContext(HTTP_OPTIONS_METHOD, ECLIPSE_ORIGIN, null, REQUEST_HEADERS);
          setupResponseContext(VARY_HEADER_VALUE);
  
          filter.filter(requestContext, responseContext);
  
          // Since the requestMethod header is not present in the request, it is not a valid Preflight CORS request.
          // Thus, no CORS header should be added to the response.
          assertResponseWithoutHeader(ACCESS_CONTROL_ALLOW_METHODS_HEADER);
          assertResponseWithoutHeader(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER);
          assertResponseWithoutHeader(ACCESS_CONTROL_ALLOW_HEADERS);
          assertResponseHasHeader(VARY_HEADER, VARY_HEADER_VALUE);
      }
test_case.class_method_signature: CorsFilterTest.partialCorsPreflightRequestTest()
test_case.full_signature: @Test public void partialCorsPreflightRequestTest()
test_case.identifier: partialCorsPreflightRequestTest
test_case.invocations: setupRequestContext setupResponseContext filter assertResponseWithoutHeader assertResponseWithoutHeader assertResponseWithoutHeader assertResponseHasHeader
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void partialCorsPreflightRequestTest()
focal_class.declarator: HTTP_HEAD_METHOD = "HEAD"
focal_class.modifier: static final
focal_class.original_string: static final String HTTP_HEAD_METHOD = "HEAD";
focal_class.type: String
focal_class.var_name: HTTP_HEAD_METHOD
focal_class.declarator: HTTP_DELETE_METHOD = "DELETE"
focal_class.modifier: static final
focal_class.original_string: static final String HTTP_DELETE_METHOD = "DELETE";
focal_class.type: String
focal_class.var_name: HTTP_DELETE_METHOD
focal_class.declarator: HTTP_PUT_METHOD = "PUT"
focal_class.modifier: static final
focal_class.original_string: static final String HTTP_PUT_METHOD = "PUT";
focal_class.type: String
focal_class.var_name: HTTP_PUT_METHOD
focal_class.declarator: HTTP_POST_METHOD = "POST"
focal_class.modifier: static final
focal_class.original_string: static final String HTTP_POST_METHOD = "POST";
focal_class.type: String
focal_class.var_name: HTTP_POST_METHOD
focal_class.declarator: HTTP_GET_METHOD = "GET"
focal_class.modifier: static final
focal_class.original_string: static final String HTTP_GET_METHOD = "GET";
focal_class.type: String
focal_class.var_name: HTTP_GET_METHOD
focal_class.declarator: HTTP_OPTIONS_METHOD = "OPTIONS"
focal_class.modifier: static final
focal_class.original_string: static final String HTTP_OPTIONS_METHOD = "OPTIONS";
focal_class.type: String
focal_class.var_name: HTTP_OPTIONS_METHOD
focal_class.declarator: CONTENT_TYPE_HEADER = HttpHeaders.CONTENT_TYPE
focal_class.modifier: static final
focal_class.original_string: static final String CONTENT_TYPE_HEADER = HttpHeaders.CONTENT_TYPE;
focal_class.type: String
focal_class.var_name: CONTENT_TYPE_HEADER
focal_class.declarator: ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"
focal_class.modifier: static final
focal_class.original_string: static final String ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method";
focal_class.type: String
focal_class.var_name: ACCESS_CONTROL_REQUEST_METHOD
focal_class.declarator: ACCESS_CONTROL_ALLOW_METHODS_HEADER = "Access-Control-Allow-Methods"
focal_class.modifier: static final
focal_class.original_string: static final String ACCESS_CONTROL_ALLOW_METHODS_HEADER = "Access-Control-Allow-Methods";
focal_class.type: String
focal_class.var_name: ACCESS_CONTROL_ALLOW_METHODS_HEADER
focal_class.declarator: ACCESS_CONTROL_ALLOW_ORIGIN_HEADER = "Access-Control-Allow-Origin"
focal_class.modifier: static final
focal_class.original_string: static final String ACCESS_CONTROL_ALLOW_ORIGIN_HEADER = "Access-Control-Allow-Origin";
focal_class.type: String
focal_class.var_name: ACCESS_CONTROL_ALLOW_ORIGIN_HEADER
focal_class.declarator: ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"
focal_class.modifier: static final
focal_class.original_string: static final String ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers";
focal_class.type: String
focal_class.var_name: ACCESS_CONTROL_ALLOW_HEADERS
focal_class.declarator: ORIGIN_HEADER = "Origin"
focal_class.modifier: static final
focal_class.original_string: static final String ORIGIN_HEADER = "Origin";
focal_class.type: String
focal_class.var_name: ORIGIN_HEADER
focal_class.declarator: VARY_HEADER = "Vary"
focal_class.modifier: static final
focal_class.original_string: static final String VARY_HEADER = "Vary";
focal_class.type: String
focal_class.var_name: VARY_HEADER
focal_class.declarator: VARY_HEADER_WILDCARD = "*"
focal_class.modifier: static final
focal_class.original_string: static final String VARY_HEADER_WILDCARD = "*";
focal_class.type: String
focal_class.var_name: VARY_HEADER_WILDCARD
focal_class.declarator: HEADERS_SEPARATOR = ","
focal_class.modifier: static final
focal_class.original_string: static final String HEADERS_SEPARATOR = ",";
focal_class.type: String
focal_class.var_name: HEADERS_SEPARATOR
focal_class.declarator: ACCEPTED_HTTP_METHODS_LIST = List.of(HTTP_GET_METHOD, HTTP_POST_METHOD, HTTP_PUT_METHOD,
              HTTP_DELETE_METHOD, HTTP_HEAD_METHOD, HTTP_OPTIONS_METHOD)
focal_class.modifier: static final
focal_class.original_string: static final List<String> ACCEPTED_HTTP_METHODS_LIST = List.of(HTTP_GET_METHOD, HTTP_POST_METHOD, HTTP_PUT_METHOD,
              HTTP_DELETE_METHOD, HTTP_HEAD_METHOD, HTTP_OPTIONS_METHOD);
focal_class.type: List<String>
focal_class.var_name: ACCEPTED_HTTP_METHODS_LIST
focal_class.declarator: ACCEPTED_HTTP_METHODS = ACCEPTED_HTTP_METHODS_LIST.stream()
              .collect(Collectors.joining(HEADERS_SEPARATOR))
focal_class.modifier: static final
focal_class.original_string: static final String ACCEPTED_HTTP_METHODS = ACCEPTED_HTTP_METHODS_LIST.stream()
              .collect(Collectors.joining(HEADERS_SEPARATOR));
focal_class.type: String
focal_class.var_name: ACCEPTED_HTTP_METHODS
focal_class.declarator: logger = LoggerFactory.getLogger(CorsFilter.class)
focal_class.modifier: private final transient
focal_class.original_string: private final transient Logger logger = LoggerFactory.getLogger(CorsFilter.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: isEnabled
focal_class.modifier: private
focal_class.original_string: private boolean isEnabled;
focal_class.type: boolean
focal_class.var_name: isEnabled
focal_class.file: bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/filter/CorsFilter.java
focal_class.identifier: CorsFilter
focal_class.interfaces: implements ContainerResponseFilter
focal_class.class_method_signature: CorsFilter.CorsFilter()
focal_class.full_signature: public  CorsFilter()
focal_class.identifier: CorsFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  CorsFilter()
focal_class.class_method_signature: CorsFilter.filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.full_signature: @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.identifier: filter
focal_class.modifiers: @Override public
focal_class.parameters: (ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.return: void
focal_class.signature: void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.class_method_signature: CorsFilter.processRequest(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.full_signature: private void processRequest(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.identifier: processRequest
focal_class.modifiers: private
focal_class.parameters: (ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.return: void
focal_class.signature: void processRequest(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.class_method_signature: CorsFilter.processPreflight(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.full_signature: private boolean processPreflight(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.identifier: processPreflight
focal_class.modifiers: private
focal_class.parameters: (ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.return: boolean
focal_class.signature: boolean processPreflight(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_class.class_method_signature: CorsFilter.getValue(MultivaluedMap<String, String> headers, String header)
focal_class.full_signature: private String getValue(MultivaluedMap<String, String> headers, String header)
focal_class.identifier: getValue
focal_class.modifiers: private
focal_class.parameters: (MultivaluedMap<String, String> headers, String header)
focal_class.return: String
focal_class.signature: String getValue(MultivaluedMap<String, String> headers, String header)
focal_class.class_method_signature: CorsFilter.appendVaryHeader(ContainerResponseContext responseContext)
focal_class.full_signature: private void appendVaryHeader(ContainerResponseContext responseContext)
focal_class.identifier: appendVaryHeader
focal_class.modifiers: private
focal_class.parameters: (ContainerResponseContext responseContext)
focal_class.return: void
focal_class.signature: void appendVaryHeader(ContainerResponseContext responseContext)
focal_class.class_method_signature: CorsFilter.activate(Map<String, Object> properties)
focal_class.full_signature: @Activate protected void activate(Map<String, Object> properties)
focal_class.identifier: activate
focal_class.modifiers: @Activate protected
focal_class.parameters: (Map<String, Object> properties)
focal_class.return: void
focal_class.signature: void activate(Map<String, Object> properties)
focal_method.body: @Override
      public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
              throws IOException {
          if (isEnabled && !processPreflight(requestContext, responseContext)) {
              processRequest(requestContext, responseContext);
          }
      }
focal_method.class_method_signature: CorsFilter.filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_method.full_signature: @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_method.identifier: filter
focal_method.invocations: processPreflight processRequest
focal_method.modifiers: @Override public
focal_method.parameters: (ContainerRequestContext requestContext, ContainerResponseContext responseContext)
focal_method.return: void
focal_method.signature: void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)