<commit_before>/*
 * Copyright (C) 2000 - 2013 Silverpeas
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * As a special exception to the terms and conditions of version 3.0 of
 * the GPL, you may redistribute this Program in connection withWriter Free/Libre
 * Open Source Software ("FLOSS") applications as described in Silverpeas's
 * FLOSS exception.  You should have recieved a copy of the text describing
 * the FLOSS exception, and it is also available here:
 * "http://www.silverpeas.org/docs/core/legal/floss_exception.html"
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.silverpeas.bundle.web;

import com.silverpeas.annotation.Authenticated;
import org.silverpeas.util.i18n.I18NHelper;
import com.silverpeas.web.RESTWebService;
import com.silverpeas.web.UserPrivilegeValidation;
import org.silverpeas.util.GeneralPropertiesManager;
import org.silverpeas.util.ResourceLocator;
import java.io.IOException;
import java.io.StringWriter;
import java.util.MissingResourceException;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

/**
 * The bundle resource represents either a settings bundle or an i18n messages bundle.
 *
 * This WEB service is an entry point to access the different bundles in use in Silverpeas. It can
 * be accessed only by authenticated users so that is is easy to know the language of the bundle to
 * sent back.
 *
 * The i18n bundled is refered in the URI by its absolute location in the classpath of the
 * Silverpeas portal with as well / or . as path separators, and it can be or not suffixed with
 * properties. For i18n bundles, the language can be indicated with the resource bundle name,
 * otherwise the language of the current user underlying at the HTTP request is taken. If the
 * specified language isn't supported by Silverpeas, then the default language in Silverpeas (yet
 * the French), is taken.
 *
 * In order to add some flexibility, particularly with client-side scripts, the language of the user
 * can be explictly indicated with the i18n bundle name, whatever it is and without knowing it, by
 * using the wildcard $$ as language code; this wildcard means whatever the language (then takes the
 * prefered language of the current user in the session). This parameter isn't taken into account
 * with the settings bundles.
 */
@Service
@Scope("request")<commit_msg>Remove any references to spring and to Jersey from BundleResource<commit_after>/*
 * Copyright (C) 2000 - 2013 Silverpeas
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * As a special exception to the terms and conditions of version 3.0 of
 * the GPL, you may redistribute this Program in connection withWriter Free/Libre
 * Open Source Software ("FLOSS") applications as described in Silverpeas's
 * FLOSS exception.  You should have recieved a copy of the text describing
 * the FLOSS exception, and it is also available here:
 * "http://www.silverpeas.org/docs/core/legal/floss_exception.html"
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.silverpeas.bundle.web;

import com.silverpeas.annotation.Authenticated;
import com.silverpeas.web.RESTWebService;
import com.silverpeas.web.UserPrivilegeValidation;
import org.silverpeas.util.GeneralPropertiesManager;
import org.silverpeas.util.ResourceLocator;
import org.silverpeas.util.i18n.I18NHelper;

import javax.enterprise.context.RequestScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.StringWriter;
import java.util.MissingResourceException;

/**
 * The bundle resource represents either a settings bundle or an i18n messages bundle.
 *
 * This WEB service is an entry point to access the different bundles in use in Silverpeas. It can
 * be accessed only by authenticated users so that is is easy to know the language of the bundle to
 * sent back.
 *
 * The i18n bundled is referred in the URI by its absolute location in the classpath of the
 * Silverpeas portal with as well / or . as path separators, and it can be or not suffixed with
 * properties. For i18n bundles, the language can be indicated with the resource bundle name,
 * otherwise the language of the current user underlying at the HTTP request is taken. If the
 * specified language isn't supported by Silverpeas, then the default language in Silverpeas (yet
 * the French), is taken.
 *
 * In order to add some flexibility, particularly with client-side scripts, the language of the user
 * can be explicitly indicated with the i18n bundle name, whatever it is and without knowing it, by
 * using the wildcard $$ as language code; this wildcard means whatever the language (then takes the
 * preferred language of the current user in the session). This parameter isn't taken into account
 * with the settings bundles.
 */

@RequestScoped
{'fraction_non_alphanumeric': 0.06398332264271969, 'fraction_numerical': 0.0073765234124438745, 'mean_word_length': 4.344473007712082, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1793441', 'n_tokens_mistral': 1685, 'n_tokens_neox': 1624, 'n_words': 801}