From cf51ce8a9c935165c86590a9ad28e267c139eb95 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 25 Oct 2001 23:43:02 +0000 Subject: [PATCH] Connect to the server specified by our codebase host. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@574 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../micasa/client/MiCasaApplet.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/java/com/threerings/micasa/client/MiCasaApplet.java b/src/java/com/threerings/micasa/client/MiCasaApplet.java index 3f9235e79..76ca4ce49 100644 --- a/src/java/com/threerings/micasa/client/MiCasaApplet.java +++ b/src/java/com/threerings/micasa/client/MiCasaApplet.java @@ -1,5 +1,5 @@ // -// $Id: MiCasaApplet.java,v 1.3 2001/10/25 23:29:00 mdb Exp $ +// $Id: MiCasaApplet.java,v 1.4 2001/10/25 23:43:02 mdb Exp $ package com.threerings.micasa.client; @@ -31,17 +31,15 @@ public class MiCasaApplet extends Applet // create our client instance _client = new MiCasaClient(_frame); - String username = getParameter("username"); - if (username == null) { - throw new IOException("Missing username parameter."); - } - String authkey = getParameter("authkey"); - if (authkey == null) { - throw new IOException("Missing authkey parameter."); - } + String username = requireParameter("username"); + String authkey = requireParameter("authkey"); + String server = getCodeBase().getHost(); Client client = _client.getContext().getClient(); + // indicate which server to which we should connect + client.setServer(server, Client.DEFAULT_SERVER_PORT); + // create and set our credentials client.setCredentials( new UsernamePasswordCreds(username, authkey)); @@ -60,6 +58,16 @@ public class MiCasaApplet extends Applet } } + protected String requireParameter (String name) + throws IOException + { + String value = getParameter(name); + if (value == null) { + throw new IOException("Applet missing '" + name + "' parameter."); + } + return value; + } + /** * Display the client frame and really get things going. */