com.swfit.core.util
Class WebUtils

java.lang.Object
  |
  +--com.swfit.core.util.WebUtils

public final class WebUtils
extends java.lang.Object

Simple and informal utilities for grabbing some contents of a HTML document somewhere on the web. Typical usage is as a starting point for personal notes, where the raw text is likely to be of some value. It does not consider HTML syntax, unicode, or any other feature a serious application will stress. This is the easy way out.

This code merely wraps around basic features of java, and uses the Quiotix HTML parser to extract the plain text. That package can be downloaded from:

http://www.quiotix.com/downloads/html-parser/

Since:
SWFIT1.0
Version:
$Revision: 1.1 $ $Date: 2003/02/02 20:47:25 $
Author:
Olaf Havnes

Field Summary
static int BUF_SIZE
          How large a file should we read ?
static java.lang.String FTP
           
static java.lang.String HTTP
           
static java.lang.String HTTPS
           
static java.lang.String INVALID_HTML
          Error messages
static java.lang.String INVALID_URL
          Error messages
static java.lang.String MAILTO
           
static java.lang.String NO_ACCESS
          Error messages
static java.lang.String NO_DATA
          Error messages
static int NUM_BUF
          How large a file should we read ?
 
Method Summary
static java.lang.String getContent(java.lang.String url_str)
          A very.
static boolean validMail(java.lang.String str)
          Check for valid URL input
static java.lang.String validURL(java.lang.String str)
          Check for valid URL input
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAILTO

public static final java.lang.String MAILTO

HTTP

public static final java.lang.String HTTP

HTTPS

public static final java.lang.String HTTPS

FTP

public static final java.lang.String FTP

BUF_SIZE

public static final int BUF_SIZE
How large a file should we read ?

NUM_BUF

public static final int NUM_BUF
How large a file should we read ?

INVALID_URL

public static final java.lang.String INVALID_URL
Error messages

NO_ACCESS

public static final java.lang.String NO_ACCESS
Error messages

INVALID_HTML

public static final java.lang.String INVALID_HTML
Error messages

NO_DATA

public static final java.lang.String NO_DATA
Error messages
Method Detail

validMail

public static final boolean validMail(java.lang.String str)
Check for valid URL input

validURL

public static final java.lang.String validURL(java.lang.String str)
Check for valid URL input

getContent

public static final java.lang.String getContent(java.lang.String url_str)
A very. very informal spidering of a HTML document. Don't take into account any authentication or special cases, and swallow all IOErrors. (For instance will Google reply with 403 when this code tries to access a search). Just return some preconfigured error messages if something goes wrong.


Swfit developer homepage
Copyright © 2003 Orgdot AS. All Rights Reserved.