On Tue, Jul 14, 2009 at 9:54 AM, Georg Füchsle<[email protected]> wrote: > Hallo Mamallan! > > Thank You! > > I tried your proposal. > In my example the RequestHeaderMap contains the following keys: > > 1.: User-Agent > 2.: Host > 3.: Connection > 4.: Accept-Encoding > 5.: Cookie > 6.: Accept > 7.: Accept-Language > > The key "referer" doesnot exist. Is it possible that this key does > not exist, beacuse my caller-page is just a static html-page in my > file system?
possible > > At the moment I cannot test to call my application from a remote host. > Do You think, when calling from a remote host, I will get the > 'referer'-information? yes. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html (google has some more links/resources as well) -Matthias > > Regards, > > Georg > > > 2009/7/13 Mamallan Uthaman <[email protected]>: >> Hi Georg, >> >> You can get that info from the request-header 'Referer'. You can access it >> from the external context like below >> >> ExternalContext extCtx = >> FacesContext.getCurrentInstance().getExternalContext(); >> String refererHeader = extCtx.getRequestHeaderMap().get("Referer"); >> >> Thanks >> Mamallan >> >> Georg Füchsle wrote: >>> >>> Hallo Rene! >>> >>> Thanks for your fast answer. >>> >>> This does not seem to fit to my problem: >>> >>> I tried to start my app from a static html-file. in this static >>> html-file I put a static link to my application like: >>> >>> <a href="http://localhost/myapp/start.jsf">start</a> >>> >>> Then I examine the external context in a PhaseListener before the >>> RestoreView-Phase: >>> >>> public void beforePhase(PhaseEvent event) >>> { >>> >>> if(event.getPhaseId() == PhaseId.RESTORE_VIEW) >>> { >>> ExternalContext extCtx = >>> event.getFacesContext().getExternalContext(); >>> String callerUrl = extCtx.getRequestPathInfo(); >>> //== null >>> callerUrl = extCtx.getRequestServletPath(); // >>> ==url of the >>> actually called ressource ( inside my application) >>> callerUrl = extCtx.getRequestContextPath(); // == >>> context Root of >>> my application >>> >>> } >>> >>> What I hoped to read is the URL of the static html-pagse from where I >>> clicked the link to my application. >>> >>> Have You an idea how to get this information? >>> >>> >>> >>> Thanks Georg >>> >>> >>> 2009/7/13 Rene van Wijk <[email protected]>: >>> >>>> >>>> All the request information is contained in the ExternalContext which >>>> can >>>> be accessed as: FacesContext.getCurrentInstance().getExternalContext(); >>>> >>>> >>>> >>>> It contains methods such as getRequestContextPath. >>>> >>>> -----Original message----- >>>> From: Georg Füchsle <[email protected]> >>>> Sent: Mon 13-07-2009 11:36 >>>> To: MyFaces Discussion <[email protected]>; >>>> Subject: getting information about caller-url >>>> >>>> hallo, >>>> >>>> when starting my application I have to distinguish between the >>>> different sites from where the user can call the application. >>>> >>>> Theese urls are outside application. >>>> >>>> Can somebody give me a hint how i can read the url from where the >>>> user is calling? >>>> >>>> Thanks Georg >>>> >>>> >>>> >> > -- Matthias Wessendorf blog: http://matthiaswessendorf.wordpress.com/ sessions: http://www.slideshare.net/mwessendorf twitter: http://twitter.com/mwessendorf

