/* (non-Javadoc)
@see org.apereo.portal.url.IPortalUrlProvider#getPortalUrlBuilderByPortletWindow(javax.servlet.http.HttpServletRequest, org.apereo.portal.portlet.om.IPortletWindowId, org.apereo.portal.url.UrlType)
971491
@Override
    public IPortalUrlBuilder getPortalUrlBuilderByPortletWindow(
            HttpServletRequest request, IPortletWindowId portletWindowId, UrlType urlType) {
        final IPortletWindow portletWindow =
                this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        return getPortalUrlBuilderByPortletWindow(request, portletWindow, urlType);
    }
1267986
@Override
    public IPortalUrlBuilder getDefaultUrl(HttpServletRequest request) {
        final IUrlNodeSyntaxHelper urlNodeSyntaxHelper =
                this.urlNodeSyntaxHelperRegistry.getCurrentUrlNodeSyntaxHelper(request);
        final String defaultLayoutNodeId = urlNodeSyntaxHelper.getDefaultLayoutNodeId(request);
        return this.getPortalUrlBuilderByLayoutNode(request, defaultLayoutNodeId, UrlType.RENDER);
    }
780541
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.DraftAsyncErrorServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.DraftAsyncErrorServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.DraftAsyncErrorServiceSoapBindingStub(new java.net.URL(DraftAsyncErrorServiceInterfacePort_address), this);
                _stub.setPortName(getDraftAsyncErrorServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
664993
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.CampaignSharedSetServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.CampaignSharedSetServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.CampaignSharedSetServiceSoapBindingStub(new java.net.URL(CampaignSharedSetServiceInterfacePort_address), this);
                _stub.setPortName(getCampaignSharedSetServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
47236
@Override
    public String getPortletHeadOutput(
            IPortletWindowId portletWindowId,
            HttpServletRequest request,
            HttpServletResponse response) {
        if (doesPortletNeedHeaderWorker(portletWindowId, request)) {
            final IPortletRenderExecutionWorker tracker =
                    getRenderedPortletHeaderWorker(portletWindowId, request, response);
            final long timeout = getPortletRenderTimeout(portletWindowId, request);
            try {
                final String output = tracker.getOutput(timeout);
                return output == null ? "" : output;
            } catch (Exception e) {
                logger.error("failed to render header output for " + portletWindowId, e);
                return "";
            }
        }

        logger.debug(portletWindowId + " does not produce output for header");
        return "";
    }
1318430
@RequestMapping(
            headers = {"org.apereo.portal.url.UrlType=ACTION"},
            method = RequestMethod.POST)
    public void actionRequest(HttpServletRequest request, HttpServletResponse response)
            throws IOException {

        final IPortalRequestInfo portalRequestInfo =
                this.urlSyntaxProvider.getPortalRequestInfo(request);
        final IPortletRequestInfo portletRequestInfo =
                portalRequestInfo.getTargetedPortletRequestInfo();

        final IPortalUrlBuilder actionRedirectUrl;
        if (portletRequestInfo != null) {
            final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();
            actionRedirectUrl =
                    this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(
                            request, targetWindowId, UrlType.RENDER);
        } else {
            final String targetedLayoutNodeId = portalRequestInfo.getTargetedLayoutNodeId();

            if (targetedLayoutNodeId != null) {
                actionRedirectUrl =
                        this.portalUrlProvider.getPortalUrlBuilderByLayoutNode(
                                request, targetedLayoutNodeId, UrlType.RENDER);
            } else {
                actionRedirectUrl = this.portalUrlProvider.getDefaultUrl(request);
            }
        }

        // Stuff the action-redirect URL builder into the request so other code can use it during
        // request processing
        this.portalUrlProvider.convertToPortalActionUrlBuilder(request, actionRedirectUrl);

        if (portletRequestInfo != null) {
            final IPortletWindowId targetWindowId = portletRequestInfo.getPortletWindowId();

            try {
                this.portletExecutionManager.doPortletAction(targetWindowId, request, response);
            } catch (RuntimeException e) {
                this.logger.error(
                        "Exception thrown while executing portlet action for: "
                                + portletRequestInfo,
                        e);

                // TODO this should be a constant right?
                actionRedirectUrl.setParameter("portletActionError", targetWindowId.toString());
            }
        }

        sendRedirect(actionRedirectUrl, response);
    }
833749
ParamBuilder getBuilderForParam(TypeMirror typeMirror) {
        ParamBuilder paramBuilder = typeBuilderMap.get(typeMirror);
        if (paramBuilder == null) {
            switch (typeMirror.getKind()) {
                case BOOLEAN:
                    paramBuilder = new BooleanParamBuilder(messager, null);
                    break;
                case BYTE:
                    paramBuilder = new ByteParamBuilder(messager, null);
                    break;
                case CHAR:
                    paramBuilder = new CharParamBuilder(messager, null);
                    break;
                case DOUBLE:
                    paramBuilder = new DoubleParamBuilder(messager, null);
                    break;
                case FLOAT:
                    paramBuilder = new FloatParamBuilder(messager, null);
                    break;
                case INT:
                    paramBuilder = new IntParamBuilder(messager, null);
                    break;
                case LONG:
                    paramBuilder = new LongParamBuilder(messager, null);
                    break;
                case SHORT:
                    paramBuilder = new ShortParamBuilder(messager, null);
                    break;
                case ARRAY:
                    paramBuilder = getBuilderForParam(((ArrayType) typeMirror).getComponentType());
                    break;
                case DECLARED:
                    TypeElement genericList = getGenericType(typeMirror);
                    if (genericList != null) {
                        paramBuilder = new ListOfParcelerParamBuilder(messager, null, genericList);
                    } else if (typeUtils.isAssignable(typeMirror, stringTypeMirror)) {
                        paramBuilder = new StringParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, charSequenceTypeMirror)) {
                        paramBuilder = new CharSequenceParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, listTypeMirror) || typeMirror.toString().equals("java.util.List<java.lang.String>")) {
                        paramBuilder = new ListParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, mapTypeMirror)) {
                        paramBuilder = new MapParamBuilder(messager, null);
                    } else if (typeUtils.isAssignable(typeMirror, parcellableTypeMirror)) {
                        paramBuilder = new ParcellableParamBuilder(messager, null);
                    } else {
                        String typeName = typeMirror.toString();
                        int templateStart = typeName.indexOf('<');
                        if (templateStart != -1) {
                            typeName = typeName.substring(0, templateStart).trim();
                        }
                        TypeElement typeElement = elementUtils.getTypeElement(typeName);
                        if (typeElement != null) {
                            if (typeElement.getKind() == ElementKind.INTERFACE && typeElement.getAnnotation(Remoter.class) != null) {
                                paramBuilder = new BinderParamBuilder(messager, null);
                            } else if (parcelClass != null && typeElement.getAnnotation(parcelClass) != null) {
                                paramBuilder = new ParcelerParamBuilder(messager, null);
                            }
                        }
                    }
                    break;
            }
            if (paramBuilder != null) {
                paramBuilder.setBindingManager(this);
                typeBuilderMap.put(typeMirror, paramBuilder);
            } else {
                paramBuilder = new GenericParamBuilder(messager, null);
                paramBuilder.setBindingManager(this);
                typeBuilderMap.put(typeMirror, paramBuilder);
            }
        }
        return paramBuilder;
    }
674292
protected UrlState determineUrlState(
            final IPortletWindow portletWindow, final WindowState requestedWindowState) {
        // Determine the UrlState based on the WindowState of the targeted portlet
        final WindowState currentWindowState = portletWindow.getWindowState();
        final WindowState urlWindowState =
                requestedWindowState != null ? requestedWindowState : currentWindowState;
        if (WindowState.MAXIMIZED.equals(urlWindowState)) {
            return UrlState.MAX;
        }

        if (IPortletRenderer.DETACHED.equals(urlWindowState)) {
            return UrlState.DETACHED;
        }

        if (IPortletRenderer.EXCLUSIVE.equals(urlWindowState)) {
            return UrlState.EXCLUSIVE;
        }

        if (!WindowState.NORMAL.equals(urlWindowState)
                && !WindowState.MINIMIZED.equals(urlWindowState)) {
            this.logger.warn(
                    "Unknown WindowState '"
                            + urlWindowState
                            + "' specified for portlet window "
                            + portletWindow
                            + ", defaulting to UrlState.NORMAL");
        }

        return UrlState.NORMAL;
    }
1052703
public IPortalUrlBuilder getPortalUrlBuilder(
            HttpServletRequest request, String fname, String layoutId, String type) {
        try {
            final UrlType urlType;
            if (StringUtils.isEmpty(type)) {
                urlType = UrlType.RENDER;
            } else {
                urlType = UrlType.valueOfIngoreCase(type);
            }

            if (StringUtils.isNotEmpty(fname)) {
                final IPortalUrlBuilder portalUrlBuilderByPortletFName =
                        this.portalUrlProvider.getPortalUrlBuilderByPortletFName(
                                request, fname, urlType);
                return portalUrlBuilderByPortletFName;
            }

            if (StringUtils.isNotEmpty(layoutId)) {
                final IPortalUrlBuilder portalUrlBuilderByLayoutNode =
                        this.portalUrlProvider.getPortalUrlBuilderByLayoutNode(
                                request, layoutId, urlType);
                return portalUrlBuilderByLayoutNode;
            }

            return this.portalUrlProvider.getDefaultUrl(request);
        } catch (Exception e) {
            this.logger.error(
                    "Failed to create IPortalUrlBuilder for fname='"
                            + fname
                            + "', layoutId='"
                            + layoutId
                            + "', type='"
                            + type
                            + "'. # will be returned instead.",
                    e);
            return new FailSafePortalUrlBuilder();
        }
    }
699398
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupPerformanceTargetServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupPerformanceTargetServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupPerformanceTargetServiceSoapBindingStub(new java.net.URL(CampaignGroupPerformanceTargetServiceInterfacePort_address), this);
                _stub.setPortName(getCampaignGroupPerformanceTargetServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1261035
protected Long doResourceReplayCachedContent(
            IPortletWindow portletWindow,
            HttpServletRequest httpServletRequest,
            CacheState<CachedPortletResourceData<Long>, Long> cacheState,
            PortletResourceOutputHandler portletOutputHandler,
            long baseExecutionTime)
            throws IOException {

        enforceConfigPermission(httpServletRequest, portletWindow);

        logger.debug("Replaying cached content for resource request to {}", portletWindow);

        final long renderStartTime = System.nanoTime();

        final CachedPortletResourceData<Long> cachedPortletResourceData =
                cacheState.getCachedPortletData();
        if (cachedPortletResourceData == null) {
            throw new PortletDispatchException(
                    "The portlet window '"
                            + portletWindow
                            + "' indicated via CacheControl#useCachedContent "
                            + "that the portal should render cached content, however there is no cached content to return. "
                            + "This is a portlet bug.",
                    portletWindow);
        }

        cachedPortletResourceData.replay(portletOutputHandler);

        final long executionTime = baseExecutionTime + (System.nanoTime() - renderStartTime);

        publishResourceEvent(portletWindow, httpServletRequest, executionTime, false, true);

        return executionTime;
    }
1060895
protected void publishResourceEvent(
            IPortletWindow portletWindow,
            HttpServletRequest httpServletRequest,
            long executionTime,
            boolean usedBrowserCache,
            boolean usedPortalCache) {

        final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();

        this.portalEventFactory.publishPortletResourceExecutionEvent(
                httpServletRequest,
                this,
                portletWindowId,
                executionTime,
                usedBrowserCache,
                usedPortalCache);
    }
881880
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.OfflineCallConversionFeedServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.OfflineCallConversionFeedServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.OfflineCallConversionFeedServiceSoapBindingStub(new java.net.URL(OfflineCallConversionFeedServiceInterfacePort_address), this);
                _stub.setPortName(getOfflineCallConversionFeedServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1338074
protected IPortletWindowId parsePortletWindowIdSuffix(
            HttpServletRequest request,
            final String prefix,
            final Set<String> additionalPortletIds,
            final String name) {
        // See if the parameter name has an additional separator
        final int windowIdStartIdx = name.indexOf(SEPARATOR, prefix.length());
        if (windowIdStartIdx < (prefix.length() + SEPARATOR.length()) - 1) {
            return null;
        }

        // Extract the windowId string and see if it was listed as an additional windowId
        final String portletWindowIdStr = name.substring(windowIdStartIdx + SEPARATOR.length());
        if (additionalPortletIds.contains(portletWindowIdStr)) {
            try {
                return this.portletWindowRegistry.getPortletWindowId(request, portletWindowIdStr);
            } catch (IllegalArgumentException e) {
                this.logger.warn(
                        "Failed to parse portlet window id: "
                                + portletWindowIdStr
                                + " null will be returned",
                        e);
            }
        }

        return null;
    }
1292493
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.admanager.axis.v201808.ReportServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.admanager.axis.v201808.ReportServiceSoapBindingStub _stub = new com.google.api.ads.admanager.axis.v201808.ReportServiceSoapBindingStub(new java.net.URL(ReportServiceInterfacePort_address), this);
                _stub.setPortName(getReportServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
1288267
@SuppressWarnings("unchecked")
    protected Map<IPortletWindowId, IPortletRenderExecutionWorker> getPortletHeaderRenderingMap(
            HttpServletRequest request) {
        synchronized (PortalWebUtils.getRequestAttributeMutex(request)) {
            Map<IPortletWindowId, IPortletRenderExecutionWorker> portletRenderingMap =
                    (Map<IPortletWindowId, IPortletRenderExecutionWorker>)
                            request.getAttribute(PORTLET_HEADER_RENDERING_MAP);
            if (portletRenderingMap == null) {
                portletRenderingMap =
                        new ConcurrentHashMap<IPortletWindowId, IPortletRenderExecutionWorker>();
                request.setAttribute(PORTLET_HEADER_RENDERING_MAP, portletRenderingMap);
            }
            return portletRenderingMap;
        }
    }
81556
function urlBuilder(params) {
  var builtUrl = params.base;

  builtUrl += '?';

  if (params.apiKey) {
    builtUrl += 'key=' + params.apiKey + '&';
  }

  if (params.client) {
    builtUrl += 'client=' + params.client + '&';
  }

  if (params.libraries.length > 0) {
    builtUrl += 'libraries=';

    params.libraries.forEach(function(library, index) {
      builtUrl += library;

      if (index !== params.libraries.length - 1) {
        builtUrl += ',';
      }
    });

    builtUrl += '&';
  }

  if (params.language) {
    builtUrl += 'language=' + params.language + '&';
  }

  if (params.version) {
    builtUrl += 'v=' + params.version + '&';
  }

  builtUrl += 'callback=' + params.callback;

  return builtUrl;
}