Back to index

wims  3.65+svn20090927
Public Member Functions | Static Private Attributes
url Class Reference
Inheritance diagram for url:
Inheritance graph
Collaboration diagram for url:
Collaboration graph

List of all members.

Public Member Functions

String readURL (String urlStr, boolean cache, String data, String referer)

Static Private Attributes

static String auth_cookie = null
static StringBuffer c

Detailed Description

Definition at line 9 of file

Member Function Documentation

String url.readURL ( String  urlStr,
boolean  cache,
String  data,
String  referer 
) [inline]

Definition at line 12 of file

              c = new StringBuffer(8192);
              try {
                     if ( cache == false ) urlStr.concat((urlStr.indexOf('?')==-1)?"&":"?").concat("stopCache=").concat(Long.toString(System.currentTimeMillis()));
                     URLConnection uc = new URL( urlStr ).openConnection();
                     int len = data.length();
                     if (len>0) uc.setDoInput( true );
                     uc.setDoOutput( true );
                     uc.setRequestProperty( "Referer", referer );
                     if ( cache == false ) uc.setUseCaches( false );
                     if (len>0) {
                            byte[] contentBytes = data.getBytes();
                            uc.setRequestProperty( "Content-length", Integer.toString( len ) );
                            uc.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
                            OutputStream os = uc.getOutputStream();
                            os.write( contentBytes );
                     InputStream is = uc.getInputStream();
                     BufferedReader buffer = new BufferedReader(new InputStreamReader(is));
                     String line;
                     while ((line = buffer.readLine())!=null) c.append(line+"\n");
              } catch ( Exception e ) {
                     c.append("Error: " + e);
              return c.toString();

Here is the call graph for this function:

Member Data Documentation

String url.auth_cookie = null [static, private]

Definition at line 10 of file

StringBuffer url.c [static, private]

Definition at line 11 of file

The documentation for this class was generated from the following file: