Skip to main content
Last updated May 21, 2013 13:07, by Martin Scott Nicklous
===JSR 286 Parameter Handling Summary=== (This is a work in progress ...) When developing JSR286 portlets it is important to understand how state and parameters are managed by the spec during the different life cycle phase. The specification distinguishes between: ;RenderRequest: equivalent to a "safe" HTTP method (e.g. GET), renders the content of a portlet for a given navigational state ;ActionRequest: equivalent to an "unsafe" HTTP method (e.g. PUT/POST/DELETE), modifies server side state and navigational state ;EventRequest: subphase of an ActionRequest, meant to modify server side state and navigational state ;ResourceRequest: used to address a fragment of a portlet or other dynamically generated resource The navigational state of a portlet is that piece of information that is equivalent to the URL in an non-aggregated web application. It contains the state required to render a particular "view" of the application represented by the portlet. This navigational state is split into two buckets: ;private render parameters: represent the part of the navigational state that is private to the portlet (e.g. an implementation detail). No other system component should have a dependency on these parameters. ;public render parameters: represent the contextual part of the navigational state. The same set of public render parameters might be shared with different portlets and/or may be used as an "interface" into the portlet The JSR286 specification provides means to address certain life cycle phases via URLs and defines how to pass parameters into these phases: ;RenderURL: a render URL targets the render phase. The parameters on a render URL represent the navigational state, i.e. a combination of public and private render parameters. The nature of the parameter is deduced by the name of the parameter, i.e. it is NOT possible to define a public and a private render parameter with the same name. ;ActionURL: an action URL targets the action phase. Parameters on an action URL are action parameters, they are related to neither public nor private render parameters. ;ResourceURL: the resource URL targets the resource phase. Parameters on a resource URL are resource parameters, they are related to neither public nor private render parameters. <pre>NOTE: render parameters can ONLY be set on render URLs!</pre> Inside a particular life cycle phase, parameters are made available via the respective request interface. Note, that the semantic of the available parameters is unique to the life cycle method, although all requests inherit from the same PortletRequest interface (i.e. the same method has different semantics based on the nature of the life cycle phase). The following table illustrates this: {|- border='1' |- | '''Method''' | '''RenderRequest''' | '''ActionRequest''' | '''ResourceRequest''' | '''EventRequest''' |- | '''getParameterMap''' | public/private render parameters, no value merging | action parameters and public render parameters, values are merged | resource parameters and public/private render parameters, values are merged | ? |- | '''getPrivateParameterMap''' | private render parameters | action parameters | resource parameters | ? |- | '''getPublicParameterMap''' | public render parameters | public render parameters | public render parameters | ? |- | '''getPrivateRenderParameterMap''' | - | - | private render parameters | ? |} The following table shows which parameters are associated implicitly (i.e. after creating a new URL) with the URL object: {|- border='1' |- | '''Parameter''' | '''RenderURL''' | '''ActionURL''' | '''ResourceURL''' |- | '''public render parameter''' | yes | yes | yes |- | '''private render parameter''' | no | no | yes |} In the next table we list the operations that can be done with parameters on different types of URL objects (C = create, R = read, U = update, D = delete): {|- border='1' |- | '''Parameter''' | '''RenderURL''' | '''ActionURL''' | '''ResourceURL''' |- | '''public render parameter''' | C(R*)UD | D | - |- | '''private render parameter''' | CRUD | - | - |- | '''action parameter''' | - | CRUD | - |- | '''resource parameter''' | - | - | CRUD |} * public render parameters can only be read from a render URL if they have been set explicitly on that URL object
Please Confirm