protected FacesServletMapping getFacesServletMapping(FacesContext context)
{
Map<Object, Object> attributes = context.getAttributes();
// Has the mapping already been determined during this request?
FacesServletMapping mapping = (FacesServletMapping) attributes.get(CACHED_SERVLET_MAPPING);
if (mapping == null)
{
ExternalContext externalContext = context.getExternalContext();
FacesServletMapping calculatedMapping = calculateFacesServletMapping(
externalContext.getRequestServletPath(),
externalContext.getRequestPathInfo());
if (!calculatedMapping.isPrefixMapping())
{
// Scan the current configuration if there is a FacesServlet and if that so,
// retrieve the first prefix mapping and use it.
getWebConfigProvider().update(context);