Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieve partial domain name  RSS feed

 
R Karthick
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends..
i want to exactly retrieve the domain name like "austin" in http://www2.austin.cc.tx.us

yahoo from www.mail.yahoo.com // It is in 2nd position
austin from www2.austin.cc.tx.us // It is in 1st position
abc from www.xyz.qwerty.abc.efg.co.in // It is in 3rd position

is there any methods available in java?

actually now i am using this code



but it will work to retrieve domain only for 3digit country specific domain(.com,.edu,.org) and 2 + 2 country specific domain(co.in,co.us,co.uk). please help it is the important part in my project.it is not working in this case "www2.austin.cc.tx.us" because it has cc.tx.us as top level domain. please tell me how to solve this.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"one question", please check your private messages for an important administrative matter.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes "austin" special in "www2.austin.cc.tx.us"? It's just one part of a multipart domain name. Why would "abc" be special in "www.xyz.qwerty.abc.efg.co.in"?

If you could tell us the precise definition of what you consider to be a "domain", you could probably code it (or we could help you).
 
R Karthick
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..
We are providing free access to certain web pages to our customers because some sponsers will pay for that. For the convenience of the sponsers,we have to produce per url accounting to them.
for example:

URL Total.no.of.bytes accessed
http://yahoo.com 23456
http://www.google.com 36786

one sponser will pay for yahoo.com and another will pay for google.com

so i'm getting the data from cache(access.log) and i am comparing it with free_webpage_list file. now i have to compare URLs like com[/b]]http://www.yahoo.com from access.log file of cache and co.in]http://www.mail.yahoo.co.in from free_webpage_list file,so i'm trying to compare "yahoo" in both the URLs. After comparing i have to calculate the bytes used for those webpages.




to retrieve yahoo from both the files i'm using this code. but it works only for 3digit country specific domain(.com,.edu,.net and so on) and 2+2 country specific domains(co.in,co.uk,co.us). Not for TLDs like cc.tx.us
any help will be greatly appreciated..

Thanks..
[ February 12, 2008: Message edited by: onequestion ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"onequestion"-

You haven't changed your display name like you were asked to. This is not optional - accounts without a valid display name are generally closed. Please do this before your next post.

As to your question, it sounds like you'd be better off having a one-to-many mapping between a root name (like Yahoo) and actual URLs (like *.yahoo.*). There could be many different URL schemes that are tricky to capture in code in a general way.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!