0

I created web-service,where i am getting url params , which i am setting it to Object. after it when i want to set to facesContext it is giving me NULL.I got Suggestion to implement AbstractFacesServlet.java class in project but any idea how can ? And this is what code i am using _

public class ReserRes extends ServerResource {

@Post("xml")
public void $post() throws Throwable {

...........
 .....
     FacesHelper.setValueBindingObject("SelectedOtaReservationBean",
             reservationBean);
    ......
    }    

And setValueBindingObject(,,) is

public static final void setValueBindingObject(String expression,
        final Object value) {

    FacesContext facesContext = FacesContext.getCurrentInstance();

    if (facesContext == null)    // Always throwing NULL
        throw new NullPointerException(
                "Could not get a reference to the current Faces context");

    Application application = facesContext.getApplication();
    ValueBinding vb = application.createValueBinding(expression);
    vb.setValue(facesContext, value);

}

In this i am not interacting with any .jsp or any kind of UI. i am getting params and binding with object. Is this wrong or any way to implement FacesContext for ws.?

I got one suggestion http://cwiki.apache.org/MYFACES/access-facescontext-from-servlet.html to use this class. any buddy know how can i implement or set object to FacesContext using this?

Thanx

V.Rohan
  • 945
  • 2
  • 14
  • 27
  • 1
    I don't get it. FacesContext is initialized as part of the JSF lifecycle, after a request is routed through the faces servlet. That is apparently not the case here, so why do you think you can use FacesContext? – Gimby Dec 21 '12 at 13:43
  • actually i am using rest web-service, and getting url format params. i am not interfering with jsf pages. But want to use FacesContext prallaly to JSF to connect with there backend code and methods. – V.Rohan Dec 22 '12 at 05:24

0 Answers0