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

Does JRE HttpServer violates the 'expect-continue' semantics of HTTP?

This is a follow up post to some problems I've had using Java built in com.sun.net.httpserver.HttpServer and an multistep authentication scheme. I was hinted at, that sending larger data amounts make it impossible for Java clients to receive early…
mtsz
  • 2,725
  • 7
  • 28
  • 41
0
votes
6 answers

java.lang.OutOfMemoryError on HttpServer on download large data

I have java 6 embedded HttpServer. It has a handle which allows clients to download a big text file. The problem is that whenthe server has more then 10 simultaneous clients, i get out of memory exception. I'm prety sure that the problem is around…
Sophie
  • 1,580
  • 3
  • 16
  • 20
0
votes
0 answers

How to configure com.sun.net.httpserver to remove wildcard binding?

I am using the com.sun.net.httpserver.HttpServer to expose a REST API in a kubernates microservice. Till now it was with wildcard binding. I need to remove the wildcard binding to bind this to its local IP I am using the…
jay
  • 3
  • 2
0
votes
1 answer

The package com.sun is not accessible. Java in Eclipse. Classic Problem, but nothing works for me

Im trying to use the HttpServer Class from com.sun package but i can't import it. It keeps saying: "The package com.sun is not accessible." I've tried every solution i could find in other questions about this topic. I've added a rule to have access…
0
votes
0 answers

How to make HttpServer app "com.sun.net.httpserver" with android studio?

How to make HttpServer app "com.sun.net.httpserver" with android studio? I want make HttpServer that it will run from internal storage text file like- "/storage/emulated/0/htdocs/index.html" I am trying but not working! public void…
0
votes
0 answers

How to fix java.io.IOException: headers already sent error?

I'm implementing a web server using sun.net.HttpServer to enable send response message to the user. But sometimes I am getting the error message below. java.io.IOException: headers already sent at…
0
votes
1 answer

Why doesn't this Java HttpsServer successfully complete a TLS handshake?

I've tried to set up the minimal possible HTTPS server in Java based on Simple Java HTTPS server, with one difference: it uses a dynamically generated certificate signed by a static CA. (The purpose of this is to facilitate man-in-the-middle…
Taymon
  • 24,950
  • 9
  • 62
  • 84
0
votes
1 answer

sun Httpserver: access from the Handler to an object created externally

Maybe dumb question: I'm trying to realize a little server in Java with com.sun.net.httpserver package. I am at the very beginning of server programming, so probably I'm missing something. It should work like this: first, it creates an object (an…
breathe0
  • 573
  • 1
  • 7
  • 21
0
votes
0 answers

Java: Can't send HTTP Post Request in Catch

I need to post request to an API inside catch to store some logs. But when I put it the request inside catch, it returned: java.io.IOException: Server returned HTTP response code: 500 for URL Code: try { ... } catch (Exception e) { …
rathaom
  • 33
  • 4
0
votes
0 answers

Memory leaks in my Java server application

I have a simple Java server application implemented using com.sun.net.HttpServer API. It receives REST requests almost every second, reads a large HashMap for some texts and simply sends back the texts after some processing. The server part simply…
0
votes
1 answer

JAX WS with com.sun.net.HttpServer and .net

I have a very frustrating problem. I have a web service created with JAX WS annotations and Endpoint.publish(...) trick. Of course, it uses com.sun.net.HttpServer. When I try to add a service reference in Visual studio, it won't budge. The server…
Andr
  • 617
  • 2
  • 9
  • 24
0
votes
0 answers

java: identify the actual http connection

I'm developing a HTTP server using HttpServer class. The code is like the following. public static void main(String[] args) throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(8989), 0); server.createContext("/",…
Kallel Omar
  • 1,208
  • 2
  • 17
  • 51
0
votes
3 answers

Sun Java HTTPServer has a bug, how to fix it?

I'm using com.sun.net.httpserver.HttpServer in my project. However, it seems that the server leaks connections when it gets invalid data from the HTTP connection. The bug is this…
Nakedible
  • 4,067
  • 7
  • 34
  • 40
0
votes
1 answer

Class not found JettyHttpServerProvider -> Unsupported major.minor version 52.0

By setting System.setProperty(.sun.net.httpserver.HttpServerProvider", "org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider"); The org.eclipse.jetty.jaxws2spi.JettyHttpServerProvider class is not…
Gobliins
  • 3,848
  • 16
  • 67
  • 122
0
votes
1 answer

With com.sun.net.httpserver, why image is not showing up in Java generated html page?

I'm using com.sun.net.httpserver to serve html pages, text content shows up correctly, but I can't get it to serve images, here is how my code looks like : static String Test(int Font_Size,String First_Name,String Last_Name) { String…
Frank
  • 30,590
  • 58
  • 161
  • 244