Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to get Domain Name via JSP?

Reply
Thread Tools

How to get Domain Name via JSP?

 
 
Ed
Guest
Posts: n/a
 
      05-18-2004
What is the quick and easiest way to get the domain name in JSP?


 
Reply With Quote
 
 
 
 
Christophe Vanfleteren
Guest
Posts: n/a
 
      05-18-2004
Ed wrote:

> What is the quick and easiest way to get the domain name in JSP?


What or whose domain name are you talking about?

--
Kind regards,
Christophe Vanfleteren
 
Reply With Quote
 
 
 
 
Ed
Guest
Posts: n/a
 
      05-18-2004
I need the domain name when I login into my jsp application. I need the
domain name of my local network but I don't want to hard code it.

"Christophe Vanfleteren" <(E-Mail Removed)> wrote in message
news:U6pqc.115185$(E-Mail Removed)-ops.be...
> Ed wrote:
>
> > What is the quick and easiest way to get the domain name in JSP?

>
> What or whose domain name are you talking about?
>
> --
> Kind regards,
> Christophe Vanfleteren



 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      05-18-2004
Ed wrote:
> What is the quick and easiest way to get the domain name in JSP?
>


request.getServerName()

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
Ed
Guest
Posts: n/a
 
      05-18-2004
That only gives me the name of the web server. I need the domain...

"Chris Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)4.net...
> Ed wrote:
> > What is the quick and easiest way to get the domain name in JSP?
> >

>
> request.getServerName()
>
> --
> www.designacourse.com
> The Easiest Way to Train Anyone... Anywhere.
>
> Chris Smith - Lead Software Developer/Technical Trainer
> MindIQ Corporation



 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      05-18-2004
Ed wrote:
> That only gives me the name of the web server. I need the domain...
>


Then you'll need to clarify what you mean by "domain name". The name
returned by getServerName() is the name which was looked up via DNS
(which is the "domain name service") by the client.

If you want only the domain part of it, the following code will work:

int index = serverName.indexOf('.');
if (index == -1) domainName = null;
else domainName = serverName.substring(index + 1);

Is that what you want? Or something else?

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      05-18-2004
Ed wrote:
> I need the domain name when I login into my jsp application. I need the
> domain name of my local network but I don't want to hard code it.


Oh, you want the name of the client. In that case, try
request.getRemoteHost() instead.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
Ed
Guest
Posts: n/a
 
      05-18-2004
What I'm looking for is the actually name of the domain where a user logs
onto their network. For example when you log onto your machine at work if
it is on a windows environment you have a User Name:, Password: and Log on
to: fields to input. I want to know what is the value that a user inputs
for the Log on to: field, which should be the domain of the network. I need
this value for a authentication process.


"Chris Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)4.net...
> Ed wrote:
> > That only gives me the name of the web server. I need the domain...
> >

>
> Then you'll need to clarify what you mean by "domain name". The name
> returned by getServerName() is the name which was looked up via DNS
> (which is the "domain name service") by the client.
>
> If you want only the domain part of it, the following code will work:
>
> int index = serverName.indexOf('.');
> if (index == -1) domainName = null;
> else domainName = serverName.substring(index + 1);
>
> Is that what you want? Or something else?
>
> --
> www.designacourse.com
> The Easiest Way to Train Anyone... Anywhere.
>
> Chris Smith - Lead Software Developer/Technical Trainer
> MindIQ Corporation



 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      05-18-2004
Ed wrote:
> What I'm looking for is the actually name of the domain where a user logs
> onto their network. For example when you log onto your machine at work if
> it is on a windows environment you have a User Name:, Password: and Log on
> to: fields to input. I want to know what is the value that a user inputs
> for the Log on to: field, which should be the domain of the network. I need
> this value for a authentication process.


Oh, that's completely different then. You want to know the Windows NT
network domain. Unfortunately, I don't know how you can find this out.
You're more likely to have luck hiding your servlets behind IIS, which
is designed more for these kinds of Microsoft-specific networks than the
core servlet API.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get domain name from domain camper with fake whois? Nik Coughlin NZ Computing 4 12-08-2008 08:42 PM
Making a server on one domain the domain controller of a new domain Limited Wisdom MCSA 7 09-13-2006 02:18 AM



Advertisments