Questions tagged [nanohttpd]

NanoHttpd is a light-weight HTTP server designed for embedding in other applications. NanoHttpd has been released under a Modified BSD licence.

The first version of NanoHttpd was published in 2003. Originally, its author was looking for:

"a small enough, embeddable and easily modifiable HTTP server that I could just copy and paste into my other Java projects."

Later, another team took the project and fixed a number of bugs, moved the build to maven and pulled out the samples from the runtime JAR to further slim it down.

The two projects pooled resources in early 2013, merging code-bases, to better support the user base and reduce confusion over why two NanoHttpd projects existed.

You can view the project on GitHub: https://github.com/NanoHttpd/nanohttpd.

239 questions
33
votes
5 answers

Using NanoHTTPD in Android

I am trying to use NanoHTTP to serve up an HTML file. However, NanoHTTP is relatively un-documented, and I am new to Android. My question is, where do I store the html file, and how specifically can I serve it up using NanoHTTP.
Zwade
  • 1,612
  • 4
  • 16
  • 28
32
votes
2 answers

Android http server not accessible from other devices on network intermittently

I'm using NanoHTTPD to present a web server in an android app. I'm using a wifi lock to keep the network alive, and a CPU lock to keep the cpu awake, and keeping it running via a foreground service so that it should never die. What i'm finding is…
Chris
  • 37,118
  • 43
  • 178
  • 226
21
votes
3 answers

Retrieve HTTP Body in NanoHTTPD

How can I retrieve the HTTP POST request body when implementing NanoHTTPDs serve method? I've tried to use the getInputStream() method of IHTTPSession already, but I always get an SocketTimeoutException when using it inside of the serve method.
miho
  • 10,856
  • 6
  • 37
  • 78
19
votes
3 answers

How to serve a file on sdcard using NanoHTTPD (inside Android)

I've written a small Android server using NanoHTTPD. It can serve an HTML file well (web page located at sdcard/www/index.html). Can anybody please help me find out how can I serve an audio or video file instead of an html page using NanoHTTPD?…
Vinit Shandilya
  • 1,505
  • 5
  • 22
  • 41
11
votes
4 answers

NanoHttpd server cannot stream large videos on android

NanoHttpd server code can be found here. I'm starting a new Thread in a service that uses NanoHttpd server to stream large videos (about 150mb) but it just pauses right while the loading dialog is shown. I tried increasing and decreasing the buffer…
josephus
  • 8,148
  • 1
  • 35
  • 53
9
votes
2 answers

How to download two or multiple files at a time in Android using NanoHTTPD?

I use NanoHTTPD as web server in my Android app. I pass two file names from client browser to NanoHTTPD server, and I hope to download the two files at a time, but the following code only download the file1, and the file2 isn't downloaded. How to…
HelloCW
  • 476
  • 10
  • 77
  • 178
8
votes
1 answer

Android Http server and broken pipes

I'm trying to develop an Android UPnP application that has an embedded http server in it, so it can serve media files from the device over lan. The first implementacion of the web server that I used was based on the ElementalHttpServer example from…
darkhie
  • 265
  • 1
  • 14
8
votes
2 answers

Can't Update Notifications text after Forerground service init; Context issue

I have a simple NanoHTTPD server running as a foreground service. I am facing issues in updating the notifications with new content when a new request to a server comes in. The foreground service starts up and the notification shows. No issue there.…
arjun
  • 1,446
  • 11
  • 28
7
votes
1 answer

Store, convert to video an stream Android screen

I use DDMS to get screenshots from my Android phone and I need an efficient way for converting them in video and streaming the video over the network. I have a RawImage which is filled with the data of the screenshot: RawImage mRawImage; Until know…
glarkou
  • 6,635
  • 11
  • 62
  • 112
7
votes
2 answers

Using nanohttpd for server on localhost, how to serve the static HTML code in the whole directory?

I can't make nanohttpd work. It seems not be able to find the www directory in app's root. My code is at https://github.com/tlkahn/neonx My code at MainActivity.java: @Override protected void onCreate(Bundle savedInstanceState) { …
lkahtz
  • 4,460
  • 7
  • 41
  • 69
7
votes
4 answers

HTTPS Server on Android Device Using NanoHttpd

I am trying to run an HTTPS Server on an Android device using NanoHttpd (my final goal is to run WSS server on Android). I successfully ran HTTP Server and Websocket using NanoHttpd on Android. I generated the key on MAC using this command and…
user3183066
  • 71
  • 1
  • 1
  • 2
7
votes
2 answers

Reading InputStream of NANOHTTPD gives Socket TimeOut Exception

I am trying to read the InputStream from IHTTPSession.getInputStream() using the following code but its gives Socket TimeOut Exception every time. private String readInStream(InputStream in){ StringBuffer outBuffer=new StringBuffer(); …
7
votes
2 answers

NanoHTTPD: upload a file using a html form (POST)

i'm using NanoHTTPD webserver 2.1.0 on a Java Desktop Env. (no Android) Everything is working fine...but not the file upload using the POST method (PUT is not supported with forms) Here is my HTML code:
user3796786
  • 199
  • 1
  • 3
  • 11
7
votes
1 answer

Why RMI registry is ignoring the java.rmi.server.codebase property

I am running a Hello World example for java RMI 1) I run the registry in an empty folder motta@motta-laptop ~/tmp $ rmiregistry 2) I start the HTTP server to retrieve the classes at runtime. The download folder contains the remote interface for…
mottalrd
  • 4,020
  • 5
  • 20
  • 31
7
votes
4 answers

How to create nanohttpd server in android?

Actually ,I had searched some questions and go to the github. But I'm new ,I cannot understand the example. I want to create the http server in android so I can access it in PC browser. I had instance a class extend nanohttpd, but the server just…
JunHong
  • 71
  • 1
  • 1
  • 2
1
2 3
15 16