Using System.getProperty(User.Name) in GWT

1,776 views
Skip to first unread message

Saty

unread,
Apr 5, 2012, 10:33:01 AM4/5/12
to Google Web Toolkit
I would like to use System.getProperty(User.Name) in GWT. The server
will be running on iSeries platform. I am looking for ways to do this
without introducing new framework .

Saty

unread,
Apr 16, 2012, 9:34:20 PM4/16/12
to Google Web Toolkit
Hi GWT experts,

Can you please provide any suggestions?

Thanks!

Hilco Wijbenga

unread,
Apr 16, 2012, 10:03:27 PM4/16/12
to google-we...@googlegroups.com

If you mean on the server then it has nothing to do with GWT, just run
System.getProperty. Otherwise, create some sort of callable API (ReST,
RPC, ...) and get the data to the client that way.

In order to receive better answers, ask better questions. Be specific,
tell us what you tried and why/how it failed.

Saty

unread,
Apr 17, 2012, 12:40:04 PM4/17/12
to Google Web Toolkit
Thanks for your feedback!

I am trying to get the logged in windows user id on the client side.I
want to get the user name of the user that initiated the request from
the browser. This is the code that I tried to use in onModuleLoad
method:

String str = System.getProperty("user.name");

I was getting the error that such method is not defined.

Based on my search on the web, GWT client does not support this
method. Even, I tried to do JRE emulation based on the link:

http://javaasylum.blogspot.com/2011/02/emulate-non-supported-class-in-gwt.html.

GWT still complains. Probably, GWT has already implemented a version
of java.lang.System class.

There were some posts on using windows active x control to get he user
name. I tried JSNI to implement the following code,even though it can
work only on IE (not an ideal solution).

var WinNetwork = new  ActiveXObject("WScript.Network");

I got the error that GWT could not instantiate the active X object.

Please let me know if you have any other info. I am sure some one
might have figured the solution! This should be a typical use case.



On Apr 16, 9:03 pm, Hilco Wijbenga <hilco.wijbe...@gmail.com> wrote:
> On 5 April 2012 07:33, Saty <saty1...@gmail.com> wrote:
>
> > I would like to useSystem.getProperty(User.Name) in GWT. The server
> > will be running on iSeries platform. I am looking for ways to do this
> > without introducing new framework .
>
> If you mean on the server then it has nothing to do with GWT, just runSystem.getProperty. Otherwise, create some sort of callable API (ReST,

Hilco Wijbenga

unread,
Apr 17, 2012, 12:54:55 PM4/17/12
to google-we...@googlegroups.com
On 17 April 2012 09:40, Saty <saty...@gmail.com> wrote:
> Thanks for your feedback!
>
> I am trying to get the logged in windows user id on the client side.I
> want to get the user name of the user that initiated the request from
> the browser. This is the code that I tried to use in onModuleLoad
> method:
>
> String str = System.getProperty("user.name");
>
> I was getting the error that such method is not defined.
>
> Based on my search on the web, GWT client does not support this
> method. Even, I tried to do JRE emulation based on the link:
>
> http://javaasylum.blogspot.com/2011/02/emulate-non-supported-class-in-gwt.html.
>
> GWT still complains. Probably, GWT has already implemented a version
> of java.lang.System class.
>
> There were some posts on using windows active x control to get he user
> name. I tried JSNI to implement the following code,even though it can
> work only on IE (not an ideal solution).
>
> var WinNetwork = new  ActiveXObject("WScript.Network");
>
> I got the error that GWT could not instantiate the active X object.
>
> Please let me know if you have any other info. I am sure some one
> might have figured the solution! This should be a typical use case.

I'd call this highly *atypical* actually. Why do you need the user's
MS Windows user id?!? Do you even know all your users will be using
that particular OS? What are you going to do with all the users logged
in as Administrator?

If you need them to log in then have them create an account in your
application. *That* would be typical. :-)

Steffen Schäfer

unread,
Apr 18, 2012, 5:26:45 AM4/18/12
to google-we...@googlegroups.com
A web application has no direct access to the OS and that's a good thing.
But your use-case (transparent login using the Windows credentials) is typically solved by using NTLM (http://en.wikipedia.org/wiki/NTLM).

I think the following blog post is a good starting point for the server side:
http://www.jroller.com/paul/entry/using_ntlm_windows_login_and

But it seems to not be the exact use-case you have (they authenticate against the windows domain).

I hope that helps.
Reply all
Reply to author
Forward
0 new messages