<commit_before>package de.linkvt.bachelor.config;

import de.linkvt.bachelor.web.converters.message.FunctionalSyntaxHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.ManchesterSyntaxHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.OntologySyntax;
import de.linkvt.bachelor.web.converters.message.OwlXmlHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.RdfXmlOntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.TurtleOntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converters.parameter.StringToFeaturesConverter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

import java.util.ArrayList;
import java.util.List;

/**
 * Configures the web module.
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

  @Autowired
  private StringToFeaturesConverter converter;

  @Override
  public void addFormatters(FormatterRegistry registry) {
    registry.addConverter(converter);
  }

  @Override
  public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.ignoreAcceptHeader(true)
        .favorParameter(true)
        .ignoreUnknownPathExtensions(false)
        .defaultContentType(MediaType.TEXT_PLAIN)
        .mediaType("owx", OntologySyntax.OWL_XML.getMediaType())
        .mediaType("owl", OntologySyntax.RDF_XML.getMediaType())
        .mediaType("rdf", OntologySyntax.RDF_XML.getMediaType())
        .mediaType("xml", OntologySyntax.RDF_XML.getMediaType())
        .mediaType("ofn", OntologySyntax.FUNCTIONAL.getMediaType())
        .mediaType("omn", OntologySyntax.MANCHESTER.getMediaType())
        .mediaType("ttl", OntologySyntax.TURTLE.getMediaType());
  }

  @Bean
  public InternalResourceViewResolver viewResolver() {
    InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
    viewResolver.setRedirectHttp10Compatible(false);
    return viewResolver;
  }

  @Bean
  public HttpMessageConverters customConverters() {
    List<HttpMessageConverter<?>> converters = new ArrayList<>();

    converters.add(new FunctionalSyntaxHttpMessageConverter());
    converters.add(new ManchesterSyntaxHttpMessageConverter());
    converters.add(new OwlXmlHttpMessageConverter());
    converters.add(new RdfXmlOntologyHttpMessageConverter());
    converters.add(new TurtleOntologyHttpMessageConverter());

    return new HttpMessageConverters(converters);
  }
}<commit_msg>Revert "Try to fix redirection from https to http"<commit_after>package de.linkvt.bachelor.config;

import de.linkvt.bachelor.web.converters.message.FunctionalSyntaxHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.ManchesterSyntaxHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.OntologySyntax;
import de.linkvt.bachelor.web.converters.message.OwlXmlHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.RdfXmlOntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converters.message.TurtleOntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converters.parameter.StringToFeaturesConverter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Configures the web module.
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

  @Autowired
  private StringToFeaturesConverter converter;

  @Override
  public void addFormatters(FormatterRegistry registry) {
    registry.addConverter(converter);
  }

  @Override
  public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.ignoreAcceptHeader(true)
        .favorParameter(true)
        .ignoreUnknownPathExtensions(false)
        .defaultContentType(MediaType.TEXT_PLAIN)
        .mediaType("owx", OntologySyntax.OWL_XML.getMediaType())
        .mediaType("owl", OntologySyntax.RDF_XML.getMediaType())
        .mediaType("rdf", OntologySyntax.RDF_XML.getMediaType())
        .mediaType("xml", OntologySyntax.RDF_XML.getMediaType())
        .mediaType("ofn", OntologySyntax.FUNCTIONAL.getMediaType())
        .mediaType("omn", OntologySyntax.MANCHESTER.getMediaType())
        .mediaType("ttl", OntologySyntax.TURTLE.getMediaType());
  }

  @Bean
  public HttpMessageConverters customConverters() {
    List<HttpMessageConverter<?>> converters = new ArrayList<>();

    converters.add(new FunctionalSyntaxHttpMessageConverter());
    converters.add(new ManchesterSyntaxHttpMessageConverter());
    converters.add(new OwlXmlHttpMessageConverter());
    converters.add(new RdfXmlOntologyHttpMessageConverter());
    converters.add(new TurtleOntologyHttpMessageConverter());

    return new HttpMessageConverters(converters);
  }
}
{'fraction_non_alphanumeric': 0.09579001193114027, 'fraction_numerical': 0.0003408897221748764, 'mean_word_length': 6.121359223300971, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5626037', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1652, 'n_words': 225}