cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Portal Request object in Repository Service?

Former Member
0 Kudos
67

Hi All,

My requirement is to execute javascript using KM Repository service.

For this, I am planning to get the HttpServletResponse object from IPortalComponentRequest object.

Can anyone tell me how to get IPortalComponentRequest object in KM Repository Service? Is there any API available for this?

Thanks in advance,

Pavithra

View Entire Topic
0 Kudos

Hi,

If you are in Repository Service, you always have a IResource object, so you can do something like this:

HttpServletRequest request = (HttpServletRequest) resource.getContext().getObjectValue("http://sapportals.com/xmlns/cm/httpservletrequest");

Regards,

Praveen Gudapati

Former Member
0 Kudos

Hi Praveen,

Thank you for the reply. I have implemented it the same way for HttpServletResponse as follows:

HttpServletResponse response = (HttpServletResponse) resource.getContext().getObjectValue("http://sapportals.com/xmlns/cm/httpservletresponse");

But I am getting the value for response as null.

What could be the reason?

Thanks and Regards,

Pavithra

0 Kudos

Hi,

There is no response object available at this point, as the rendering of the Flex UI is not present in Repository Service.

So no way to get it from here.

It is not clear what you are trying to with javascripts and response object. If you explain me your usecase clearly, I can help you further.

Regards,

Praveen Gudapati

Former Member
0 Kudos

Hi Praveen,

Here's my requirement:

I need to execute javascript in a repository service. What I have done is that I have included javascript code as part of a JSP file.

Now I need to pass some input parameters to this JSP through a repository service. The tricky part here is I do not know how to access JSP page in a repository service. Hence I thought of using HttpServletResponse response.sendRedirect(<jsp>).

Can you think of any other alternative of executing javascript in a repository service?

Thanks,

Pavithra

0 Kudos

Hi,

There is some misunderstanding in the concepts here:

1. Javascript is something that runs on browsers. So not on server!!!

2. Repository Service runs on server and has nothing to do with UI Technologies like JSP's

So dont mixup concepts here!!

Tell me your usecase and not how it should be implemented, so that I can help you.

Regards,

Praveen Gudapati

Former Member
0 Kudos

Hi Praveen,

Whenever a document is opened/downloaded, I need to send the document name along with the user who has accessed the document. This data needs to be sent to Webtrends server. The only way how we can pass data to Webtrends server is through javascript.

Hence the problem.

Thanks,

Pavithra

0 Kudos

Hi,

There is already a similar post here:

https://forums.sdn.sap.com/thread.jspa?threadID=846065

Follow my suggestions there, the key point here is to check what is done in that javascript and if any submit or url calls are done in this javascript and if so do the same using HTTPClient api's.

You can also check with WebTrend guys, if there is API, which you can directly call from server side. I think webtrends is developed in .NET, so there should be some webservice which may be can solve your problem.

Regards,

Praveen Gudapati

Former Member
0 Kudos

Hi Praveen/all,

I need to get the server name in the repository service. For this, I need handle to the HttpServletRequest object.

As mentioned by Praveen, I am trying to retrieve the same using the following code:

HttpServletRequest request =(HttpServletRequest)resource.getContext().getObjectValue("http://sapportals.com/xmlns/cm/httpservletrequest");

But I am getting the request object as null. Any idea why?

Thanks,

Pavithra