I've figured out how to do this in plain Java:

                userpass = "myusername:mypassword";
                auth = "Basic "
                                + new
sun.misc.BASE64Encoder().encode(userpass.getBytes());
                URL myUrl = new URL(urlstring);
                URLConnection myUrlConnection = myurl.openConnection();

                myUrlConnection.setRequestProperty("Authorization",
auth);

(Yuk! Why doesn't the JDK support the full HTTP protocol, including
putting this authentication in the URL?)

So how do I create my own portlet (a subclass of WebPagePortlet or of
FileWatchPortlet) that sets the Authorization request before the URL is
read from? I'm worried that if I just put it after the URL( url
).openStream() in getURL() of WebPagePortlet that I might be trying to
authenticate against a cached webpage. Any pointers would be
appreciated.

--dave

P.S. Am I the only one trying to open a portlet to a (semi-) secure
site?


> -----Original Message-----
> From: Jakopac, Dave [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 09, 2001 8:31 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Can't seem to use 
> myusername:[EMAIL PROTECTED] in
> a WebPagePortlet url
> 
> 
> 
> I'm using JDK 1.2.2. 
> 
> --dave
> 
> > -----Original Message-----
> > From: Santiago Gala [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, October 08, 2001 2:06 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Can't seem to use 
> > myusername:[EMAIL PROTECTED] in
> > a WebPagePortlet url
> > 
> > 
> > David Jakopac wrote:
> > 
> > >
> > > I've searched both the users and developer jetspeed mailing 
> > lists for 
> > > this. I've also looked at the urlmanager/*.java source. Sorry in 
> > > advance if I missed something.
> > >
> > > I'm using the nightly build of 1.3a2-dev-war from Oct 2. I want a 
> > > WebPagePortlet to access a website using a URL containing a 
> > username 
> > > and password. In other words, I want to use the following 
> > URL in the 
> > > <url>:
> > >
> > > http://myusername:[EMAIL PROTECTED]/mypage.html
> > >
> > > I get a 401 HTTP response from the www.mydomain.com server, 
> > but if I 
> > > copy and paste the same URL in a browser it works fine. 
> > > (www.mydomain.com is served by an Apache server.)
> > >
> > > I've also tried:
> > >
> > > http:[EMAIL PROTECTED]/mypage.html
> > >
> > > with the same results (works from a browser, but not a jetspeed 
> > > WebPagePortlet). Escaping the "@" doesn't work anywhere, 
> of course.
> > >
> > > Any pointers to existing documentation on how to do this would be 
> > > appreciated. Thanks. 
> > 
> > Which jdk are you using? I'm not sure, but it should work.
> > 
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to