Questions tagged [com.sun.net.httpserver]

A Java class that provides a simple HTTP server framework.

A Java class that provides a simple HTTP server framework.

Persistent urban myth holds that it has been deprecated, but it hasn't. This appears to stem from the behaviour of some IDEs when encountering a com.sun.* package.

58 questions
2
votes
1 answer

JavaHTTPServer Get contents of (html) textbox on (html) button click

my question is how to get the contents of a textbox in my javahttpserver webinterface Message - Send
Scrumplex
  • 522
  • 1
  • 6
  • 15
1
vote
1 answer

"delay" in delivering WebService reply when using sun HttpServer

I'm writing a standalone application that implements a Web Service, for which the Endpoint is published using the embedded Sun HttpServer. I have an odd issue with this, where in a specific deployment situation, there is an apparent delay between…
Maarten Boekhold
  • 867
  • 11
  • 21
1
vote
1 answer

Is there a way where I can serve static files one /home route

I have root folder called TodoList this folder contains another folder called TodoList/Views/index.html,style.css my goal is to serve the index.html and the style.css on the route of /home however the index.html has one element Click and it has…
Aliayub Ali
  • 83
  • 1
  • 7
1
vote
0 answers

Handling HTTP response in Java HTTPServer: StreamClosedException

I'm trying build a simple Java HTTP server in Java 1.8. A http client should request the server to process a file, and after a few minutes once the processing if over, the server should return a response message to the client (so it's not immediate…
Mary
  • 393
  • 1
  • 4
  • 17
1
vote
1 answer

How to configure HTTPServer to use content length and not transfer encoding: chunked?

I'm using java's HTTP Server object with web service implemeted by WebServiceProvider. I see that no matter of the client request, the answer is chunked and i need it to be with content length. so i'm assuming the problem is in the server and not…
Sophie
  • 1,580
  • 3
  • 16
  • 20
1
vote
1 answer

Errors in reading text file from S3 via AWS Java SDK

Im trying to read a text file from AWS S3 via JAVA SDK v2 and send it back to a client via HTTP (using com.sun.net.httpserver.HttpServer). I want to read the contents as string. But my simple code below doesn't work. What is the problem? How to fix…
1
vote
1 answer

Multi-Threaded Java HTTP-Server

I use sun.net.httpServer to run an HTTP-server in my application (don't ask me why). The thing is it processes my requests in just one thread so my throughput is a disaster. I thought if I setExecutor to my httpServer this problem would be resolved…
Hadi Moloodi
  • 639
  • 7
  • 12
1
vote
1 answer

Are com.sun.net.httpserver.HttpExchange attributes broken?

First some (very basic) sample code to illustrate my problem: final java.util.concurrent.atomic.AtomicLong previousId = new java.util.concurrent.atomic.AtomicLong(); final com.sun.net.httpserver.HttpServer server =…
Julien Royer
  • 1,419
  • 1
  • 14
  • 27
1
vote
1 answer

Apache HttpClient Header Problem on Response

I have used Apache HttpClient together with java.sun.net.httpserver as Server. The Server handles Http-Get Requests. Att the beginning, the server sets a session cookie using set-cookie header, wich is accepted by the apache httpclient (according to…
1
vote
0 answers

Why does HttpContext accept requests from all URI's beginning with specified path?

I have a java application that is running with the following java version $ java -version java version "11.0.3" 2019-04-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS,…
tgabb
  • 349
  • 3
  • 12
1
vote
1 answer

Special character encoding in my simple Java HTTPServer

I have a simple Java application, basically a server implemented using com.sun.net.HttpServer API, that reads a file and simply sends back the texts after some processing. The server part simply looks like this: server =…
1
vote
0 answers

How to pass on HttpServer Data to a different URL

I am writing a basic http proxy using the com.sun.net library that uses HTTP Server and right now my proxy is able to receive the information from the client, but once I have it, how do I pass it on to a different URL (the server) that I specify? I…
1
vote
2 answers

Does com.sun.net.httpserver.HttpServer support pipelining?

Does com.sun.net.httpserver.HttpServer support single-connection pipelining? It seems to handle multiple clients in parallel, but a single connection's requests are being serially executed. Is this accurate, and if so, is there a way to work around…
Brian
  • 11
  • 1
1
vote
1 answer

com.sun.net.httpserver.HttpServer max connection count?

Sometimes (pretty rarely) when I connect to a running instance of a com.sun.net.httpserver.HttpServer I get a "connection refused" message back. Anybody know why this might be? Is there a thread limit to the number of connections it can handle? Can…
rogerdpack
  • 62,887
  • 36
  • 269
  • 388
1
vote
1 answer

JAX-WS Web Services Without Java EE Containers 1.6 and 1.7

I was trying this tutorial in java 1.7, but if i selected java 1.6 i got this exception: Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class…
user1722245
  • 2,065
  • 1
  • 18
  • 31