Forums de discussion
Init Param in Liferay 7 - filter with annotation
P G, modifié il y a 6 années.
Init Param in Liferay 7 - filter with annotation
New Member Publications: 21 Date d'inscription: 15/02/17 Publications récentes
Good evening,
I'm using Liferay 7 CE GA3 and I have to use an init param during the initialization of my filter. For instance, I define configFile as parameter and I want to use it in the init method:
@Component(
immediate = true,
property = {
"servlet-context-name=",
"servlet-filter-name=ParameterValidationFilter",
"configFile=/META-INF/pvf.xml",
"url-pattern=/*"
},
service = Filter.class
)
public class CustomFilter extends BaseFilter {
private static final Log _log = LogFactoryUtil.getLog(CustomFilter.class);
@Override
public void init(FilterConfig config) throws ServletException {
// TODO Auto-generated method stub
getLog().info("PVF-filter init");
getLog().info("file: " + config.getInitParameter("configFile"));
super.init(config);
}
protected Log getLog() {
return _log;
}
}
I'm in trobule passing the init param. The config.getInitParameter("configFile") returns null. How can I pass initParam using annotations in Liferay 7 CE?
I'm using Liferay 7 CE GA3 and I have to use an init param during the initialization of my filter. For instance, I define configFile as parameter and I want to use it in the init method:
@Component(
immediate = true,
property = {
"servlet-context-name=",
"servlet-filter-name=ParameterValidationFilter",
"configFile=/META-INF/pvf.xml",
"url-pattern=/*"
},
service = Filter.class
)
public class CustomFilter extends BaseFilter {
private static final Log _log = LogFactoryUtil.getLog(CustomFilter.class);
@Override
public void init(FilterConfig config) throws ServletException {
// TODO Auto-generated method stub
getLog().info("PVF-filter init");
getLog().info("file: " + config.getInitParameter("configFile"));
super.init(config);
}
protected Log getLog() {
return _log;
}
}
I'm in trobule passing the init param. The config.getInitParameter("configFile") returns null. How can I pass initParam using annotations in Liferay 7 CE?