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
13
votes
3 answers

How to download com.sun.net.httpserver package?

I'm not familiar with where I can get the package com.sun.net.httpserver? I like to use this package in Android. Thanks!
Jona
  • 13,325
  • 15
  • 86
  • 129
8
votes
4 answers

1s Delay in HttpServer since Java 7

We are using the internal HttpServer class in a project to exchange data between a client and a server over HTTP. As we switched to Java 7, we realized a delay in the delivery of the results. We could reduce the problem to the following…
Dominik
  • 1,058
  • 8
  • 20
6
votes
1 answer

com.sun.HttpServer socket backlog

What does socket backlog mean? for example I have web service @WebService public class Calculator { public int sum(int a, int b) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } …
michael nesterenko
  • 14,222
  • 25
  • 114
  • 182
5
votes
4 answers

How to shutdown com.sun.net.httpserver.HttpServer?

The Http Server embedded in JDK 6 is a big help developing web services, but I've got situation where I published an Endpoint and then the code crashed and left the server running. How do you shutdown the embedded server once you've lost the…
Dean Schulze
  • 9,633
  • 24
  • 100
  • 165
5
votes
3 answers

Sun HTTPServer - how can I write post-process filter?

I trying some things with the HTTP server of Sun JRE. After reading twice the documentation, I am still confused. The com.sun.net.httpserver.Filter javadoc says the following Asks this filter to pre/post-process the given exchange. The filter can…
Gabor Garami
  • 1,245
  • 8
  • 26
4
votes
1 answer

Source of java HttpServer

I am unable to find com.sun.net.httpserver.HttpServer source in src.jar of java 1.6. Where is it available?
Fakrudeen
  • 5,778
  • 7
  • 44
  • 70
4
votes
3 answers

HttpServer within junit fails with address in use error after first test

I have a Java class for use with JUnit 4.x. Within each @Test method I create a new HttpServer, with port 9090 used. The first invocation works find, but subsequent ones error with "Address is already in use: bind". Here's an example: @Test public…
jmkgreen
  • 1,633
  • 14
  • 22
3
votes
1 answer

Can not use the com.sun.net.HTTPServer.httpserver

I am using Eclipse Indigo and Java jdk7. I'd like to create a litte webserver, but I am not able to use sun's webserver. When I type: { com.sun.net.httpserver.httpserver server; } I get the following Eclipse-Error-Message: Description Resource …
Subby
  • 1,997
  • 4
  • 22
  • 38
3
votes
1 answer

Performance: com.sun.net.httpserver.HttpServer vs. jetty

i'm working on a java web application which will sends and receives JSON strings. The JSON is generated through jersey and maps to a jaxb anotated pojo. The application itself isn't very complex but needs to work under heavy traffic. I tried two…
Sordul
  • 51
  • 2
  • 5
3
votes
2 answers

com.sun.net.httpserver.HttpHandler ClassNotFound Exception on Java Embedded Runtime Environment

i am trying to run restlet on an ejre. In eclipse with normal jre the code works absolutely fine, but in the ejre i get the following exception: java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler cannot be found I am using restlet…
3
votes
0 answers

Java HttpExchange: Data missing in POST Request Body

In my Java application I use the com.sun.net.httpserver classes for a small built-in web server. I also want to support file uploads. From a web page the user can select a file in a standard HTML form:
Matthias
  • 9,817
  • 14
  • 66
  • 125
2
votes
1 answer

Sending an error response with com.sun.net.httpserver.HttpServer

I'm an experienced Java programmer but a newbie web developer. I'm trying to put together a simple web service using the HttpServer class that ships with JDK 1.6. From the examples I've viewed, some typical code from an HttpHandler's handle method…
Adamski
  • 54,009
  • 15
  • 113
  • 152
2
votes
0 answers

What is the alternative of AuthCacheValue and AuthCacheImpl in Java11

AuthCacheValue and AuthCacheImpl were present in sun.net package till jdk 1.8 But now while trying to use the same in jdk 11, it seems the package is no longer visible. Any leads would be highly appreciated if someone can suggest what exactly is the…
2
votes
4 answers

HTTP server capable of Keep-Alive

I'm trying to create a http server in Java which is capable of providing keep-alive connections. I'm using the com.sun.net.httpserver.HttpServer class. import java.io.IOException; import java.io.OutputStream; import…
Paul
  • 21
  • 1
  • 2
2
votes
1 answer

HttpServer very slow with keepalive

The following HttpServer program easily handles 8000 requests/s without HTTP keepalive, but a measly 22 requests/s with keepalive. import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import…
phihag
  • 278,196
  • 72
  • 453
  • 469
1
2 3 4