Fórumok

Getting HTTP Headers in Liferay

Susan Young, módosítva 11 év-val korábban

Getting HTTP Headers in Liferay

New Member Bejegyzések: 17 Csatlakozás dátuma: 2012.01.25. Legújabb bejegyzések
Hi Everyone,

I'm trying to troubleshoot a SSO issue and I want to confirm that a certain HTTP header is being received at the Liferay server to trigger auto login for a SiteMinder user.

I'd like to print the HTTP headers to the screen to confirm that SM_user is being sent as an HTTP_header.

I've tried embedding the following Javascript code in a portlet or adding it a page using the Javascript dialog in the portal "Manage Pages" interface (I am using Liferay 5.2.3). Here is the code:


var req = new XMLHttpRequest();
req.open('GET', document.location, false);
req.send(null);
var headers = req.getAllResponseHeaders().toLowerCase();
alert(headers);


In either case (embedding the code in the portlet in or using the pages interface), the code displays only a portion of the HTTP headers (as far as I can tell). This is the result:

server: apache-coyote/1.1
liferay-portal: liferay portal standard edition 5.2.3 (augustine / build 5203 / may 20, 2009)
content-encoding: gzip
content-type: text/html;charset=utf-8
content-length: 5493
date: thu, 12 jul 2012 18:16:23 gmt

Is there a way to return the entire list of HTTP response headers? I'm wondering if somehow the response is getting "scoped"?

Many thanks,

Susan
thumbnail
Jay Patel, módosítva 11 év-val korábban

RE: Getting HTTP Headers in Liferay

Regular Member Bejegyzések: 118 Csatlakozás dátuma: 2010.02.24. Legújabb bejegyzések
Hi Susan,

I am not able to get what exactly you want to achieve, but if you want to get all the headers, you can simply intercept request using hook & print all the HTTP headers.

-Jay.
thumbnail
Mika Koivisto, módosítva 11 év-val korábban

RE: Getting HTTP Headers in Liferay (Válasz)

Liferay Legend Bejegyzések: 1519 Csatlakozás dátuma: 2006.08.07. Legújabb bejegyzések
Siteminder agent will only send a request header to the server and it won't appear on the server response headers. You need to inspect the request headers on server-side and not on client-side. If I remember correctly tomcat has a request dumper valve to dump request information.
thumbnail
Subhasis Roy, módosítva 10 év-val korábban

RE: Getting HTTP Headers in Liferay

Expert Bejegyzések: 275 Csatlakozás dátuma: 2012.01.20. Legújabb bejegyzések
Mika Koivisto:
Siteminder agent will only send a request header to the server and it won't appear on the server response headers. You need to inspect the request headers on server-side and not on client-side. If I remember correctly tomcat has a request dumper valve to dump request information.


Hi Mika,

I am currently facing the same issue. Please find my query in the link below

Liferay Forum Post

Inside a liferay portlet, I want to fetch the header values which has been set by OpenAM Policy Agent. Is it possible to fetch all the header values inside liferay portlet and is possible can you please provide some pointer to get the HEADER values.

thanks,
subhasis