<commit_before>package namewebserver;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;

import qora.naming.Name;
import controller.Controller;


@Path("{name}")
public class NamesWebResource 
{
	@GET
	public Response getNames(@PathParam("name") String nameName)
	{
		Name name = Controller.getInstance().getName(nameName);
		
		//CHECK IF NAME EXISTS
		if(name == null)
		{
			return Response.status(404)
					.header("Content-Type", "text/html; charset=utf-8")
					.entity("<html><title>404 Not Found</title><body><h1>name does not exist</h1><hr> <a href=http://www.qora.org>Qora</a></body></html>")
					.build();
		}
		
		String Value = name.getValue().toString();
		
		//REDIRECT
		if(Value.startsWith("http://") || Value.startsWith("https://"))
		{
			return Response.status(302)
					.header("Location", Value)
					.build();
		}
		
		//SHOW WEB-PAGE
		return Response.status(200)
				.header("Content-Type", "text/html; charset=utf-8")
				.entity(Value)
				.build();
	}	
}<commit_msg>Sets the search page to the main page.<commit_after>package namewebserver;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;

import qora.naming.Name;
import controller.Controller;


@Path("/")
public class NamesWebResource 
{
	@GET
	public Response Default()
	{
		return Response.status(200)
				.header("Content-Type", "text/html; charset=utf-8")
				.entity("<html><head><title>Qora web-server</title>" //		
				+"<script type='text/javascript'>" //
				+ "function key(event) {return ('which' in event) ? event.which : event.keyCode;}" //
				+ "function goto() {" //
				+ "url = document.getElementById(\"name\").value;" //
				+ "document.location.href = '/'+url;" //
				+ "return 0;" //
				+ "}" //
				+ "</script>" //
				+ "</head>" //
				+ "<body>" //
				+ "<center><h1 style='font-family: Verdana;'>Qora web-server</h1>" //
				+ "<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAAL" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "gNAVvIOf7pfEtLESZsKACO3d1xzxcS8aN9uoEuUTLf+AWunPc5ONDsjFILLEky38eDbU02eHygiAB3R0wFIrf" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>YL<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "/BqOo8ZaASN4tJNskwJ8/t69sPAGljPWCkV2xQiafdnwwRsLUCSMesNBR0WF4aTfm02Vqi92w28SMT2w1HFWQ" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>" //
				+ "<KEY>'>" //
				+ "<br><br><span style='font-family: Verdana;'>Enter the name:<br>" //
				+ "<input size=55 id=name value=\"\" onkeyup=\"if(key(event)==13){document.getElementById('button').click();}\">" //
				+ "<input id=button type=button value=\"Search\" style='font-family: Verdana;' onclick=javascript:goto()><br>" //
				+ "<br> <a href=http://qora.org>Qora</a></span></center>" //
				+ "<body></html>")
				.build();		
	}
	
	@Path("{name}")
	@GET
	public Response getNames(@PathParam("name") String nameName)
	{
		Name name = Controller.getInstance().getName(nameName);
		
		//CHECK IF NAME EXISTS
		if(name == null)
		{
			return Response.status(404)
					.header("Content-Type", "text/html; charset=utf-8")
					.entity("<html><title>404 Not Found</title><body><h1>name does not exist</h1><hr> <a href=http://www.qora.org>Qora</a></body></html>")
					.build();
		}
		
		String Value = name.getValue().toString();
		
		//REDIRECT
		if(Value.startsWith("http://") || Value.startsWith("https://"))
		{
			return Response.status(302)
					.header("Location", Value)
					.build();
		}
		
		//SHOW WEB-PAGE
		return Response.status(200)
				.header("Content-Type", "text/html; charset=utf-8")
				.entity(Value)
				.build();
	}	
}
{'fraction_non_alphanumeric': 0.2329518359561278, 'fraction_numerical': 0.018359561278016214, 'mean_word_length': 2.7388591800356505, 'pattern_counts': {'":': 0, '<': 93, '<?xml version=': 0, '>': 93, 'https://': 2, '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': '6261228', 'n_tokens_mistral': 1923, 'n_tokens_neox': 1568, 'n_words': 245}