Skip to content

Commit bd0f898

Browse files
committed
Add a few more files to the ones downloaded
1 parent 558070b commit bd0f898

File tree

6 files changed

+114
-5
lines changed

6 files changed

+114
-5
lines changed

src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,7 @@ public void handle(HttpExchange httpExchange) throws IOException {
995995
setHttpExchangeResponseHeaders(httpExchange);
996996

997997
if (!this.contextRoot.equals(httpExchange.getRequestURI().getRawPath())) {
998+
System.out.println("Can't find " + httpExchange.getRequestURI().getRawPath());
998999
String response = "URI " + httpExchange.getRequestURI().getRawPath() + " not handled";
9991000
httpExchange.getResponseHeaders().add("Content-type", "text/plain");
10001001
httpExchange.sendResponseHeaders(HTTP_NOT_FOUND, response.length());
@@ -1785,17 +1786,25 @@ public void run(Optional<Pair<String,String>> basicAuth,
17851786
withAuth(server.createContext(uriContext+"/semgrex", new SemgrexHandler(authenticator, callback)), basicAuth);
17861787
withAuth(server.createContext(uriContext+"/tregex", new TregexHandler(authenticator, callback)), basicAuth);
17871788
withAuth(server.createContext(uriContext+"/scenegraph", new SceneGraphHandler(authenticator)), basicAuth);
1789+
17881790
withAuth(server.createContext(uriContext+"/corenlp-brat.js", new FileHandler("edu/stanford/nlp/pipeline/demo/corenlp-brat.js", "application/javascript")), basicAuth);
17891791
withAuth(server.createContext(uriContext+"/corenlp-brat.cs", new FileHandler("edu/stanford/nlp/pipeline/demo/corenlp-brat.css", "text/css")), basicAuth);
17901792
withAuth(server.createContext(uriContext+"/corenlp-parseviewer.js", new FileHandler("edu/stanford/nlp/pipeline/demo/corenlp-parseviewer.js", "application/javascript")), basicAuth);
1793+
17911794
withAuth(server.createContext(uriContext+"/static/fonts/Astloch-Bold.ttf", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/Astloch-Bold.ttf", "font/ttfx")), basicAuth);
17921795
withAuth(server.createContext(uriContext+"/static/fonts/Liberation_Sans-Regular.ttf", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/LiberationSans-Regular.ttf", "font/ttf")), basicAuth);
17931796
withAuth(server.createContext(uriContext+"/static/fonts/PT_Sans-Caption-Web-Regular.ttf", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/PTSansCaption-Regular.ttf", "font/ttf")), basicAuth);
1797+
1798+
withAuth(server.createContext(uriContext+"/annotation_log.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/annotation_log.js", "application/javascript")), basicAuth);
17941799
withAuth(server.createContext(uriContext+"/configuration.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/configuration.js", "application/javascript")), basicAuth);
17951800
withAuth(server.createContext(uriContext+"/dispatcher.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/dispatcher.js", "application/javascript")), basicAuth);
1796-
withAuth(server.createContext(uriContext+"/util.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/util.js", "application/javascript")), basicAuth);
1801+
withAuth(server.createContext(uriContext+"/jquery.svg.min.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/jquery.svg.min.js", "application/javascript")), basicAuth);
1802+
withAuth(server.createContext(uriContext+"/jquery.svgdom.min.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/jquery.svg.min.js", "application/javascript")), basicAuth);
17971803
withAuth(server.createContext(uriContext+"/url_monitor.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/url_monitor.js", "application/javascript")), basicAuth);
1804+
withAuth(server.createContext(uriContext+"/util.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/util.js", "application/javascript")), basicAuth);
17981805
withAuth(server.createContext(uriContext+"/visualizer.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/visualizer.js", "application/javascript")), basicAuth);
1806+
withAuth(server.createContext(uriContext+"/webfont.js", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/webfont.js", "application/javascript")), basicAuth);
1807+
17991808
withAuth(server.createContext(uriContext+"/img/corenlp-title.png", new BytesFileHandler("edu/stanford/nlp/pipeline/demo/corenlp-title.png", "image/png")), basicAuth);
18001809
withAuth(server.createContext(uriContext+"/ping", new PingHandler()), Optional.empty());
18011810
withAuth(server.createContext(uriContext+"/shutdown", new ShutdownHandler()), basicAuth);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; -*-
2+
// vim:set ft=javascript ts=2 sw=2 sts=2 cindent:
3+
4+
var AnnotationLog = (function(window, undefined) {
5+
var AnnotationLog = function(dispatcher) {
6+
var annotationLoggingOn = false;
7+
var currentCollection = null;
8+
var currentDocument = null;
9+
var currentArguments = null;
10+
11+
var rememberLoggingState = function(response) {
12+
annotationLoggingOn = response.annotation_logging;
13+
};
14+
15+
var rememberCurrent = function(_collection, _document, _arguments) {
16+
currentCollection = _collection;
17+
currentDocument = _document;
18+
currentArguments = _arguments;
19+
};
20+
21+
var logAction = function(_action) {
22+
if (!annotationLoggingOn) {
23+
// logging not requested for current collection
24+
return false;
25+
} else {
26+
dispatcher.post('ajax', [ {
27+
action: 'logAnnotatorAction',
28+
collection: currentCollection,
29+
'document': currentDocument,
30+
log: _action,
31+
}, null]);
32+
}
33+
}
34+
35+
dispatcher.
36+
on('collectionLoaded', rememberLoggingState).
37+
on('current', rememberCurrent).
38+
on('logAction', logAction);
39+
}
40+
41+
return AnnotationLog;
42+
})(window);

src/edu/stanford/nlp/pipeline/demo/corenlp-brat.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ var serverAddress = '';
88
var bratLocation = 'https://nlp.stanford.edu/js/brat/';
99
head.js(
1010
// External libraries
11-
bratLocation + '/client/lib/jquery.svg.min.js',
12-
bratLocation + '/client/lib/jquery.svgdom.min.js',
11+
'./jquery.svg.min.js',
12+
'./jquery.svgdom.min.js',
1313

1414
// brat helper modules
1515
'./configuration.js',
1616
'./util.js',
17-
bratLocation + '/client/src/annotation_log.js',
18-
bratLocation + '/client/lib/webfont.js',
17+
'./annotation_log.js',
18+
'./webfont.js',
1919

2020
// brat modules
2121
'./dispatcher.js',

0 commit comments

Comments
 (0)