[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2189) ServletContexts.getInstance().getRequest() is null

Menashe (JIRA) jira-events at lists.jboss.org
Wed Oct 31 13:27:44 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-2189?page=comments#action_12385373 ] 
            
Menashe commented on JBSEAM-2189:
---------------------------------

There is not much to add i am using it form an ear on localhost 

here is the snippet

import ...

@Stateful 
@Name("test")
public class TestBean implements Test {

    @Logger private Log log;

    @In(create = true) private ServletContexts servletContexts;

    public String test()
    {	
    	HttpServletRequest httpServletRequest = servletContexts.getRequest();
    	if (httpServletRequest != null)
	{
        	log.info("RemoteHost from ServletContexts: #0", httpServletRequest.getRemoteHost();
	}
	else
	{
        	log.info("Got NULL for httpServletRequest from ServletContexts");
	}
    	ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();  
    	HttpServletRequest httpServletRequest2 = (HttpServletRequest)externalContext.getRequest();  
	//if access with http://localhost/test.seam goesn't give IP but works fine with http://217.0.0.1/test.seam
	log.info("RemoteHost from ExternalContext: #0", httpServletRequest2.getRemoteHost();
     }
}

> ServletContexts.getInstance().getRequest() is null
> --------------------------------------------------
>
>                 Key: JBSEAM-2189
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2189
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0.CR3
>         Environment: jboss 4.2.2
> sun jdk 1.5.0.13/1.6.0.3
> started from jbosstool 2b4
>            Reporter: Menashe
>
> ServletContexts.getInstance().getRequest() is null when i try to access it from a seam bean

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list