File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes accessing authenticated web page using servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "accessing authenticated web page using servlets" Watch "accessing authenticated web page using servlets" New topic
Author

accessing authenticated web page using servlets

ashok ganesan
Ranch Hand

Joined: Jan 02, 2007
Posts: 50
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
Marshal

Joined: Mar 22, 2005
Posts: 41489
    
  53
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 ]

Ping & DNS - my free Android networking tools app
ashok ganesan
Ranch Hand

Joined: Jan 02, 2007
Posts: 50
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
Marshal

Joined: Mar 22, 2005
Posts: 41489
    
  53
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

Joined: Feb 07, 2004
Posts: 472

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.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: accessing authenticated web page using servlets