Your answer is specific to the class likely implementing a ServletContextProvider
interface. In order to answer this properly, you need to provide the package where ServletContextProvider
is declared, or even more helpful, the class or interface which contains the getServletContextProvider()
and getServletContext()
methods (declared or abstract).
Even easier for us, provide a link to the tutorial you reference, or some additional context (no pun intended). The only references to a getServletContextLocal
method on the internet (after a Google search) are either this question, or copies of this question.
Assuming getServletContextProvider()
returns a ServletContextProvider
class or interface, there are several interfaces and classes available with that name; I'll go through each one I found:
- Interface org.apache.portals.bridges.common.ServletContextProvider does not have a
getServletContextLocal()
method.
- Interface com.liferay.portal.kernal.servlet.ServletContextProvider doesn't have a
getServletContextLocal()
method; Implementer of said interface, LiferayServletContextProvider
doesn't have the getServletContextLocal()
method, and extends Object.
- Class ca.grimoire.maven.ServletContextProvider doesn't have a
getServletContextLocal()
method, nor does the ResourceProvider
interface it implements, and it extends Object.
- Interface org.atmosphere.di.ServletContextProvider does not have a
getServletContextLocal()
method, nor do the 4 implementing classes listed on that link.
- Class com.atlassian.jira.web.ServletContextProvider not have a
getServletContextLocal()
method, and extends Object.
- Abstract Class org.kaleidofoundry.core.web.ServletContextProvider does not have a
getServletContextLocal()
method.
Conclusion: What you've typed is likely a typo in the tutorial you read, probably referencing the most common interface available, org.apache.portals.bridges.common.ServletContextProvider
, which has a getServletContext(GenericPortlet portlet)
method. What the tutorial likely intended to write is getServletContextProvider().getServletContext(local)
where the local
variable is a class extending javax.portlet.GenericPortlet
. The getServletContext(local)
method would then return the javax.servlet.ServletContext
which was associated with said variable. Whether it is the same javax.servlet.ServletContext
as returned by getServletContext()
depends on where the GenericPortlet
variable was assigned.
Do yourself a favor and cite the location of the tutorial to which you're referring.