我正在尝试使用 liferay 钩子在 Eclipse 中创建一个自动登录过滤器。
现在我添加了:
<filter>
<filter-name>myautologinfilter</filter-name>
<filter-class>bla.bla.xyz</filter-class>
</filter>
<filter-mapping>
<filter-name>myautologinfilter</filter-name>
<url-pattern>/c/login/myurl</url-pattern>
</filter-mapping>
到 liferay 钩子的 web.xml。
在 liferay-hook.xml 我添加了:<portal-properties>portal.properties</portal-properties>
在那个 hook.xml 中我添加了:auto.login.hooks=bla.bla.xyz
bla.bla.xyz 实现了 AutoLogin,但现在它已经很糟糕了:
@Override
public String[] login(HttpServletRequest request, HttpServletResponse response)
throws AutoLoginException {
Object parameters = request.getAttribute("javax.servlet.forward.query_string");
Map<String, String> x = parserClass.parsing(parameters.toString());
System.out.println("voornaam: " + geparsdeParameters.get("tokenvalue1"));
try {
return null;
} catch (Exception e) {
throw new AutoLoginException(e);
}
}
因为当我添加过滤器时钩子没有启动,所以我删除了它并尝试了:
http://localhost:8080/c/portal/login?tokenvalue1=55
但是当我检查我的tomcat时,我看到:Error XYZ Url: url myUsedUrl exception null
我也尝试添加一些实用程序类,但我得到了classnotfoundexception
s.
当我在钩子中添加额外的类时,我需要做什么具体的事情吗?