Closed MichaelErichsen closed 4 years ago
ProjectStartEmbeddedServerHandler is the class that starts the server
jetty-util-9.4.11.v20180605 added to build path of org.historyresearchenvironment.server The server is now running (but doing no real work yet):
2018-07-17 11:27:07.384:INFO::Thread-3: Logging initialized @11584ms to org.eclipse.jetty.util.log.StdErrLog 2018-07-17 11:27:07.495:INFO:oejs.Server:Thread-3: jetty-9.4.10.v20180503; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 1.8.0_172-b11 2018-07-17 11:27:07.712:INFO:oejs.AbstractConnector:Thread-3: Started ServerConnector@c6afbd8{HTTP/1.1,[http/1.1]}{0.0.0.0:8000} 2018-07-17 11:27:07.713:INFO:oejs.Server:Thread-3: Started @11914ms Jul 17, 2018 11:27:07 AM org.historyresearchenvironment.server.handlers.ProjectStartEmbeddedServerHandler$1 run INFO: The server is running at http://192.168.1.7:8000/
When doing a call from a browser (http://127.0.0.1:8000/hre/v1/personalevents/24)
LOGGER.info(target);
returns:
Jul 17, 2018 11:27:37 AM org.historyresearchenvironment.server.handlers.HreHttpRequestHandler handle INFO: /hre/v1/personalevents/24
Needs to make the features add statements like this
server.createContext("/hre/v1/personalevents", new SampleModelHandler());
Which invokes a class like this:
class RelativesModelHandler implements HttpHandler { @Override public void handle(HttpExchange t) throws IOException { String s = t.getRequestURI().getPath(); final String parts[] = s.split("/");
PersonalRelativesProvider model = new PersonalRelativesProvider();
s = parts[(parts.length - 1)];
model.setId(Integer.parseInt(s));
final ServerRequest request = new ServerRequest(t.getRequestMethod(), "personalrelatives", model);
final SomeBusinessLogic sbl = new SomeBusinessLogic(request);
final ServerResponse response = sbl.doSomethingWithRequest();
model = (PersonalRelativesProvider) response.getProvider();
s = model.writeJson(model.getClass().getName());
final Headers headers = t.getResponseHeaders();
headers.add("Content-Type", "application/json");
t.sendResponseHeaders(200, s.length());
final OutputStream os = t.getResponseBody();
os.write(s.getBytes());
os.close();
}
A number of classes created.
Now having a problem with the plug-in hierarchy:
Jul 19, 2018 12:34:37 PM org.historyresearchenvironment.dataaccess.providers.AbstractHreProvider writeJson SEVERE: class java.lang.ClassNotFoundException: org.historyresearchenvironment.sample.providers.SampleEditorProvider cannot be found by org.historyresearchenvironment.dataaccess_0.1.0.qualifier at line 508
Created a separate JsonAccessor class for static access to readJson() and writeJson()
Now seems to use Direct interface instead of server interface when calling from the GUI, even though preferences are set to DIRECT.
Maven build failure:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (default-compile) on project org.historyresearchenvironment.server: Compilation failure: Compilation failure: [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[22] [ERROR] public class RootHttpRequestHandler implements Handler { [ERROR] ^^^^^^^^^^^^^^^^^^^^^^ [ERROR] The hierarchy of the type RootHttpRequestHandler is inconsistent [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[22] [ERROR] public class RootHttpRequestHandler implements Handler { [ERROR] ^^^^^^^ [ERROR] The type org.eclipse.jetty.util.component.Destroyable cannot be resolved. It is indirectly referenced from required .class files [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[22] [ERROR] public class RootHttpRequestHandler implements Handler { [ERROR] ^^^^^^^ [ERROR] The type org.eclipse.jetty.util.component.LifeCycle cannot be resolved. It is indirectly referenced from required .class files [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[53] [ERROR] public void addLifeCycleListener(Listener arg0) { [ERROR] ^^^^^^^^ [ERROR] Listener cannot be resolved to a type [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[62] [ERROR] public boolean isFailed() { [ERROR] ^^^^^^^^^^ [ERROR] The method isFailed() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[71] [ERROR] public boolean isRunning() { [ERROR] ^^^^^^^^^^^ [ERROR] The method isRunning() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[80] [ERROR] public boolean isStarted() { [ERROR] ^^^^^^^^^^^ [ERROR] The method isStarted() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[89] [ERROR] public boolean isStarting() { [ERROR] ^^^^^^^^^^^^ [ERROR] The method isStarting() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[98] [ERROR] public boolean isStopped() { [ERROR] ^^^^^^^^^^^ [ERROR] The method isStopped() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[107] [ERROR] public boolean isStopping() { [ERROR] ^^^^^^^^^^^^ [ERROR] The method isStopping() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[116] [ERROR] public void removeLifeCycleListener(Listener arg0) { [ERROR] ^^^^^^^^ [ERROR] Listener cannot be resolved to a type [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[125] [ERROR] public void start() throws Exception { [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] The method start() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\RootHttpRequestHandler.java:[134] [ERROR] public void stop() throws Exception { [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] The method stop() of type RootHttpRequestHandler must override or implement a supertype method [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\ProjectStartEmbeddedServerHandler.java:[50] [ERROR] server.getConnectors()[0].getConnectionFactory(HttpConnectionFactory.class); [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] The type org.eclipse.jetty.util.component.Graceful cannot be resolved. It is indirectly referenced from required .class files [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\ProjectStartEmbeddedServerHandler.java:[50] [ERROR] server.getConnectors()[0].getConnectionFactory(HttpConnectionFactory.class); [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] The type org.eclipse.jetty.util.component.Container cannot be resolved. It is indirectly referenced from required .class files [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\ProjectStartEmbeddedServerHandler.java:[54] [ERROR] context.setHandler(new RootHttpRequestHandler()); [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] The type org.eclipse.jetty.util.Attributes cannot be resolved. It is indirectly referenced from required .class files [ERROR] C:\Users\michael\git\HRE--History-Research-Environment\HRE--History-Research-Environment\org.historyresearchenvironment\bundles\org.historyresearchenvironment.server\src\org\historyresearchenvironment\server\handlers\ProjectStartEmbeddedServerHandler.java:[67] [ERROR] server.start(); [ERROR] ^^^^^ [ERROR] The method start(LifeCycle) from the type Server refers to the missing type LifeCycle [ERROR] 17 problems (17 errors)
Downloaded apache-lucene.jar and copied it to "Other Jars", but not sure that this is necessary.
HreClientPreferencesPage does not set the CSMODE preference correctly
Preferences issues moved to #54
Needed to change the jetty util package to 9.4.8 and add it to requred bndles for sample.server.
Closed - no longer relevant to current Build of HRE
Client/Server and JSON/REST is functional in the mock up. Needs to be reconstructed into v0.1