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
6
votes
1 answer

how to stream video from internet via nanoHTTPd to VideoView

I want to download and play video files during downloading. Since VideoView is not helping with this matter I decided to work with nanoHTTPd to create a pseudo HTTP server and inside my own server try to download video file and play it afterward but…
Vahid Hashemi
  • 5,182
  • 10
  • 58
  • 88
6
votes
0 answers

NanoHTTPD. Cache InputStream to file and continue streaming

I want to cache data while playing it in MediaPlayer. As I read, there is one way to do it - create own local http server and set local url to MediaPlayer's setDataSource(String path). I am using NanoHTTPD as a local server. There is code of serve…
hexonxons
  • 845
  • 1
  • 10
  • 19
5
votes
1 answer

How to send JSON data as response in nanohttpd

I am using the nanohttpd server in my project. The GET Request should send a JSON file as response but nanohttpd only allows String. How can I do this? This is the GET method: class GetHandler{ JSONObject response; JSONObject doGet(Queue queue){ …
Pooja
  • 97
  • 12
5
votes
1 answer

Setting CORS for NanoHttpd in android

I have a hls stream that is downloaded from server. I then create a local webserver using this library ! I successfully ran the server and I can play the content from a VLC player on my PC .However it fails on JW player and Google Chromecast due to…
Sidhanth Sur
  • 303
  • 2
  • 9
5
votes
1 answer

Redirect to another domain from nanoHttpd server

I have implemented nanohttpd server nano My goal is to forward request to different domain based on condition i have. My code is like this package CreateServer; import java.io.File; import java.io.IOException; import java.util.Collections; import…
Syed Mhamudul Hasan
  • 1,341
  • 2
  • 17
  • 45
5
votes
1 answer

Video streaming using NanoHttpd, Error: java.net.SocketException: sendto failed: EPIPE (Broken pipe)

I need to stream a video and play continuously in a webpage. I am using Nanohttpd library to run the server in my Android app. I can able to stream and play the video when the page loads. Once the video completes playing I can't able to play the…
Mohanraj Mani
  • 51
  • 1
  • 2
5
votes
1 answer

Keep Android awake for incoming network connections?

I'm writing an HTTP server for Android devices, implemented via NanoHTTPD. A goal of mine is to have the device allow incoming connections even with the screen off. I started small, with a persistent notification, thinking that would keep my app in…
bob
  • 1,879
  • 2
  • 15
  • 27
5
votes
1 answer

How to send file name with NanoHttpd Response

I've successfully achieved file transfer over local network using NanoHttpd. However, I'm unable to send the file name in NanoHttpd Response. The received files have a default name like this: localhost_8080. I tried to attach file name in response…
Vinit Shandilya
  • 1,643
  • 5
  • 24
  • 44
5
votes
1 answer

Is it possible to restrict NanoHttpd to localhost only?

I am running NanoHttpd on 8080 on my local desktop. I can access the server locally in my browser at http://localhost:8080/. That part is working as expected. However, I do not want my neighbor (or worse, the world) to also be able to access it at…
martinez314
  • 12,162
  • 5
  • 36
  • 63
5
votes
0 answers

Proxying Android webview (not on system level)

Are there anyways to programmatically proxy Android Webview requests within an application only? (I want all requests to be passed through an embedded proxy) All of the solutions i have found so far are system level and will change proxy settings…
Christopher Lawless
  • 1,057
  • 2
  • 12
  • 19
4
votes
1 answer

An alternative to NanoHTTPD that handles simultaneous connections?

I started using NanoHTTPD for a project. Indeed it is very good in its simplicity. Unfortunately it turned out that I need to handle simultaneous connections, for example I have a very long response and in the meanwhile the server shall not be…
gotch4
  • 13,093
  • 29
  • 107
  • 170
4
votes
2 answers

How to create an http server on android that a desktop can access (vice-versa) using NanoHTTPD

Using an available WiFi IP (i.e. 192.xxx.x.x, using post 8080), I'd like to create a http server in android that can connect and can be accessed by a desktop so that I can transfer files to the android device. Update: I'm currently trying out…
eunique0216
  • 875
  • 1
  • 16
  • 28
4
votes
1 answer

NanoHTTPD - unable to add gradle dependency

I am trying to add NanoHTTPD to my Android project. As mentioned in README.md, I added dependencies { runtime( [group: 'org.nanohttpd', name: 'nanohttpd', version: '2.3.1'], ) } it is giving error: Could not find method runtime()…
Arundale Ramanathan
  • 1,781
  • 1
  • 18
  • 25
4
votes
0 answers

cordova server listen to custom HTTP methods

I am using this cordova plugin which creates a webserver. The way it is built I think it should be able to listen to any incominh HTTP methods but it is not working though. I am simply getting that the request is not handled. webserver.onRequest( …
arjun
  • 1,594
  • 16
  • 33
4
votes
1 answer

Android: keep web server running

I am running a web server (NanoHTTPD) in an Android Service. onStartCommand() returns the value from the overridden method in Service, so it should be "sticky". However the service seems to stop, or at least the webserver stops responding. This…
Dennis Thrysøe
  • 1,791
  • 4
  • 19
  • 31
1
2
3
16 17