Skip to Content
author's profile photo Former Member
Former Member

HTMLstream to Client, Basic Authentication - EP5.0


since a few weeks Internetexplorer dosent support Basic Authentication Login with URL. For this reason i try to write a small login iView. But now i have a problem with frame pages:

I open a URL connection with Base64 coded name and password. Then i open an Inputstream from the Connection.

This works fine without EP 5.0.

But how i can write the Inputstream to an iView?

I tried this SAP Portal methods:

- response.write - doesnt work because the Portals sends his own code in front of the Strings. So there are two Header Tags (for example).

- NonIsolatedHtmlContainer - can recieve an Inputstream but doenst like Frames

- IsolatedHtmlContainer - can't recieve Inputstreams, but can work with Frames.

Does anybody have an idea what a good way is to bring the Content to the client?

I think about this: Is there a way to give the URLConnection Object (after i opened the connection) to the response Object?

The Page i want to Display in the iView is an Outlook Web Access Page (Frames and Javascript).

It is not much Code, so i postet it here:

import com.sapportals.htmlb.*;
import com.sapportals.htmlb.enum.*;
import com.sapportals.htmlb.event.*;
import com.sapportals.portal.prt.component.*;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentSession;
import com.sapportals.portal.prt.component.IPortalComponentContext;
import com.sapportals.portal.prt.component.IPortalComponentProfile;
import com.sapportals.htmlb.htmlcontainer.*;
public class Authenticator extends PageProcessorComponent
	public DynPage getPage()
		return new AuthenticatorDynPage();
	public static class AuthenticatorDynPage extends JSPDynPage
		public void doInitialization()
			URL url = null;
			InputStream in = null;
				url = new URL("the_url_i_would_log_in");
				in =
			catch (Exception e)

			IPortalComponentRequest request =
				(IPortalComponentRequest) this.getRequest();
			IPortalComponentContext myContext = request.getComponentContext();
			IPortalComponentProfile myProfile = myContext.getProfile();			
			BA_Bohne bean = new BA_Bohne();
			setBeanFromProfile(myProfile, bean);


			myProfile.putValue("BA_Bohne", bean);					
		public void doProcessAfterInput() throws PageException
		public void doProcessBeforeOutput() throws PageException
		private void setBeanFromProfile(
			IPortalComponentProfile myProfile,
			BA_Bohne myBean)

And the other Class:

 * @author Patrick Höfer
 * Hier Kommentar einfügen
public class URL_Connector
	public static InputStream openAuthorizedStream(
		URL url,
		String name,
		String passwd)
		throws IOException
		URLConnection conn = url.openConnection();
			userNamePasswordBase64(name, passwd));
		return conn.getInputStream();
	private static String userNamePasswordBase64(
		String username,
		String password)
		String s = username + ":" + password;
		String encs = new sun.misc.BASE64Encoder().encode(s.getBytes());
		return "Basic " + encs;

Best Regards,


Add the new Code Tags - Paddy

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 22, 2004 at 11:24 AM

    See thread Removing generated code from JSP pages


    Basically, You need to make you class extend from AbstractPortalComponent (instead of dynpage or similar) and overwrite the onNodeReady method.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Dagfinn,

      thanks for the hint. Now i can send content to the client without the EP overload. It works fine.

      For those of you who want to try my code:

      I make a mistake in planing, this dosnt works! I only can Access the first URL and send it to the client. In this URL are links to other ressources. the client trys to access these Links and must authenticate (because the Portal J2EE engine, where my code runs, has access to the OWA and not the client).

      I dont know how i can make the authentication for the client in the J2EE Server (without writing an proxy class and url-rewriting in the HTML-Stream - but this is to much work). Has anybody an Idea?

      Best regards,


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.