This example shows how to setup a Rest Server.
This server provides a simple HTML page which shows some simulated information about the device (uptime, java heap usage, thread).
- MICROEJ SDK 6.
- A VEE Port that contains:
- EDC-1.3 or higher
- BON-1.4 or higher
- NET-1.1 or higher
This example has been tested on:
- IntelliJ IDEA with MicroEJ plugin for IntelliJ IDEA
1.1.0
. - NXP i.MX RT1170 VEE Port 3.0.0.
Follow MICROEJ SDK 6 Installation Guide to setup the SDK.
By default, the sample will use the NXP i.MX RT1170 VEE Port 3.0.0. The sample retrieves the VEE Port as a module.
Refer to the Select a VEE Port documentation to use another VEE Port in your project.
Run the following command in your IDE
(or click the Play
button next to the line
below when opening this README in IntelliJ IDEA):
./gradlew :dynamic-restserver:runOnSimulator
Alternative ways to run in simulation are described in the Run on Simulator documentation.
Complete the Getting Started for NXP i.MX RT1170 Evaluation Kit to make sure your environment is fully setup.
If you are using another VEE Port, make sure to properly setup the VEE Port environment before going further. Refer to the dedicated VEE Port README or Getting Started for more information.
Run the following command in your IDE
(or click the Play
button next to the line
below when opening this README in IntelliJ IDEA):
./gradlew :dynamic-restserver:runOnDevice
Alternative ways to run on device are described in the Run on Device documentation.
Once the REST Server is running:
- If you are running the application in simulation you should be able to access it through a web browser using the url http://localhost:8080.
- If you are running the application on a board you should be able to access it through a web browser using the board's local ip address: http://board-ip:8080. You should get on a simple html page which shows some simulated information about the board (uptime, java heap usage, thread).
The source code is provided as is for educative purpose, to reduce the embedded constraint, it is recommended to:
- Minify then compress the resources with gz and use a GzipResourceEndpoint.
- Unify the resources in a single HTML page to avoid 3 connections.
The dependencies defined in build.gradle.kts are configured in libs.versions.toml.
All dependencies are retrieved transitively by Gradle.
N/A
None.
Markdown
Copyright 2019-2025 MicroEJ Corp. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found with this software.