Liferay の自動ログインを使用しており、ログインしたページにクエリ文字列パラメーターを渡す必要があります。たとえば、foo の値にアクセスできるようにする必要があります。
http://mysite.com/guest/group?foo=bar
明らかにデフォルトでは、ログインページへのリダイレクト中にクエリ文字列が失われるため、これを行う方法を考えてください:(
ありがとう!
次のコードを使用できます。
Object outcome = null;
Map<String, Object> map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
if (map != null) {
for (String key : map.keySet()) {
if (map.get(key) instanceof HttpServletRequestWrapper) {
HttpServletRequest request = (HttpServletRequest) ((HttpServletRequestWrapper) map.get(key)).getRequest();
outcome = request.getParameter("foo");
break;
}
}
}
私はそれをBeanコンストラクターに持っています。
originalHttpRequest から同じものを取得します。
com.liferay.portal.util.PortalUtil
クラスをご利用ください。その中に2つの方法があります。したがって、最初に を渡して httpRequest を取得し、次に から取得した httpRequest をgetHttpServletRequest()
渡しportletRequest
て元の http リクエストgetOriginalServletRequest()
を取得しgetHttpServletRequest()
ます。
そのリクエストで、パラメータを検索してみてくださいfoo
。