01: package com.sun.portal.proxylet.util;
02:
03: import javax.servlet.http.HttpServletRequest;
04:
05: /**
06: * Created by IntelliJ IDEA.
07: * User: venugopala Rao Moram
08: * Date: Mar 30, 2004
09: * Time: 5:33:02 PM
10: * To change this template use File | Settings | File Templates.
11: */
12: public class ProxyletUtil implements ProxyletConstants {
13:
14: /*
15: * Returns the Proxylet User Attributes.
16: */
17: public static UserAttributes getUserAttributes(
18: HttpServletRequest req) {
19: return new UserAttributes((new SSOUtil(req)).getSSOToken(),
20: PROXYLET_SERVICE_NAME, PROXYLET_POLICY);
21: }
22:
23: /**
24: * This method returns the gateway host name
25: * @param req
26: * @return
27: */
28: public static String getGWHostName(HttpServletRequest req) {
29: String url = req.getHeader(GW_URL_HEADER);
30: String host = null;
31: if (null != url) {
32: int slashIndex = url.indexOf('/');
33: int dotIndex = url.indexOf('.');
34: host = url.substring(slashIndex + 2, dotIndex);
35: }
36: return host;
37: }
38:
39: }
|