home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.app.web;
-
- import com.extensibility.app.ApplicationPreferences;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.io.PrintWriter;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLConnection;
- import java.net.URLEncoder;
- import java.util.Enumeration;
- import java.util.Hashtable;
-
- public class WebPost implements Runnable {
- String postLocation;
- URL url;
- ApplicationPreferences prefs;
- URLConnection connection;
- boolean successful = false;
- Hashtable data;
-
- public void init(String var1, Hashtable var2, ApplicationPreferences var3) {
- this.postLocation = var1;
- this.data = var2;
- this.prefs = var3;
- }
-
- public void run() {
- this.successful = false;
-
- try {
- this.url = new URL(String.valueOf(this.postLocation).concat(String.valueOf("?")));
- } catch (MalformedURLException var7) {
- return;
- }
-
- try {
- this.connection = this.url.openConnection();
- this.connection.setDoOutput(true);
- PrintWriter var1 = new PrintWriter(this.connection.getOutputStream());
- Enumeration var2 = this.data.keys();
- Enumeration var3 = this.data.elements();
-
- while(var2.hasMoreElements()) {
- var1.println(String.valueOf(String.valueOf(String.valueOf("&").concat(String.valueOf((String)var2.nextElement()))).concat(String.valueOf("="))).concat(String.valueOf(URLEncoder.encode((String)var3.nextElement()))));
- }
-
- var1.close();
- BufferedReader var4 = new BufferedReader(new InputStreamReader(this.connection.getInputStream()));
-
- String var5;
- while((var5 = var4.readLine()) != null) {
- if (var5.equalsIgnoreCase("true")) {
- this.successful = true;
- }
- }
-
- var4.close();
- } catch (IOException var8) {
- this.successful = false;
- }
-
- if (this.successful && this.prefs != null) {
- this.prefs.put("RGS", "1");
-
- try {
- this.prefs.save();
- } catch (IOException var6) {
- }
- }
-
- }
-
- protected void finalize() {
- this.connection = null;
- }
-
- public boolean wasSuccessfull() {
- return this.successful;
- }
- }
-