1   package eu.fbk.dkm.pikes.tintop.server;
2   
3   import eu.fbk.dkm.pikes.tintop.AnnotationPipeline;
4   import ixa.kaflib.KAFDocument;
5   import org.glassfish.grizzly.http.server.Request;
6   import org.glassfish.grizzly.http.server.Response;
7   
8   /**
9    * Created with IntelliJ IDEA.
10   * User: alessio
11   * Date: 21/07/14
12   * Time: 15:30
13   * This class is used to generate an empty NAF starting from the text.
14   */
15  
16  public class Text2NafHandler extends AbstractHandler {
17  
18  	public Text2NafHandler(AnnotationPipeline pipeline) {
19  		super(pipeline);
20  	}
21  
22  	@Override
23  	public void service(Request request, Response response) throws Exception {
24  
25  		super.service(request, response);
26  
27  		String text = request.getParameter("text");
28  		KAFDocument doc = text2naf(text, meta);
29  		doc = pipeline.parseFromNAF(doc);
30  
31  		writeOutput(response, "text/xml", doc.toString());
32  	}
33  }