Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing authenticated web page using servlets

 
ashok ganesan
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone ,
i m doig a project in servlets to get the username n passowrd from the
user and then displaying their mail inbox ..... for example. if we want to
display the search results of the word " mail " in google we can do it
by the method
"res.sendRedirect(http://www.google.com/search?nhl=en&lr=&q=mail); "
but how can we use this sendredirect method to access the mail like
providing user name and password and then displaying their inbox to
users.


please someone try to give me some solution,


thanks in advance


ashok
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. Accessing a mail account is completely different than accessing a web page (for starters, it's done using the POP or IMAP protocols, not HTTP). You need to use the JavaMail API to retrieve the mailbox contents, and then convert that to a web view. But there are a number of Java web apps out there that do exactly this and are open source, so there's not much point in reinventing the wheel (unless the point is to learn web app development and JavaMail).
[ January 02, 2007: Message edited by: Ulf Dittmer ]
 
ashok ganesan
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi thanks a lot. . . . ok how about any other web page or site that requires authentication that is we need to provide the user name and passowrd to access the site .. in those case how we should do it?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by "how we should do it". If a web site requires authentication, then you'll have to enter username and password when it asks for it. Or or are you trying to access a password-protected web app programmatically? Then you'd set the authentication header as described here.
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to do that in exact way as you provided. For example, if you need to loging in google mail use:
res:redirect(http://mail.google.com?continue=http://mail.google.com/mail?ui=html&zy=l&service=mail&rm=false<mpl=cm_wsad&Passwd=1234561&Email=ashok@gmail.com)

Unfortunately, you need to do a bit reverse engineering to discover login string of a particular e-mail progam, unless it uses container managed authentication.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic