Class SubspacesListPortlet
- All Implemented Interfaces:
javax.portlet.EventPortlet,javax.portlet.Portlet,javax.portlet.PortletConfig,javax.portlet.ResourceServingPortlet
SpaceService calls, nothing decided
here. Its three preferences are declared in portlet.xml and written
only through processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse), under the parent space management
guard, so that showHiddenSubspaces — the flag that lets a page
expose hidden sub-spaces to non-members — is never influenced by a client
value.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringBrowser cache of a widget-served avatar.static final StringResource id of the second resource this portlet serves: the avatar of one listed sub-space (<portlet:resourceURL id="avatar">in the JSP).static final intSame thumbnail size as the space avatar REST endpoint's default, so both paths serve the same bytes for the same space.static final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intHard bound of one resource call.static final intstatic final intstatic final StringBodies of the 404 and 403 answers.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanWhether the page this portlet renders on hosts a space that may carry sub-spaces — the same questionserveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)answers, asked of the sameSpaceServiceand resolved from the page, never from a request parameter.voidprocessAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response) voidserveResource(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response) Answers the widget with everything it needs to render, in one envelope: whether the hosting space is a parent space at all, what the viewer may do on it, and the sub-spaces they may see.static intstoredLimit(javax.portlet.PortletPreferences preferences) The stored number of rows, brought back insideMIN_SUBSPACES_LIMIT..MAX_SUBSPACES_LIMIT.Methods inherited from class org.exoplatform.commons.api.portlet.GenericDispatchedViewPortlet
doView, initMethods inherited from class javax.portlet.GenericPortlet
destroy, doDispatch, doEdit, doHeaders, doHelp, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletContext, getPortletName, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, processEvent, render
-
Field Details
-
HEADER_TRANSLATIONS_PREFERENCE
- See Also:
-
SHOW_HIDDEN_SUBSPACES_PREFERENCE
- See Also:
-
SUBSPACES_LIMIT_PREFERENCE
- See Also:
-
DEFAULT_SUBSPACES_LIMIT
public static final int DEFAULT_SUBSPACES_LIMIT- See Also:
-
MIN_SUBSPACES_LIMIT
public static final int MIN_SUBSPACES_LIMIT- See Also:
-
MAX_SUBSPACES_LIMIT
public static final int MAX_SUBSPACES_LIMIT- See Also:
-
LIMIT_OUT_OF_RANGE_MESSAGE
- See Also:
-
HEADER_TRANSLATIONS_INVALID_MESSAGE
- See Also:
-
SHOW_HIDDEN_SUBSPACES_INVALID_MESSAGE
- See Also:
-
LIMIT_PARAMETER
- See Also:
-
AVATAR_RESOURCE_ID
Resource id of the second resource this portlet serves: the avatar of one listed sub-space (<portlet:resourceURL id="avatar">in the JSP).- See Also:
-
SPACE_ID_PARAMETER
- See Also:
-
SPACE_ID_INVALID_MESSAGE
- See Also:
-
PARENT_SPACE_NOT_FOUND_MESSAGE
Bodies of the 404 and 403 answers. A fixed message code per status, asbackend-spring.md§5 asks: the Service's own sentence names the acting user and the space id, which is troubleshooting detail forLOG.debug, not something to hand a client.- See Also:
-
ACCESS_DENIED_MESSAGE
- See Also:
-
AVATAR_CACHE_CONTROL
Browser cache of a widget-served avatar. The URL carries no last-modified marker, so the cache is short and private.- See Also:
-
AVATAR_THUMBNAIL_SIZE
public static final int AVATAR_THUMBNAIL_SIZESame thumbnail size as the space avatar REST endpoint's default, so both paths serve the same bytes for the same space.- See Also:
-
DEFAULT_AVATAR_MIME_TYPE
- See Also:
-
MAX_RESOURCE_LIMIT
public static final int MAX_RESOURCE_LIMITHard bound of one resource call. The 'see more' drawer lists every sub-space at once (no pagination yet), so the cap is what keeps one parent with an unexpected number of sub-spaces from making the call unbounded. A constant rather than a property: the real bound is the parent template's subspacesMaxLimit, and beyond this the answer is pagination, not a bigger number.- See Also:
-
-
Constructor Details
-
SubspacesListPortlet
public SubspacesListPortlet()
-
-
Method Details
-
storedLimit
public static int storedLimit(javax.portlet.PortletPreferences preferences) The stored number of rows, brought back insideMIN_SUBSPACES_LIMIT..MAX_SUBSPACES_LIMIT.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)refuses a value outside those bounds, but it is not the only writer: a preference imported through the layout editor bypasses it entirely, so every reader clamps. This one is shared with the JSP rather than duplicated there, so the three places that read the preference cannot drift apart: an unclamped value feeds both the avatar resource's listing bound — where a large one is a big query on the render path and a negative one makes the Service throwIllegalArgumentException, which that method does not catch — and the envelope the widget re-seats its settings from, where a negative one makes the widget's ownslicedrop rows from the end.- Parameters:
preferences- the portlet preferences to read- Returns:
- the stored limit, never outside the bounds the widget can render
-
isParentSpaceContext
public static boolean isParentSpaceContext()Whether the page this portlet renders on hosts a space that may carry sub-spaces — the same questionserveResource(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse)answers, asked of the sameSpaceServiceand resolved from the page, never from a request parameter.Read by the JSP so that the widget is not booted at all outside a parent space: it used to boot everywhere, render its loading state and only then remove itself, which flashed a loading placeholder on every space that is not a parent one (PO feedback on EXO-89270).
Shared with the JSP the way
storedLimit(javax.portlet.PortletPreferences)is, rather than carried there as a render attribute:GenericDispatchedViewPortlet.doViewcopies every stored preference into a request attribute of the same name, after this class has had its turn, and a page editor may store a preference under any name at all (PageLayoutService.updatePageApplicationPreferences). No attribute name is therefore safe from being answered by a preference.- Returns:
truewhen the hosting space may carry sub-spaces
-
processAction
public void processAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response) throws IOException, javax.portlet.PortletException - Specified by:
processActionin interfacejavax.portlet.Portlet- Overrides:
processActionin classjavax.portlet.GenericPortlet- Throws:
IOExceptionjavax.portlet.PortletException
-
serveResource
public void serveResource(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response) throws javax.portlet.PortletException, IOException Answers the widget with everything it needs to render, in one envelope: whether the hosting space is a parent space at all, what the viewer may do on it, and the sub-spaces they may see. Every decision is theSpaceService's; this method only reads the trusted preference and the page context.The space is resolved from the page (
SpaceUtils.getSpaceByContext()), never from a request parameter, andshowHiddenSubspacesis read from the portlet preferences, never from the request: a client value must not be able to widen what is listed.- Specified by:
serveResourcein interfacejavax.portlet.ResourceServingPortlet- Overrides:
serveResourcein classjavax.portlet.GenericPortlet- Throws:
javax.portlet.PortletExceptionIOException
-