:::: MENU ::::
Browsing posts in: j2ee

How to get the Web Page’s Source Code?

In order to do it, you can do it as it is shown:

package com.mx.development;

 

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.net.URL;

import java.net.URLConnection;

 

public class URLConnectionReader {

public static void main(String[] args) throws Exception {

URL oracle = new URL(“http://www.oracle.com/index.html”);

URLConnection yc = oracle.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));

String inputLine;

while ((inputLine = in.readLine()) != null)

System.out.println(inputLine);

in.close();

}

}


Diference between a filter and a Listener in J2EE

Browsing at  internet I found this little but clear article.. I share with all of you:

Text from Java EE 6

Filter

Filter is an object which transform the request and response (header as well as content).

Listeners

You can monitor and react to events in a servlet’s life cycle by defining listener objects whose methods get invoked when life cycle events occur.