Foros de discusión
Use property in OSGI component declaration
Sabrina Toulouse, modificado hace 6 años.
Use property in OSGI component declaration
New Member Mensajes: 21 Fecha de incorporación: 9/06/15 Mensajes recientes
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 hace 6 años.
RE: Use property in OSGI component declaration
Expert Mensajes: 358 Fecha de incorporación: 17/11/10 Mensajes recientes
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 hace 6 años.
RE: Use property in OSGI component declaration
Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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.