Enterprise open source portal built by and for the higher education community.
This project is maintained by uPortal-Project
uPortal implémente le rendu complet de pages en utilisant un pipeline: une structure imbriquée d’éléments discrets, pluggables, qui implémentent chacun la même interface Java. Le mot “pipeline” est approprié parce qu’il invoque les concepts de mouvement et de flux, mais dans le logiciel, cette conception est également connu sous le nom Decorator pattern.
L’interface Java au centre du pipeline de rendu uPortal est IPortalRenderingPipeline
.
Les instances de IPortalRenderingPipeline
sont des beans gérés par Spring. Le bean primaire du pipline du rendu
reçoit un identifiant (dans Spring) de portalRenderingPipeline
. Les composants d’autres parties du
portail (en dehors du pipeline de rendu) utilisent ce bean (exclusivement) pour interagir avec le rendu dans
le portail.
L’interface IPortalRenderingPipeline
ne définit qu’une seule méthode :
public void renderState(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException;
Le pipeline de rendu “standard” est celui qui vient avec uPortal prêt à l’emploi: par défaut,
uPortal 5 utilise la même configuration de pipeline de rendu que uPortal 4.3 - basée sur une instance de
DynamicRenderingPipeline
qui contient un nombre de composants.
Les composants de DynamicRenderingPipeline
implémentent chacun une interface unique:
CharacterPipelineComponent
, qui lui-même étend
PipelineComponent <CharacterEventReader, CharacterEvent>
. (Le pipeline de rendu standard est relié à XML / XSLT.)
Chaque composant implémente une étape discrète dans le rendu d’une demande de page.
Le pipeline standard comprend (à ce jour) les composants suivants (étapes):
analyticsIncorporationComponent
portletRenderingIncorporationComponent
portletRenderingInitiationCharacterComponent
themeCachingComponent
postSerializerLogger
staxSerializingComponent
postThemeTransformLogger
themeTransformComponent
preThemeTransformLogger
themeAttributeIncorporationComponent
portletRenderingInitiationComponent
structureCachingComponent
postStructureTransformLogger
structureTransformComponent
preStructureTransformLogger
structureAttributeIncorporationComponent
portletWindowAttributeIncorporationComponent
dashboardWindowStateSettingsStAXComponent
postUserLayoutStoreLogger
userLayoutStoreComponent
L’ordre de traitement pour ces composants de pipeline est essentiellement rétroactif: du bas vers le haut.
RenderingPipelineBranchPoint
Les intégrateurs d’uPortal peuvent configurer le pipeline de rendu en fonction de leur besoin. La plupart des cas d’utilisation
peuvent être satifaits en utilisant les Beans RenderingPipelineBranchPoint
. les Rendering branchpoints sont des
Object Java (Beans gérés par Spring) qui indiquent à quelques (ou toutes les) requêtes HTTP de suivre un chemin different.
Les Rendering branch points (points de branchement de rendu) suivent la stratégie de configuration uPortal 5 standard pour des Beans gérés par Spring :
si vous fournissez un Bean correctement configuré du type correct (viz.
RenderingPipelineBranchPoint
) au contexte d’application Spring, uPortal le découvrira et
l’appliquera. (uPortal le fournira comme une dépendance aux composants qui sauront quoi
faire avec.)
uPortal évalue les Beans RenderingPipelineBranchPoint
, si présent, dans un ordre spécifique. Si une
branche indique qu’elle doit être suivie, il va la suivre et aucune autre branche ne sera
testée. Si aucune branche n’est suivie, le pipeline de rendu standart sera utilisé.
Le Beans RenderingPipelineBranchPoint
acceptent les paramètres de configuration suivant :
Propriétés | Type | Requis ? | Notes |
---|---|---|---|
order |
int |
N° | Définit la séquence des points de branchement lorsqu’il y en a plusieurs (dans ce cas, order est requis). Les branches avec des valeurs d’ordre inférieures viennent avant les valeurs plus élevées. |
predicate |
java.util.function.Predicate<HttpServletRequest> |
O | Si le predicate renvoie true , la branch sera suivie; sinon la branche suivante sera testée. |
alternatePipe |
IPortalRenderingPipeline |
O | Le chemin de rendu qui sera suivi si le predicate renvoie true .. |
Les exemples suivants illustrent certaines utilisations typiques des beans RenderingPipelineBranchPoint
. Chacuns
de ces exemples peuvent être configurés dans
uPortal-start/overlays/uPortal/src/main/resources/properties/contextOverrides/overridesContext.xml
.
Cet exemple illustre une fonctionnalité couramment demandée: interdire l’accès non authentifié au portail.
<bean id="guestUserBranchPoint" class="org.apereo.portal.rendering.RenderingPipelineBranchPoint">
<property name="predicate">
<bean class="org.apereo.portal.rendering.predicates.GuestUserPredicate" />
</property>
<property name="alternatePipe">
<bean class="org.apereo.portal.rendering.RedirectRenderingPipelineTerminator">
<property name="redirectTo" value="${org.apereo.portal.channels.CLogin.CasLoginUrl}" />
</bean>
</property>
</bean>
Cet exemple illustre la configuration requise du Pipeline de rendu uPortal pour l’intégration avec uPortal-home.
<bean id="redirectToWebMaybe" class="org.jasig.portal.rendering.RenderingPipelineBranchPoint">
<property name="order" value="1" />
<property name="predicate">
<bean class="org.jasig.portal.rendering.predicates.GuestUserPredicate" />
</property>
<property name="alternatePipe" ref="redirectToWeb" />
</bean>
<bean id="maybeRedirectToExclusive" class="org.jasig.portal.rendering.RenderingPipelineBranchPoint">
<property name="order" value="2" />
<property name="predicate">
<bean class="java.util.function.Predicate" factory-method="and" factory-bean="focusedOnOnePortletPredicate">
<constructor-arg>
<bean class="java.util.function.Predicate" factory-method="and" factory-bean="urlNotInExclusiveStatePredicate">
<constructor-arg>
<bean class="org.jasig.portal.rendering.predicates.RenderOnWebFlagSetPredicate" />
</constructor-arg>
</bean>
</constructor-arg>
</bean>
</property>
<property name="alternatePipe" ref="redirectToWebExclusive" />
</bean>
<!-- if the request is for a simple content portlet, redirect to
uPortal-home to render that portlet statically. -->
<bean id="maybeRedirectToWebStatic" class="org.jasig.portal.rendering.RenderingPipelineBranchPoint">
<property name="order" value="3" />
<property name="predicate">
<bean class="java.util.function.Predicate" factory-method="and" factory-bean="focusedOnOnePortletPredicate">
<constructor-arg>
<bean class="java.util.function.Predicate" factory-method="and" factory-bean="urlInMaximizedStatePredicate">
<constructor-arg>
<ref bean="webAppNameContainsSimpleContentPortletPredicate" />
</constructor-arg>
</bean>
</constructor-arg>
</bean>
</property>
<property name="alternatePipe" ref="redirectToWebStatic" />
</bean>
<!-- Common Predicates -->
<bean id="focusedOnOnePortletPredicate" class="org.jasig.portal.rendering.predicates.FocusedOnOnePortletPredicate" />
<bean id="urlNotInExclusiveStatePredicate" class="org.jasig.portal.rendering.predicates.URLInSpecificStatePredicate">
<property name="state" value="EXCLUSIVE" />
<property name="negated" value="true" />
</bean>
<bean id="urlInMaximizedStatePredicate" class="org.jasig.portal.rendering.predicates.URLInSpecificStatePredicate">
<property name="state" value="MAX" />
</bean>
<bean id="webAppNameContainsSimpleContentPortletPredicate" class="org.jasig.portal.rendering.predicates.WebAppNameContainsStringPredicate">
<property name="webAppNameToMatch" value="SimpleContentPortlet" />
</bean>
<!-- Pipeline Terminators -->
<bean id="redirectToWeb" class="org.jasig.portal.rendering.RedirectRenderingPipelineTerminator">
<property name="redirectTo" value="${angular.landing.page}" />
</bean>
<bean id="redirectToWebExclusive" class="org.jasig.portal.rendering.RedirectRenderingPipelineTerminator">
<property name="redirectTo" value="${angular.landing.page}exclusive/" />
<property name="appender" value="fname" />
</bean>
<!-- Redirect to uPortal-home,
instructing uPortal-home to render a particular portlet statically. -->
<bean id="redirectToWebStatic" class="org.jasig.portal.rendering.RedirectRenderingPipelineTerminator">
<property name="redirectTo" value="${angular.landing.page}static/" />
<property name="appender" value="fname" />
</bean>