Showing results for 
Search instead for 
Did you mean: 

Removing generated code from JSP pages

Former Member
0 Kudos


i'm trying to display a PDF file in the browser but i cannot change the Content-type display. I know it works in Tomcat but in the Portal there's a lot of generated code that restrict me from diplaying a PDF to the client.

How can i remove the Portal generated code??



Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Cutting in example from thread, but I think you need to set the content type on the response (but you should see the general picture)

import com.sapportals.portal.prt.component.AbstractPortalComponent;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.component.IPortalComponentResponse;

import com.sapportals.portal.prt.pom.IEvent;

public class XMLComponent extends AbstractPortalComponent


protected void doOnNodeReady(IPortalComponentRequest arg0, IEvent arg1) {

try {

Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();

// modify the empty document here, something like this:

Element root = doc.createElement("myRoot");


HttpServletResponse response = arg0.getServletResponse(true);

DOMSource domSource = new DOMSource(doc);

StreamResult result = new StreamResult(response.getOutputStream());

Transformer copyTransformer = TransformerFactory.newInstance().newTransformer();


} catch (Exception e) {

arg0.getLogger().severe(e,"while putting out my xml");



public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)


// will never be invoked, since 'getServletResponse(true)' (see above)