edc httpd
edc httpd is an embedded httpd server to serve the edc documentation in standalone java application.
The server expose a web service to search in the content. The search is based on a query. The result is sorted as following :
- All documents which match the query in the label
- Then all documents which match the query in the content
The search is done only in the document and chapter. The bricks are ignored.
edc Version
Current release is compatible with edc v2.2+
How can I get the latest release?
You can pull it from the central Maven repositories:
Maven
<dependency>
<groupId>fr.techad</groupId>
<artifactId>edc-httpd-java</artifactId>
<version>1.2.0</version>
</dependency>
Gradle
compile group: 'fr.techad', name: 'edc-httpd-java', version: '1.2.0'
How can I search keyword in the content?
Use the web service : /httpd/api/search?query=YourQuery
.
The query is based on Lucene. So you can create complex query with the lucene syntax query.
The wildcard is supported.
Example
The query: /httpd/api/search?query=httpd
returns help documentations which contain the word httpd
.
The query /httpd/api/search?query=httpd AND server
returns help documentations which contain the words httpd
AND server
.
The query /httpd/api/search?query=http*
returns help documentations which contain the words which start with http
.
How can I reindex the content?
Use the web service : /httpd/api/reindex
. This url can be called with your favorite browser (no mandatory to use curl)
Configuration
Define the path
In the src/main/java/resources
folder, create the file: webserver.yml
. Define the base
variable to define the path to the published documentation.
base: /local/edc-httpd/html
By default, the indexed content is stored in the folder .edc/index
in the home user. It is possible to override this value with the variable indexPath
. It is possible to activate an extra url to reindex the content on demand with the variable indexUrlEnabled
. By default, this url is disabled. To reindex the content, call the url: /httpd/api/reindex
.
Example
base: /local/edc-httpd/html
indexPath: /local/edc-httpd/.edc
indexUrlEnabled: true
Optional
It is possible to override the default port (8088). You have to create a server.yml
file and define its content like this:
httpPort: 9000
ip: 0.0.0.0
enableHttp: true
Modify the httpPort
to define the new port value.
Start the server
Based on the configuration file
To start the server, call EdcWebServer.run();
Example
package fr.techad.edc.demo;
import fr.techad.edc.httpd.EdcWebServer;
public class Main {
public static void main(String[] args) {
EdcWebServer.run();
/* ... */
}
}
With port scan
To start the server with a port scan, call EdcWebServer.run("slf4j", minPort, maxPort);
. The server will start with the first free found port and return it.
Example
package fr.techad.edc.demo;
import fr.techad.edc.httpd.EdcWebServer;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
try {
// Scan port between 8080 and 9080
int port = EdcWebServer.run("slf4j", 8080, 9080);
/* ... */
}
catch(IOExeption e) {
/* ... */
}
/* ... */
}
}
License
MIT TECH'advantage