Fórum
Use property in OSGI component declaration
Sabrina Toulouse, modificado 6 Anos atrás.
Use property in OSGI component declaration
New Member Postagens: 21 Data de Entrada: 09/06/15 Postagens Recentes
In my module, in OSGI component declarationIi need to use a property which will be in my portal-ext.properties, like that :
@Component(
immediate = true,
property = {
"dispatcher=FORWARD",
"dispatcher=REQUEST",
"servlet-context-name=",
"servlet-filter-name=Detail UC Filter",
"url-pattern=/web/guest/" + PropsUtil.get("myPath") + "/*"
}
But i get the compilation error : " The value for annotation attribute Component.property must be a constant expression". How can i do to use a property here?
@Component(
immediate = true,
property = {
"dispatcher=FORWARD",
"dispatcher=REQUEST",
"servlet-context-name=",
"servlet-filter-name=Detail UC Filter",
"url-pattern=/web/guest/" + PropsUtil.get("myPath") + "/*"
}
But i get the compilation error : " The value for annotation attribute Component.property must be a constant expression". How can i do to use a property here?
Mayur Patel, modificado 6 Anos atrás.
RE: Use property in OSGI component declaration
Expert Postagens: 358 Data de Entrada: 17/11/10 Postagens Recentes
You can use the constants in the url-pattern as below,
Thanks!
import com.mycompany.mypackage.MyLinks;
@WebServlet(urlPatterns = {MyLinks.GUESTBOOK_URL})
public class GuestbookServlet extends HttpServlet {
//
}
Thanks!
Olaf Kock, modificado 6 Anos atrás.
RE: Use property in OSGI component declaration
Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
Well answered in your crosspost. That being said: Please read and understand this article regarding crossposts. And do not crosspost or at least link them yourselves.