How to embed an Http server (like i-Jetty, Paw, etc) in android application
Asked Answered
A

1

11

How can I integrate an HTTP server (like iJetty, Paw, etc) in my Android application? I can't find any useful tutorial on the Internet. Most of the websites (including the official ones) just provide the server specification and downloadable server jar files. I was looking for some Java code to integrate that file in my Eclipse project so that it could be used as server component in my application. Any help please?

Artichoke answered 4/7, 2013 at 12:15 Comment(2)
Just wondering, why do you need an HTTP server in a device that's designed to be a CLIENT? No trolling, I'm really curious.Pricket
I am looking for one too. I have a small Android device designed to be plugged into a TV. I would like it to have a jetty like server so I can run servlets to provide a web service.Oscitancy
B
15

Here's one I have successfully used:

NanoHttpd

NanoHttpd is an open-source, small-footprint web server that is suitable for embedding in applications, written in the Java programming language. The source code consists of a single .java file.

And here is an Android sample project that uses it:

https://gist.github.com/komamitsu/1893396

It's very small and simple and in pure java but it is fairly modifiable. There are others but they are a bit more heavyweight. Depends what you want to do. I would recommend you start small and see if that suits your purposes.

Brockington answered 4/7, 2013 at 12:36 Comment(2)
I am using same nanohttpdIchthyo
How about SSL support? I can't find any successful examples and feedback about nanohttpd and ssl.Crichton

© 2022 - 2024 — McMap. All rights reserved.