Using Deprecated API with Apache 1.1.1
I have a piece of source code that has to be run on Apache 1.1.1 and I need to find a replacement for the depreacted API
this is the error I get:
javac Conn*.java -deprecation
ConnectionOpener.java:55: Note: The constructor java.io.PrintStream(java.io.Outp
utStream) has been deprecated.
out = new PrintStream(socket.getOutputStream());
^
Note: ConnectionOpener.java uses a deprecated API. Please consult the documenta
tion for a better alternative.
This is the section of code from which it comes:
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.net.*;
public class ConnectionOpener
{
//machine to open connection to
private String host;
//port to open connection to.
private int port;
private PrintStream out;
private BufferedReader in;
private Socket socket;
//
// Constructor
ConnectionOpener(String aHost,int aPort)
{
port = aPort;
host = aHost;
System.out.println("ConnectionOpener:");
}
//
// This method is called by the servlet to send information to the
// daemon (server) application.
public String service(String message)
{
try
{
System.out.println("ConnectionOpener:service:");
socket = new Socket(host,port);
out = new PrintStream(socket.getOutputStream());
in = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
System.out.println("ConnectionOpener:service: connected to "
+ socket.getInetAddress()
+ ":" + socket.getPort());
}
catch(Exception e)
{
e.printStackTrace();
}
If sum1 could help I would be really gr8tful

