Hi, On 15 Apr 2015 at 10:56:09, TOTOUM NEMKAM, Eva ([email protected](mailto:[email protected])) 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.