Hello,

I wrote a component in eclipse using maven.

    @Inject
    private Container container;
   ....
ServletRequest request = (ServletRequest) container.getRequest();
                
                HttpServletRequest req = (HttpServletRequest) request;
        
                String environement = req.getParameter(PARAM_ENVIRONNEMENT);
                
                
                String referer = req.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,

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

Reply via email to