Package edu.stanford.nlp.pipeline
Class StanfordCoreNLPServer.CoreNLPHandler
- java.lang.Object
-
- edu.stanford.nlp.pipeline.StanfordCoreNLPServer.CoreNLPHandler
-
- All Implemented Interfaces:
HttpHandler
- Enclosing class:
- StanfordCoreNLPServer
protected class StanfordCoreNLPServer.CoreNLPHandler extends Object implements HttpHandler
The main handler for taking an annotation request, and annotating it.
-
-
Field Summary
Fields Modifier and Type Field Description PropertiesdefaultPropsThe default properties to use in the absence of anything sent by the client.
-
Constructor Summary
Constructors Constructor Description CoreNLPHandler(Properties props, Predicate<Properties> authenticator, Consumer<StanfordCoreNLPServer.FinishedRequest> callback, StanfordCoreNLPServer.FileHandler homepage, String contextRoot)Create a handler for accepting annotation requests.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentType(Properties props, StanfordCoreNLP.OutputFormat of)Get the response data type to send to the client, based off of the output format requested from CoreNLP.voidhandle(HttpExchange httpExchange)
-
-
-
Field Detail
-
defaultProps
public final Properties defaultProps
The default properties to use in the absence of anything sent by the client.
-
-
Constructor Detail
-
CoreNLPHandler
public CoreNLPHandler(Properties props, Predicate<Properties> authenticator, Consumer<StanfordCoreNLPServer.FinishedRequest> callback, StanfordCoreNLPServer.FileHandler homepage, String contextRoot)
Create a handler for accepting annotation requests.- Parameters:
props- The properties file to use as the default if none were sent by the client.
-
-
Method Detail
-
getContentType
public String getContentType(Properties props, StanfordCoreNLP.OutputFormat of)
Get the response data type to send to the client, based off of the output format requested from CoreNLP.- Parameters:
props- The properties being used by CoreNLP.of- The output format being output by CoreNLP.- Returns:
- An identifier for the type of the HTTP response (e.g., 'text/json').
-
handle
public void handle(HttpExchange httpExchange) throws IOException
- Specified by:
handlein interfaceHttpHandler- Throws:
IOException
-
-