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.

247 questions
1
vote
1 answer

Android AssetServer extending NanoHTTPD

I'm developing an AssetServer extending NanoHTTPD in order to access Javascript features not available to file:// based pages. This is the code I have so far: class AssetServer extends NanoHTTPD{ private Activity activity; public…
lowerkey
  • 8,105
  • 17
  • 68
  • 102
1
vote
2 answers

Caching issues w. custom web server. Chrome sends no If-Modified-Since header but still gets 304 every now and then

I'm using a custom web server built on NanoHTTPD, that I've added caching features to. There's only one part in the code that could throw a 304 Not Modified response: if(isNotModified(f,header,parms)){// if requested file has not been…
1
vote
1 answer

setting Access-Control-Allow-Origin in nanohttpd

I have a cordova application that uses nanoHttpd to serve files. How do i set Access-Control-Allow_origin for the files served by nanoHttpd. I went through source code of the server, but I was not able to find how to set this header. Note: The…
MIdhun Krishna
  • 1,739
  • 1
  • 13
  • 31
1
vote
1 answer

move file uploaded from nanohttpd's Temporary directory to SD card

I am uploading a file "LICENSE.txt" from my PC to Android WebServerApp. NanoHTTPD uses a temporary directory to save the uploaded files. The temporary location is decided by : tmpdir = System.getProperty("java.io.tmpdir"); and file gets…
Manmohan Bishnoi
  • 791
  • 13
  • 37
1
vote
2 answers

Cannot get http server work on android

I have a http server code (I tried both TJWS or NanoHTTPD), the client from the same application would connect to server running on port 8080 or whatever. I am starting server object in a separate AsyncTask so it should be okay. While NanoHTTPD…
duckduckgo
  • 1,280
  • 1
  • 18
  • 32
1
vote
2 answers

Nanohttpd server in Android

i am developing a android app which uses nanohttpd to create a web server and when i run it it says the activity has stopped this is my code please help me any help will be appriciated.here goes the code: package dolphin.developers.com; import…
Prakhar
  • 2,270
  • 19
  • 26
1
vote
1 answer

NanoHttpd seems to stop responding to individual clients after some requests

Using nanohttpd, I have created a webpage that has buttons on it, when the buttons are clicked I make a ajax get call to nanohttpd with a different URI. The different buttons on the screen send different values for the parms. But it seems like I am…
witnessmenow
  • 308
  • 3
  • 8
1
vote
1 answer

Range error Java NanoHTTPD serving HTTP Live Streaming

Range error Java NanoHTTPD serving HTTP Live Streaming I am trying to serve HLS Video stream using Java based NanoHTTPD HTTP server. I am also using VLC to play the .m3u8 file. Funny thing is VLC is able to play my video but NanoHTTPD is throwing…
Iqbal
  • 590
  • 1
  • 4
  • 15
1
vote
2 answers

NanoHTTPD Example Build Error

This question is really, really stupid as I have no experience with Maven. I was interested in NanoHTTPD as an embedded web server in my project, but upon downloading the source and testing it out, I get the following error: Failed to execute goal…
William Yang
  • 759
  • 9
  • 30
1
vote
1 answer

InputStream containing multiple files

I try to send multiple Files from my Server (NanoHttpd) to my Client (Apache DefaultHttpClient). My approach is to send multiple files via one Response of NanoHttpd. I can only send one InputStream in the Response and as far as i know i could only…
Naturjoghurt
  • 541
  • 6
  • 21
1
vote
2 answers

jQuery.post and encoding

I have a form in a webpage, where the user can enter any arbitrary html. Once he clicks submit, I am sending the content to the webserver via AJAX using jQuery.post(). But for certain HTML, I am getting this response from the server HTTP/1.0 400 Bad…
Sudar
  • 18,954
  • 30
  • 85
  • 131
1
vote
1 answer

Java HTTP Server and Resources

I'm using NanoHTTPd to serve files from my android app. I can open the .html files fine but it's trying to view images that's the problem. Anything like a webpages background image doesn't display. Does anybody have any example code for this. I know…
user1056798
  • 245
  • 6
  • 20
1
vote
0 answers

jquery / soap request to local libcsoap/nanohttpd server -> Origin * is not allowed by Access-Control-Allow-Origin

I wrote a c-program which needs an interface for other programs, also for a webste. So i just choosed libcsoap to create a soap interface. The libcsoap-library is based on nanohttpd, a small http server written in c. I just implemented a few test…
Kevin Meier
  • 2,339
  • 3
  • 25
  • 52
1
vote
1 answer

Directly access file from android sd card using nanohttpd

Is there any way to access a file of android phone's sd card from desktop? I wrote an application, where there is a file named video.mp4 in /mnt/sdcard/. I have started a nanohttp server(http) when the activity started, which working directory is…
shantanu
  • 2,408
  • 2
  • 26
  • 56
0
votes
1 answer

sending parameters from a server written in server to another java runtime library

I'm running NanoHTTPD as a server , reading the inputs from client side. These parameters taken from the user are to be passed to another java program which actually manipulates that data and sends back to the java server. So, is there any way to…
YBV
  • 31
  • 1