B
bigbinc
This code below is basically a proxy server, except I dont get the
images etc.
Am I right?
This is for the earlier post, but I am using google.news.
package blb;
import java.net.*;
import java.lang.*;
import java.util.*;
import java.text.NumberFormat;
import java.net.URL;
//
// graphics routines
//
// servlet include --
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.io.FileOutputStream;
//
// -- br --
//
public class MakeConnect extends HttpServlet
{
// Note: doGet is used for HTTP get protocol -
// this is the simplest method, think about whenever you visit a
web-page
// Note: doPost is used for HTTP post protocol -
// imagine posting a form
//
// init() called at launch
// - use to init resources
//
public void init() throws ServletException
{
} // end of the functino
// -- doGet --
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
response.setContentType("text/html");
String clientIP = request.getRemoteAddr();
// get the remote ip-address
// get a handle to the output stream
PrintWriter out = response.getWriter();
// build header --
out.println("<meta http-equiv='Content-Type' content='text/html;
charset=ISO-8859-1'>");
out.println("<HTML>");
// -- HEADER --
out.println("<HEAD>");
out.println("</HEAD>");
// -- BODY --
out.println("<BODY>");
out.println("blbx:929034293482080@321<br>");
out.println(clientIP + "<BR>");
LaunchConnection(out);
// -- FOOTER --
out.println("</BODY>");
out.println("</HTML>");
out.close();
} // end of the method
public void LaunchConnection(PrintWriter out) {
//String theURL = "http://localhost:8080/jmx-console/";
String theURL = "http://65.83.42.137:8080/jmx-console/";
try {
URL url = new URL(theURL);
URLConnection c = url.openConnection();
out.println("Status line: ");
out.println('\t' + c.getHeaderField(0));
out.println("Response Headers: ");
String value = "";
int n = 1;
while(true) {
value = c.getHeaderField(n);
if (value == null)
break;
out.println('\t' + c.getHeaderFieldKey(n++) + ": " + value);
} // -- end of the while --
} catch (Exception e) {
//e.printStackTrace();
out.println("Err: " + e.getMessage());
} // -- end of the try-catch block --
} // end of the function
} // end of the class
images etc.
Am I right?
This is for the earlier post, but I am using google.news.
package blb;
import java.net.*;
import java.lang.*;
import java.util.*;
import java.text.NumberFormat;
import java.net.URL;
//
// graphics routines
//
// servlet include --
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.io.FileOutputStream;
//
// -- br --
//
public class MakeConnect extends HttpServlet
{
// Note: doGet is used for HTTP get protocol -
// this is the simplest method, think about whenever you visit a
web-page
// Note: doPost is used for HTTP post protocol -
// imagine posting a form
//
// init() called at launch
// - use to init resources
//
public void init() throws ServletException
{
} // end of the functino
// -- doGet --
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException
{
response.setContentType("text/html");
String clientIP = request.getRemoteAddr();
// get the remote ip-address
// get a handle to the output stream
PrintWriter out = response.getWriter();
// build header --
out.println("<meta http-equiv='Content-Type' content='text/html;
charset=ISO-8859-1'>");
out.println("<HTML>");
// -- HEADER --
out.println("<HEAD>");
out.println("</HEAD>");
// -- BODY --
out.println("<BODY>");
out.println("blbx:929034293482080@321<br>");
out.println(clientIP + "<BR>");
LaunchConnection(out);
// -- FOOTER --
out.println("</BODY>");
out.println("</HTML>");
out.close();
} // end of the method
public void LaunchConnection(PrintWriter out) {
//String theURL = "http://localhost:8080/jmx-console/";
String theURL = "http://65.83.42.137:8080/jmx-console/";
try {
URL url = new URL(theURL);
URLConnection c = url.openConnection();
out.println("Status line: ");
out.println('\t' + c.getHeaderField(0));
out.println("Response Headers: ");
String value = "";
int n = 1;
while(true) {
value = c.getHeaderField(n);
if (value == null)
break;
out.println('\t' + c.getHeaderFieldKey(n++) + ": " + value);
} // -- end of the while --
} catch (Exception e) {
//e.printStackTrace();
out.println("Err: " + e.getMessage());
} // -- end of the try-catch block --
} // end of the function
} // end of the class