Re: [xwiki-users] Xwiki container : i don't understand
Thank you -- View this message in context: http://xwiki.475771.n2.nabble.com/Xwiki-container-i-don-t-understand-tp7594649p7594652.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] Xwiki container : i don't understand
Hi, On 15 Apr 2015 at 10:56:09, TOTOUM NEMKAM, Eva (eva.totoum-nem...@capgemini.com(mailto:eva.totoum-nem...@capgemini.com)) wrote: > Hello, > > I wrote a component in eclipse using maven. > > @Inject > private Container container; > > HttpServletRequest request = (HttpServletRequest) container.getRequest(); It should be: HttpServletRequest request = ((ServletRequest) container.getRequest()).getHttpServletRequest(); Thanks -Vincent > String environement = request.getParameter(PARAM_ENVIRONNEMENT); > > String referer = request.getHeader(REFERER); > ... > > And i tried to access this component in an xwiki page by : > > def jsonObject = services.jenkinsJobsPresenter.presentJobs(); /*this method > returns a jsonNode*/ > > But i have got this error > org.xwiki.container.servlet.ServletRequest cannot be cast to > javax.servlet.ServletRequest > > I want to get the HttpServletRequest , to get the parameters and the headers > > First, i was trying to get the request from the XwikiContext but i noticed > that it was deprecated. > > Sincerely, > > PS : i'm a junior developper and i have just started using xwiki from 2 weeks > for a specific project. > ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] Xwiki container : i don't understand
Hello, I wrote a component in eclipse using maven. @Inject private Container container; HttpServletRequest request = (HttpServletRequest) container.getRequest(); String environement = request.getParameter(PARAM_ENVIRONNEMENT); String referer = request.getHeader(REFERER); ... And i tried to access this component in an xwiki page by : def jsonObject = services.jenkinsJobsPresenter.presentJobs(); /*this method returns a jsonNode*/ But i have got this error org.xwiki.container.servlet.ServletRequest cannot be cast to javax.servlet.ServletRequest I want to get the HttpServletRequest , to get the parameters and the headers First, i was trying to get the request from the XwikiContext but i noticed that it was deprecated. Sincerely, PS : i'm a junior developper and i have just started using xwiki from 2 weeks for a specific project. This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users