@SuppressWarnings("unchecked")
 public ExternalContextBridgeBase(
     PortletContext portletContext,
     PortletRequest portletRequest,
     PortletResponse portletResponse) {
   this.portletContext = portletContext;
   this.portletRequest = portletRequest;
   this.portletResponse = portletResponse;
   this.bridgeConfig = RequestMapUtil.getBridgeConfig(portletRequest);
   this.incongruityContext =
       (IncongruityContext) portletRequest.getAttribute(IncongruityContext.class.getName());
   this.portletConfig = RequestMapUtil.getPortletConfig(portletRequest);
   this.manageIncongruities =
       PortletConfigParam.ManageIncongruities.getBooleanValue(portletConfig);
   this.bridgeRequestScope =
       (BridgeRequestScope) portletRequest.getAttribute(BridgeRequestScope.class.getName());
   this.bridgeURIFactory =
       (BridgeURIFactory) BridgeFactoryFinder.getFactory(BridgeURIFactory.class);
   this.bridgeURLFactory =
       (BridgeURLFactory) BridgeFactoryFinder.getFactory(BridgeURLFactory.class);
   this.configuredFacesServletMappings =
       (List<ConfiguredServletMapping>)
           bridgeConfig
               .getAttributes()
               .get(BridgeConfigAttributeMap.CONFIGURED_FACES_SERVLET_MAPPINGS);
   this.configuredSuffixes =
       (List<String>)
           bridgeConfig.getAttributes().get(BridgeConfigAttributeMap.CONFIGURED_SUFFIXES);
 }
  /**
   * Returns a new instance of {@link ResponseWriter} from the {@link HeadResponseWriterFactory}
   * found by the {@link BridgeFactoryFinder}. The returned instance is not guaranteed to be {@link
   * java.io.Serializable}.
   */
  public static ResponseWriter getHeadResponseWriterInstance(
      ResponseWriter responseWriter, PortletResponse portletResponse) {

    HeadResponseWriterFactory headResponseWriterFactory =
        (HeadResponseWriterFactory) BridgeFactoryFinder.getFactory(HeadResponseWriterFactory.class);

    return headResponseWriterFactory.getHeadResponseWriter(responseWriter, portletResponse);
  }