Hershel wants to programmatically check if specific users have access to his company's new portlet application, in order to show a message in another portlet asking them to purchase a subscription. He is trying to do so with the least amount of performance overhead. What would be the best way for Hershel to accomplish this?
A. He should use AccessControlRuntimeModel or AccessControlGlobalRuntimeModel to verify explicit role assignments.
B. He should use the com.ibm.portal.ac.UserRoles interface to verify explicit role assignments.
C. He should read role assignments using the com.ibm.portal.ac.RoleData interface and ensure portlet caching is enabled.
D. He should use the com.ibm.portal.ac.RoleData interface to verify explicit role assignments.
正解:A
質問 2:
Bill is developing a portlet that uses AJAX to retrieve information from the server. In the serveResource() method first he is setting "AdminName" request attribute and then forwarding control to a JSP for generating markup. Using best practices, how should he print the "AdminName" attribute inside the JSP?
A. <%=renderRequest.getAttribute("AdminName")%>
B. ${requestScope.AdminName}
C. ${portalRequest.AdminName}
D. <%=resourceRequest.getAttribute("AdminName")%>
正解:B
質問 3:
Tyson is the sole IBM WebSphere Portal administrator in his company. He has developed a portlet that uses content spots to bind certain portlet markup to users specific to a certain group accessing the portlet itself. What bindings can Tyson create to associate the users with the content spots to be shown?
A. Portlets cannot include dynamic content spots.
B. He can use Personalization Rules based on user and group information, hiding and showing the content spots per each grouping as desired.
C. He can store a personalization rule in the theme that creates a new version of the portlet for each user group automatically on first access,using the PortletClientModel and leveraging the PUMA UserGroup object
D. He can use the ContentPresentationModel to hide and show content spots based on any parameter included in the ContentPresentationResource and change the content spot based on the user's group
正解:B
質問 4:
Given the following code in the portlet.xml file, what line of code returns the value of the "test" initparam. <portlet-class>MyPortlet</portlet-class> <init-param> <name>test</name> <value>test_init_parameter</value> </init-param>
A. renderRequest.getInitParameter("test");
B. portletConfig.getInitParameter("test");
C. renderRequest.getPortalContext().getInitParameter("test");
D. renderResponse.getInitParameter("test");
正解:B
質問 5:
Which of the following is a false statement about limitations for a WSRP producer portlet?
A. WSRP producer portlets cannot use IBM WebSphere Portal internals in portlets such as engine objects or engine tags.
B. WSRP producer portlets cannot access portlet render parameters.
C. WSRP producer portlets do not support edit_defaults_compatibility portlet mode.
D. WSRP producer portlets cannot use PUMA SPI for accessing user information.
正解:B
質問 6:
When creating and registering a custom portlet service, it is possible to set initialization parameters. What code would Adrienne use to access a parameter with the name sample.portletservice.HelloServiceImpl2.message?
A. public void sayHello(RenderRequest request, RenderResponse response)
{
String message = request.getAttribute("message");
}
B. public void sayHello(RenderRequest request, RenderResponse response)
{
String message = request.getParameter("message");
}
C. public void init(Preferences servicePreferences) {
String message = servicePreferences.get("message",
"Hello");
}
D. public void init(Preferences servicePreferences) {
String message = servicePreferences.getInitParam("message",
"Hello");
}
正解:C