Skip to main content



      Home
Home » Eclipse Projects » Kura » Web Application in KURA
Web Application in KURA [message #1751136] Wed, 04 January 2017 14:39 Go to next message
Eclipse UserFriend
Hello!
I'm new to Kura.
I need to design an application for Raspberry in which I both send sensor data to a server (via MQTT) and provide the users with a web site on the raspberry.

I have seen that there is an embedded jetty server in KURA.

Is it possible to use this server to develop a complete web application (as in other OSGI container)? Is there any tutorial about this?

According to you, which could be the best process? Save the sensor data into a local database, then send it to the central server and then the local web application read the data from the database? Or maybe, it is better to have a local MQTT broker and have the web application registered to the topics in order to show the data to the users?

Thank for your attention

Re: Web Application in KURA [message #1751616 is a reply to message #1751136] Wed, 11 January 2017 17:53 Go to previous message
Eclipse UserFriend
Hello,

Yes, you can host your own web application within a bundle inside of Kura using the Jetty server. We don't have a demo for this, but you simply need to use the OSGi HttpService to register you resources. Something like:

this.httpService.registerResources("/mywebpage", "www/index.html", null);


Then place your web related code inside a "www" directory of your bundle.

The design is up to you, though I am not sure I follow the reasoning for having a broker inside of Kura since you are already publishing to a different MQTT server. I think the main question is if you want to display "live" data or "historical" data. If you want "live" data, then I would connect your web page to the same MQTT server you are already sending the data to. Getting "historical" data would be a bit more work as MQTT won't really help you. You will need some way for your web application to call back to the framework to retrieve what you need (possibly REST or Servlets).

Hope that helps,
--Dave
Previous Topic:JDK 8 support? (Error exporting bundle...)
Next Topic:Add external Jar to Kura OSGI Bundle
Goto Forum:
  


Current Time: Thu Jul 17 22:07:57 EDT 2025

Powered by FUDForum. Page generated in 0.06657 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top