<commit_before>/*
 * Copyright 2009 Collaborative Research Centre SFB 632 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package annis.frontend.servlets;

import annis.service.AnnisService;
import annis.service.AnnisServiceFactory;
import annis.service.ifaces.AnnisAttribute;
import annis.service.ifaces.AnnisAttributeSet;
import annis.service.ifaces.AnnisCorpus;
import annis.service.ifaces.AnnisCorpusSet;
import java.io.IOException;
import java.io.Writer;
import java.util.List;
import java.util.Vector;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AttributeListServlet extends HttpServlet
{

  private static final long serialVersionUID = -4188886565776492022L;

  @Override
  protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException
  {
    doGet(arg0, arg1);
  }

  @SuppressWarnings("unchecked")
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
  {
    String corpusIdsParam = request.getParameter("corpusIds");

    List<Long> corpusIdList = new Vector<Long>();

    //gather selected corpora
    try
    {
      for (String corpusId : corpusIdsParam.split(","))
      {
        corpusIdList.add(Long.parseLong(corpusId));
      }
    }
    catch (NullPointerException e)
    {
      //We got no corpus Ids...
    }
    catch (NumberFormatException e)
    {
      //We got wrong Corpus Ids
    }

    /* Required Stuff */
    boolean scriptTag = false;<commit_msg>set utf-8 encoding for the AttributeListServlet<commit_after>/*
 * Copyright 2009 Collaborative Research Centre SFB 632 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package annis.frontend.servlets;

import annis.service.AnnisService;
import annis.service.AnnisServiceFactory;
import annis.service.ifaces.AnnisAttribute;
import annis.service.ifaces.AnnisAttributeSet;
import annis.service.ifaces.AnnisCorpus;
import annis.service.ifaces.AnnisCorpusSet;
import java.io.IOException;
import java.io.Writer;
import java.util.List;
import java.util.Vector;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AttributeListServlet extends HttpServlet
{

  private static final long serialVersionUID = -4188886565776492022L;

  @Override
  protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException
  {
    doGet(arg0, arg1);
  }

  @SuppressWarnings("unchecked")
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
  {
    response.setCharacterEncoding("utf-8");
    
    String corpusIdsParam = request.getParameter("corpusIds");

    List<Long> corpusIdList = new Vector<Long>();

    //gather selected corpora
    try
    {
      for (String corpusId : corpusIdsParam.split(","))
      {
        corpusIdList.add(Long.parseLong(corpusId));
      }
    }
    catch (NullPointerException e)
    {
      //We got no corpus Ids...
    }
    catch (NumberFormatException e)
    {
      //We got wrong Corpus Ids
    }

    /* Required Stuff */
    boolean scriptTag = false;
{'fraction_non_alphanumeric': 0.0847570445972931, 'fraction_numerical': 0.015531395606833814, 'mean_word_length': 4.059483726150392, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5397836', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1252, 'n_words': 385}