Enterprise open source portal built by and for the higher education community.
This project is maintained by uPortal-Project
To be of any use, real soffits must go beyond Hello World! Soffit provides a rich data model for sharing data from the portal with your application. There are (currently) four objects in this data model:
These objects can be shared by the portal with a soffit on each request, but none of them will be sent automatically. Under the hood, data model objects are sent to soffits as Jason Web Tokens (JWTs) using HTTP headers. Web servers place limits (usually configurable) on the size of the header area for inbound and outbound requests. The more data model elements sent, the greater the risk of exceeding this limit. In typical cases sending all four elements is somewhat risky; sending fewer (1, 2, or 3) should be safe.
You can instruct uPortal to send each data model object using a dedicated
portlet preference in the publishing record (metadata) of each soffit.
The default value of each preference is false
; set it to
true
to send the element.
Bearer
: org.apereo.portal.soffit.connector.SoffitConnectorController.includeAuthorization
PortalRequest
: org.apereo.portal.soffit.connector.SoffitConnectorController.includePortalRequest
Preferences
: org.apereo.portal.soffit.connector.SoffitConnectorController.includePreferences
Definition
: org.apereo.portal.soffit.connector.SoffitConnectorController.includeDefinition
Each of these objects is defined within the Expression Language (EL) Context in
which your .jsp
files execute. Use camel-case spelling to reference them, for
example…
<h2>Hello ${bearer.username}</h2>
@SoffitModelAttribute
AnnotationSometimes the Data Model provided by Soffit is not enough – sometimes you need to define your own objects for rendering a JSP. For Spring Boot-based Soffit applications, the @SoffitModelAttribute annotation satisfies this need.
@SoffitModelAttribute
ExamplesAnnotate a Spring bean with @SoffitModelAttribute
to make the entire bean
available within your JSP.
@SoffitModelAttribute("settings")
@Component
public class Settings {
public int getMaxNumber() {
return 100;
}
}
Annotate a method on a Spring bean with @SoffitModelAttribute
to have Soffit
invoke the method and make the return value available within your JSP.
@Component
public class Attributes {
@SoffitModelAttribute("bearerJson")
public String getBearerJson(Bearer bearer) {
String result = null;
try {
result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(bearer);
} catch (JsonProcessingException e) {
final String msg = "Unable to write the Bearer object to JSON";
throw new RuntimeException(msg, e);
}
return result;
}
}
Signatures of methods annotated with @SoffitModelAttribute
are flexible; you
may take any, all, or none of the following objects as parameters, in any order:
HttpServletRequest
HttpServletResponse
Bearer
PortalRequest
Preferences
Definition