<commit_before>package org.owasp.appsensor.rest.filter;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.Provider;

import org.owasp.appsensor.AppSensorServer;

@Provider
public class ClientApplicationIdentificationFilter implements ContainerRequestFilter {
	
	private final static WebApplicationException unauthorized =
			   new WebApplicationException(
			       Response.status(Status.UNAUTHORIZED)
			               .entity("Page requires sending configured client application identification header.").build());
	
	/** default name for client application identification header */
	private static String HEADER_NAME = "X-Appsensor-Client-Application-Name";
	
	private static boolean checkedConfigurationHeaderName = false;
	
	@Override
	public void filter(ContainerRequestContext context) 
	        throws WebApplicationException {

		//should only run on first request
		if (! checkedConfigurationHeaderName) {
			updateHeaderFromConfiguration();
			checkedConfigurationHeaderName = true;
		}
		<commit_msg>client app id reader for rest server<commit_after>package org.owasp.appsensor.rest.filter;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.Provider;

import org.owasp.appsensor.AppSensorServer;

@Provider
public class ClientApplicationIdentificationFilter implements ContainerRequestFilter {
	
	private final static WebApplicationException unauthorized =
			   new WebApplicationException(
			       Response.status(Status.UNAUTHORIZED)
			               .entity("Page requires sending configured client application identification header.").build());
	
	/** default name for client application identification header */
	private static String HEADER_NAME = "X-Appsensor-Client-Application-Name";
	
	private static boolean checkedConfigurationHeaderName = false;
	
	@Override
	public void filter(ContainerRequestContext context) throws WebApplicationException {

		//should only run on first request
		if (! checkedConfigurationHeaderName) {
			updateHeaderFromConfiguration();
			checkedConfigurationHeaderName = true;
		}
		
{'fraction_non_alphanumeric': 0.07544075440754408, 'fraction_numerical': 0.0, 'mean_word_length': 5.0246913580246915, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7493674', 'n_tokens_mistral': 635, 'n_tokens_neox': 579, 'n_words': 152}