Manually Invalidating the Cache You may want the cached version of the portlet

7-70 Oracle Fusion Middleware Developers Guide for Oracle Portal For validation-based caching, you need not update provider.xml. You can view the portlet by refreshing the page or adding the portlet to a page and updating the content. If the content has changed, the portlet shows the new content. If the content has not changed, a cached version of the portlet is displayed.

7.2.10 Enhancing Portlets for Mobile Devices

This section explains how to go about enhancing a PDK-Java portlet for a mobile device. Before proceeding with this section, you should familiarize yourself with the guidelines for building mobile-enabled portlets, Section 6.1.4, Guidelines for Mobile Portlets , and the methods of building portlets with PDK-Java, Section 7.2, Enhancing PDK-Java Portlets . To properly build a portlet for a mobile device, do the following: 1. Create a JSP to generate the OracleAS Wireless XML in response to the show request for the portlet. The portlets JSPs are managed and controlled by the built in renderer, oracle.portal.provider.v2.render.http.ResourceRenderer. With this renderer, you can define distinct resources JSPs for each Show mode as well as which JSP to call for each Show mode. Hence, you can define one JSP to handle the Show mode when the requested content is HTML and another when the requested content is OracleAS Wireless XML. For example, this capability enables you to put the lottery portlets mobile rendition in a separate JSP. In this sample, mlotto.jsp generates the mobile rendition. Note the contentType declaration in the first line of the source code. The content type of the JSPs response is set to textvnd.oracle.mobilexml. This is the MIME type name for OracleAS Wireless XML. All mobile responses must set their content type to this value to work properly. page session=false contentType=textvnd.oracle.mobilexml page import=oracle.portal.sample.v2.devguide.lottery.LottoPicker LottoPicker picker = new LottoPicker; picker.setIdentityrequest.getRemoteAddr ; SimpleText SimpleTextItem SimpleTextItemYour numbers:SimpleTextItem SimpleTextItem SimpleTextItem HALIGN=CENTER int [] picks = picker.getPicks; for int i = 0; i picks.length; i++ { out.printpicks[i] + ; } out.println; SimpleTextItem SimpleText 2. Modify provider.xml by adding the acceptContentType tag in the portlet definition to indicate that the portlet can generate OracleAS Wireless XML responses. Each acceptContentType tag defines a distinct content type that the portlet can render. The value is the MIME type of the content. In this case the lottery portlet declares that it can generate HTML texthtml and OracleAS Wireless XML textvnd.oracle.mobilexml. acceptContentTypetexthtmlacceptContentType Enhancing Java Portlets 7-71 acceptContentTypetextvnd.oracle.mobilexmlacceptContentType For more information on the syntax of provider.xml, refer to the provider Javadoc on OTN: http:www.oracle.comtechnologyproductsiasportalhtmljavadocx ml_tag_reference_v2.html 3. Declare the mapping of JSP renderers to Show modes in provider.xml. You need to define a render handler for the pertinent Show modes by content type. One showPage declaration identifies a JSP that renders the HTML response and another one identifies the JSP that renders the OracleAS Wireless XML response. Note that the class attribute is now required, whereas, in a simpler case, it could allow the class to default. You express the association of a particular JSP to a particular content type through the resourcePath and contentType tags inside the showPage declaration as follows: ■ resourcePath defines the JSP used to render this mode. ■ contentType defines the response type of this JSP. When the ResourceRenderer receives a show request for the lottery portlet it invokes lotto.jsp to render the HTML response and mlotto.jsp for OracleAS Wireless XML. The following code illustrates how you express this relationship in provider.xml: renderer class=oracle.portal.provider.v2.render.RenderManager contentTypetexthtmlcontentType renderContainertruerenderContainer showPage class=oracle.portal.provider.v2.render.http.ResourceRenderer resourcePathhtdocslotterylotto.jspresourcePath contentTypetexthtmlcontentType showPage showPage class=oracle.portal.provider.v2.render.http.ResourceRenderer resourcePathhtdocslotterymlotto.jspresourcePath contentTypetextvnd.oracle.mobilexmlcontentType showPage ... renderer