Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

If you've ever developed any custom portal components you might have wondered where all that extra HTML/CSS/JavaScript comes from that surrounds what you generate in our own code. Over the years I have often wondered if there was a way to tell the Portal Runtime to just give me back what I added to the HTTP response body and not all that extra stuff :grin: .

Recently I came across a way to do this, sort of by accident whilst looking into how some of the new Portal on Device features worked and speaking with dong.pan from SAP. I looked around but didn't find much in the way of documentation on this, so I wanted to at least start off by sharing what I could.

What I'd like to do in this blog is show you what I mean in more detail and also explain why this is a useful feature and one that is used in Portal on Device. So by way of example I have written a very simple "Hello World" portal component that just writes out that age old text to the response body. I want to compare the markup that is returned when I call this component in the "normal" way vs. what is generated when called with the prtrw URL.

Here is the simple code:

Well I won't be winning any awards for that :lol: ... but bear with me here. I deployed this to my 7.3 Portal and created an iView in the PCD. When you run this component by calling the following URL:

http://<server>:<port>/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fplaut!2fscnHelloWorld

you get this back:

and here is the source you can see in the browser if you view the source (quite a lot more stuff then I added):

Now for the interesting bit... if I call the same component but replace the /irj/servlet/prt/portal/prtroot/ in the URL... with /irj/servlet/prt/prtrw/prtroot... the output is significantly different:

http://<server>:<port>/irj/servlet/prt/prtrw/prtroot/pcd!3aportal_content!2fplaut!2fscnHelloWorld

And this time you get this when you view the source:

So when you use the prtrw in the URL instead of portal, this apparently tells the Portal Runitme to bypass all the so called document hooks and avoids all the extra HTML, CSS and JavaScript that gets added by default.

So now you might be asking...So why is this useful???... well one reason is that if you wanted to write a Portal Component that produced a JSON or XML or oData response you don't want all that other markup getting in the way. This was the use case I saw in the Portal on Device example - Portal Components were used to generate JSON responses and were being called from the client using JQuery AJAX calls.

Anyway I hope you find this interesting. Perhaps you have come across this little trick before? I noticed in my research that Visual Composer seems to use it too, but mostly it seems to be a well kept secret :shock: . Thanks for taking the time to read this post. Let me know what you think below.

12 Comments
Labels in this area