I managed to get the component working to get notifications for status,
and stuff..
Thanks for the help and pointers.
But I am still trying to get the http data.
Any help is greatly appreciated.
-lav
lav wrote:
> Steve,
>
> I beleive you had a similar issue adding the WebProgressListener.
>
> I tried both nsIWebProgressListener and nsIWebProgress...but no luck
> yet
>
> if (strcmp(aTopic,"app-startup")==0)
>       {
>               rv = NS_GetServiceManager(getter_AddRefs(servMan));
>               if (NS_FAILED(rv))
>                       return rv;
>               nsCOMPtr<nsIWebProgress> webBrowser;
>               rv
> =servMan->GetServiceByContractID("@mozilla.org/docloaderservice;1",
>                       NS_GET_IID(nsIWebProgress),
>                       getter_AddRefs(webBrowser));
>
>               if (webBrowser)
>             rv =
> webBrowser->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,this),
>          nsIWebProgress::NOTIFY_STATE_DOCUMENT);
> }
>
> Both the techniques fail at AddProgressListener line with ILLEGAL_VALUE
> as the error.
>
> Can you tell me what the problem could be.
> Thanks,
> lav
>
> lav wrote:
> > Thanks for the response Steve.
> >
> > I will look into them. But do you know why this method would not work?
> > as to where I am goign to wrong, in the way I have understood it...
> > Also, can you please tell me if nsIWebProgressListener, would help me
> > view the Get and the Post data from the http request headers?
> >
> > lav
> > steve.lu wrote:
> > > These interfaces, nsIWebProgressListener, nsIUnicharStreamListener,
> > > nsIHttpHeaderVisitor, will give you
> > > everything you need including request header, post data, response
> > > header, and html text.
> > >
> > > Search mozilla source code for above interfaces and you will find many
> > > examples.
> > >
> > > Steve
> > >
> > > lav wrote:
> > > > Hi,
> > > >
> > > > I am trying to build an XPCOM that monitors the http request and
> > > > response headers and data.
> > > > I have a working version of a sample, that implements nsIObserver. I
> > > > would like to be notified on http-on-modify-request topic, to get hold
> > > > of the nsIhttpChannel interface.
> > > >
> > > > My question is, is is okay to do the above in the Observe method
> > > > implementation of my XPCOM. FOr eg in "xpcom-startup" or "app-startup"
> > > > event. Well, i tried adding them, using AddObserver method, but it
> > > > keeps failing.
> > > >
> > > > Dont know where i am goign wrong.
> > > >
> > > > Any help is greatly appreciated.
> > > >
> > > > here is the code snippet
> > > >
> > > > MyComponent::Observe(nsISupports *aSubject, const char *aTopic, const
> > > > PRUnichar *aData)
> > > > {
> > > >         nsresult rv;
> > > >         nsCOMPtr<nsIServiceManager> servMan;
> > > >         if (strcmp(aTopic,"app-startup")==0)
> > > >         {
> > > >         rv = NS_GetServiceManager(getter_AddRefs(servMan));
> > > >         if (NS_FAILED(rv))
> > > >                 return rv;
> > > >                 nsCOMPtr<nsIObserverService> observerService;
> > > >                 
> > > > servMan->GetServiceByContractID("@mozilla.org/observer-service;1",
> > > >                         NS_GET_IID(nsIObserverService),
> > > >                         getter_AddRefs(observerService));
> > > >                 if (!observerService)
> > > >                         return NS_ERROR_FAILURE;
> > > >                 rv = observerService->AddObserver(
> > > >                         this,
> > > >                         "http-on-modify-request", PR_TRUE);
> > > >         }
> > > > return NS_OK;
> > > > }
> > > > Thanks,
> > > > lav
> > > >
> > > > _______________________________________________
> > > > dev-tech-xpcom mailing list
> > > > [email protected]
> > > > https://lists.mozilla.org/listinfo/dev-tech-xpcom
> > > >
> > > >
> > > >

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to