cancel
Showing results for 
Search instead for 
Did you mean: 
SAP Community Downtime Scheduled for This Weekend

BSP Url encoding

Former Member
0 Kudos
628

Hi all!

I'd like to use URL encoding (I guess base64) to mask url parameters in our URL (instead of default.htm?param1=value&param2=value etc.) to prevent URL manipulation. In most parts of our application we use PopUp-Windows without the location bar of the browser, but we have email links to workitems which launch BSPs and these new opened browser windows do have a location bar and a URL which can be manipulated.

How do you set up URL encoding in your BSP application? (entries in the BSP service of /sicf for example or BSP Application Attributes ?). Is there a way to encode the only parts of the application? How to use and when the if_http_utility->en/decode_base64 methods?

best regards,

Christoph

Accepted Solutions (1)

Accepted Solutions (1)

Private_Member_9643
Active Contributor
0 Kudos

hi christoph,

u have to create ur own HTTP Request Handler Class, in which u have to use IF_HTTP_ENTITY interface and use it in the way u want, for the list of parameters please check the SAP Help on ICF seting( creating Request Handler Class).

You can assign this Handler Request Class to the namespace where ur creating ur application, like the default namespace is /bsp/sap/bc/bsp .

Steps to assign Handler

1) Start the SICF transaction.

2) Open the namespace

3) Right click on the last service which u opened, in case of default namespace it is bsp.

4) Now select the display service option.

5) Now select the Handler List option and assign the class which u created in the list.

u can also check this weblog for creating Handler Request Class:

/people/brian.mckellar/blog/2003/09/30/bsp-in-depth-writing-an-http-handler

Regards,

kamaljeet

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you very much,

I'll give it try on time!

Former Member
0 Kudos

hi christoph,

u can encode ur url string and then decode it by using escape characters.

Check out the following link for more explanation .

http://scriptasylum.com/tutorials/encdec/encode-decode.html

Hope it will help u.

Regards,

Ankur

athavanraja
Active Contributor
0 Kudos

did you try the following?

ex. you have page a.htm and from there you are calling page b.htm with params param1 and param2.

use

CALL METHOD cl_http_utility=>if_http_utility~encode_base64

EXPORTING

unencoded = param1value

receiving

encoded = param1value .

and pass this as the value for param1 and call the URL for page b.htm.

and within page b.htm decode it and use .

CALL METHOD cl_http_utility=>IF_HTTP_UTILITY~DECODE_BASE64 EXPORTING

encoded = param1value

receiving

decoded = param1value .

<b>Sample application:</b>

Create a BSP application withe two pages a.htm and b.htm

and have a page attribute called name in both the pages.

<u><b>a.htm layout code</b></u>

<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = " ">
    <htmlb:form>

<%
if name is initial .
name = sy-uname .
endif .

%>
      <htmlb:textView     text          = "<%= name %>"
                          design        = "EMPHASIZED" />
<%

 CALL METHOD cl_http_utility=>if_http_utility~encode_base64
                 EXPORTING
                   unencoded =  name
                 receiving
                   encoded   = name .

%>
      <htmlb:button       text          = "Press Me"
                          onClientClick       = "javascript:window.open('b.htm?name=<%= name %>');" />

    </htmlb:form>
  </htmlb:page>
</htmlb:content>

<u><b>b.htm layout code</b></u>

<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = " ">
    <htmlb:form>
<%
 CALL METHOD cl_http_utility=>if_http_utility~DECODE_BASE64
                 EXPORTING
                   encoded =  name
                 receiving
                   decoded   = name .

%>

      <htmlb:textView     text          = "<%= name %>"
                          design        = "EMPHASIZED" />


    </htmlb:form>
  </htmlb:page>
</htmlb:content>

Hope this helps.

Regards

Raja