Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #14280

Packages and Reflection in an Applet

From "Richard Maher" <maher_rj@hotspamnotmail.com>
Newsgroups comp.lang.java.programmer
Subject Packages and Reflection in an Applet
Date 2012-05-05 13:25 +0800
Organization HTTP *is* The Box - Let's think outside
Message-ID <jo2dk4$mh$1@speranza.aioe.org> (permalink)

Show all headers | View raw


Hi,

I have an unsigned Applet that needs to obtain a Username/Password from the 
user (via generic dialog boxes outside of the web-page) and optionally, on 
successful login, display some "welcome" info from the server. To that end, 
I have come up with a rudimentary AWT interface that pops-up a couple of 
modal dialogue boxes. (There is also a "status" window that has bytes 
received/sent etc).

So, I have the default, fallback, rough-as-guts option for obtaining user 
credentials but would like to allow the consumers of my Applet to override 
the default and supply their own much slicker +/- localized UI. So I have 
the simple interface below that each prospective UI class must implement but 
I don't know what part packages/protection play in this scenario as well as 
reflection. If there are any people here with direct experience of the 
following conditions/questions I would be very grateful for their advice: -

1) Can a class loaded via Reflection (eg: myInter localGUI = 
(myInter)(class.forName("appletParameter").newInstance())) be in the same 
Package, and enjoy the benefits/protection of same, as the caller? Ideally 
here, the methods/variables/properties of the newly loaded class (albeit 
under the restriction of being loaded from the same codebase) being package 
private and not public? Again ideally, I do not want the methods in this GUI 
to be accessible from JavaScript but obviously accessible from my applet.

2) I'd expect the "tier3Client" implementing class (and any additional 
classes) to be supplied in a separate archive/JAR file and this will be 
located via the "archive=a,b,c" specifier (with "codebase_lookup" set to 
false). My "understanding" is that class.forName() will use the same 
classloader as the Applet and therefore I'm hoping that it will happily 
search through all specified JAR files looking for the requested class?

3) Are there any other restrictions/requirements or wil this just not work?

Cheers Richard Maher

/**
 * Copyright Tier3 (c) Software. All rights reserved.
 *
 * @author    Richard Maher
 * @version   1.0
 *
 */

package tier3Client;

interface Tier3UserDialog {

    boolean doCredentials();

    String  getUsername();

    String  getPassword();

    boolean isWelcomeRequired();

    void    doWelcome(byte[] t3IdBuf);

    void    doConsole(byte[]      t3IdBuf,
                      Tier3Logoff sourceSession,
                      String      codeHost,
                      int         portNum);

    void    updateRcvd(int bytes);

    void    updateSent(int bytes);

    void    showRefCnt(int pages);

    void    appendConsoleMsg(String msg, int color);

    void    appendConsoleMsg(String msg);

    void    closeConsole();
} 

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Packages and Reflection in an Applet "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-05-05 13:25 +0800
  Re: Packages and Reflection in an Applet Arne Vajhøj <arne@vajhoej.dk> - 2012-05-05 17:30 -0400
    Re: Packages and Reflection in an Applet "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-05-07 20:47 +0800
      Re: Packages and Reflection in an Applet Arne Vajhøj <arne@vajhoej.dk> - 2012-05-08 22:14 -0400
  Re: Packages and Reflection in an Applet markspace <-@.> - 2012-05-05 14:45 -0700
    Re: Packages and Reflection in an Applet "Richard Maher" <maher_rj@hotspamnotmail.com> - 2012-05-07 20:54 +0800
      [OT] Poster's name (Was: Packages and Reflection in an Applet) Lew <noone@lewscanon.com> - 2012-05-08 05:32 -0700
        Re: [OT] Poster's name (Was: Packages and Reflection in an Applet) markspace <-@.> - 2012-05-08 07:43 -0700
          Re: [OT] Poster's name (Was: Packages and Reflection in an Applet) Jan Burse <janburse@fastmail.fm> - 2012-05-08 17:02 +0200
          Re: [OT] Poster's name (Was: Packages and Reflection in an Applet) Gene Wirchenko <genew@ocis.net> - 2012-05-08 09:26 -0700

csiph-web