[ovirt-devel] How To Auto Set oVirt RESTApi Session?

Vojtech Szocs vszocs at redhat.com
Tue Dec 2 17:04:14 UTC 2014



----- Original Message -----
> From: "Alexander Wels" <awels at redhat.com>
> To: "王成俊" <wcj2007 at gmail.com>
> Cc: devel at ovirt.org
> Sent: Tuesday, December 2, 2014 1:59:21 PM
> Subject: Re: [ovirt-devel] How To Auto Set oVirt RESTApi Session?
> 
> On Tuesday, December 02, 2014 09:45:49 AM 王成俊 wrote:
> > Hi,awels:
> > 
> >      Thanks for your reply!
> > 
> >      I make this servlet to run the backend action which
> > names "LoginAdminUser", because I want to check admin log in with it,so
> > that my engine no need to log in through engine's loginpopupview.

Hm, so you're trying to automate WebAdmin GUI login? Can you please
explain your use case without any technical (servlet etc.) details?

> > 
> >      But when I log in through my servlet,the restapi can not get the
> > user's certificate.
> > 
> >      Can you tell me how to set and resume the restapi session in my case?
> > 
> >      Thanks!
> > 
> > Best Regards!
> > 
> 
> You can login to the REST api using standard http connection techniques. For
> instance basic auth you can login doing the following:
> 
> http://<user>%40<domain>:<password>@<engine_host>/ovirt-engine/api
> 
> Will list the available REST api.
> 
> But I am still not clear on what you are trying to do. Are you trying to
> write
> your own external servlet, that calls the REST api to do things for you? Or
> are you trying to write a servlet that lives inside the context of the engine
> and implements a new action?
> 
> Also please reply all, so we can keep the discussion on the mailing list so
> other people can find it in the future.
> 
> Alexander
> 
> 
> > 2014-12-02 5:42 GMT+08:00 Alexander Wels <awels at redhat.com>:
> > > On Monday, December 01, 2014 04:56:04 PM 王成俊 wrote:
> > > > Dear Sir:
> > > > 
> > > >          I am a new one in studing ovirt engine.Now,I have a Servlet in
> > > > 
> > > > org.ovirt.engine.ui.frontend.server.gwt package.
> > > > 
> > > >          I want to call
> > > > 
> > > > *Frontend.getInstance().getLoginHandler().**onLoginSuccess(userName,
> > > > password, domain)* to set session for restapi in this servlet.
> > > > 
> > > >          But when I visit this servlet,it occur to show me an error
> > > >          which
> > > > 
> > > > just like "*JBWEB000071: root cause java.lang.ClassNotFoundException:
> > > > org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback from [Module
> > > > &quot;deployment.engine.ear.webadmin.war:main&quot; from Service Module
> > > > Loader]*". I found that this error is occured by calling*
> > > > Frontend.getInstance()*.
> > > > 
> > > >          Can you tell me how to resolve this problem or a new way to
> > > >          set
> > > > 
> > > > and resume restapi session in a servlet package of
> > > > org.ovirt.engine.ui.front.server.gwt like the RestApiSessionManager in
> > > > org.ovirt.engine.ui.webadmin.plugin.restapi package?
> > > > 
> > > >            thanks!
> > > > 
> > > > Best Regards!
> > > 
> > > Hi,
> > > 
> > > The problem you are experiencing is the fact the Frontend.getInstance()
> > > is
> > > a
> > > frontend (client, which get compiled to javascript) class, and the
> > > servlet
> > > is
> > > on the server side where this class is not defined (as it is frontend
> > > only).
> > > Maybe if you could explain what you are trying to do we could assist
> > > better.
> > > 
> > > We have a mechanism of getting the REST api session on the front end when
> > > you
> > > log in. On the backend you don't really need that, since you are on the
> > > backend. So your question sort of confuses me at this point.
> > > 
> > > Alexander
> 
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel



More information about the Devel mailing list