Skip to Content

Retrieve HTTP status code of response while processing portal component

Jul 03, 2017 at 02:31 PM


avatar image


I need to retrieve the HTTP status code of a response in an AbstractPortalComponent.

So far I have identified, that the doContent() method offers with the response parameter object (IPortalComponentResponse) a method named response.getStatus(). However this always returns the value 0.


public void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {
    int statusCode = response.getStatus(); //Always returns 0

I would have expected for example something like 200 (for status OK) or 302 (for status moved permanently).

So far I haven’t found any way to retrieve this HTTP status code. Does anyone have a clue or idea?

Best regards


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Kamal j Jul 12, 2017 at 05:59 PM

Dear Mario Liggiu,

add servlet.jar file which you can find in library files of nwds7.3 to buildpath of abstract portal component project.

add the following code in the docontent method of abstract portal component.


Thanks and Regards,


10 |10000 characters needed characters left characters exceeded
Mario Liggiu Jul 25, 2017 at 10:19 AM

Hello Kamal,

thanks for your feedback.

I have checked your suggestion. The method getServletResponse() returns a object of type HttpServletResponse. However this object does not have any method getStatus().

As of servlet version 2.5, the method getStatus() ist not available with HttpServletResponse. For details see:

We use at the moment SAP NetWeaver release 7.4, which seems to use servlet version 2.5.

However, as of servlet version 3.0, the method is available:

Probably future release of SAP NetWeaver will implement this version.

Best regards


10 |10000 characters needed characters left characters exceeded