Академический Документы
Профессиональный Документы
Культура Документы
A portal is a web application that commonly provides personalization, single sign on,
content aggregation from different sources, and hosts the presentation layer of
information systems. Aggregation is the act of integrating content from different
sources within a web page.
Portal functionality can be divided into three main parts:
1. Portlet container: A portlet container is very similar to a servlet container,
in that every portlet is deployed inside a portlet container that controls the
life cycle of the portlet and provides it with necessary resources and
information about its environment. A portlet container is responsible for
initializing and destroying portlets and also for passing user requests to it and
collecting responses.
2. Content aggregator: As defined in the Portlet Specification, one of the main
jobs of a portal is to aggregate content generated by various portlet
applications.
3. Common services:One of the main strengths of a portal server is the set of
common services that it provides. Services are not part of the portlet
specification, but commercial portal implementations provide a rich set of
common services to distinguish themselves from their competitors. A few
common services that you can hope to find in most implementations are:
Single sign on:Allows you to get access to all other applications once
you log into the portal server, meaning you dont have to log into
every application separately. For example, once I log in to my intranet
site, I should get access to my mail application, IM messaging
application, and other intranet applications, without having to log into
each of these applications separately.A portal server will provide you
with a securedcredentials store. What you do is to go to the mail
application and specify your user name and password once. This
information will be stored in the credentials store in encrypted form.
From the next time onwards, when you log into your intranet site, the
portal server will read your credentials from the store and log into your
mail server on your behalf. The same goes for other applications.
amount of income and Show the discount deals portlet to users with
Y amount of income.
Portlet:--> A portlet is an application that provides a specific piece of content
(information or service) to be included as part of a portal page. It is managed by a
portlet container that processes requests and generates dynamic content. Portlets
are used by portals as pluggable user interface components that provide a
presentation layer to information Systems. Web clients interact with portlets via a
request/response paradigm implemented by the portal. Normally, users interact
with content produced by portlets, for example by following links or submitting
forms, resulting in portlet actions being received by the portal, which are forwarded
by it to the portlets targeted by the user's interactions.
Portlet Container: The lifecycle of a portlet is managed by the portlet container.
A portlet container runs portlets and provides them with the required runtime
environment. A portlet container contains portlets and manages their lifecycle. It
also provides persistent storage for portlet preferences. A portlet container receives
requests from the portal to execute requests on the portlets hosted by it.
A portlet container is not responsible for aggregating the content produced by the
portlets. It is the responsibility of the portal to handle the aggregation. A portal and
a portlet container can be built together as a single component of an application
suite or as two separate components of a portal application. The portlet container is
an extension of the servlet container. As such, a portlet container can be built on
top of an existing servlet container or it may implement all the functionality of a
servlet container. Regardless of how a portlet container is implemented, its runtime
environment is assumed to support at least Servlet Specification 2.4.
Portlet lifecycle
The Portlet interface is the main abstraction of the Portlet API. All portlets
implement this interface either directly or, more commonly, by extending a class
that implements the interface.The Portlet API includes a GenericPortlet class that
implements the Portlet, EventPortlet and ResourceServingPortlet interface and
provides default functionality. Developers should typically extend, directly or
indirectly, the GenericPortlet class to implement their portlets.The Portlet provides
the additional optional lifecycle interfaces EventPortlet and ResourceServingPortlet
that the portlet can implement.
Basic four lifecycle methods
The init(PortletConfig config) method is called once, immediately after a new
portlet instance is created. It can be used to perform startup tasks and is akin to a
servlets init method. PortletConfig represents read-only configuration data, specified
in a portlet's descriptor file, portlet.xml(more on this file later). For example,
PortletConfig provides access to initialization parameters.
The processAction(ActionRequest request, ActionResponse response)
method is called in response to a user action such as clicking a hyperlink or
submitting a form. In this method, a portlet may invoke business logic components,
such as JavaBeans, to accomplish its goal.
The ActionRequest and ActionResponse Interfaces are subinterfaces of
PortletRequest and PortalRequest. In processAction, a portlet may modify its own
state as well as persistent information about a portlet.
The render(RenderRequest request, RenderResponse response) method
follows processAction in the chain of lifecycle methods. Render generates the
markup that will be made accessible to the portal user. RenderRequest and
RenderResponse methods, also subinterfaces of PortletRequest and
PortletResponse, are available during the rendering of a portlet. The way in which
the render method generates output may depend on the portlet's current state. The
destroy() method is the last lifecycle method, called just before a portlet is garbage
collected and provides a last chance to free up portlet resources.
An event is a life cycle operation that occurs before the rendering phase. Events can
be described as a loosely coupled, brokered means of communication between
portlets. Events allow portlets to respond on actions or state changes not directly
related to an interaction of the user with the portlet.
A portlet can declare events in its deployment descriptor by using the eventdefinition element in the portlet application section. In the portlet section, each
portlet specifies the events it would like to publish through the supportedpublishing-event element and the events it would like to process through the
supported-processing-event element.
The supported-publishing-event and supported-processing-event elements must
reference the event name defined in the portlet application section in a eventdefinition element.
The portlet creates events using the setEvent() method during action processing.
This will be processed by the portlet container after the action processing has
finished. Portlets can also create events during event phase by calling setEvent()
method on EventResponse.
To receive events, the portlet must implement the javax.Portlet.EventPortlet
interface. The portlet container calls the processEvent() method for each event
targeted to the portlet with an EventRequest and EventResponse object. The portlet
can access the event that triggered the current process event call by using the
EventRequest.getEvent() method. This method returns an object of type Event
encapsulating the current event name and value.
Additional lifecycle operation using ResourceServingPortlet
The serveResource method can be used to implement Ajax use cases by invoking
the resource URL through the XMLHttpRequest(or XMLPortletRequest) in client-side
JavaScript code.
Portlet vs Servlet
Portlets only generate markup fragments in the render method, not complete
documents. The Portal aggregates portlet markup fragments into a complete
portal age
Portlets can only be invoked through URLs constructed via the portlet API.
Portlets have more refined request handling, i.e. action requests, event
request,render request and resource requests
Portlets have predefined portlet modes and window states that indicate the
function the portlet is performing and the amount of real estate in the portal
page
Portlets have URL rewriting functions for creating hyperlinks within their
content, which allow portal server agnostic creation of links and actions in
page fragments
Portlets can store transient data in the portlet session in two different
scopes: the application-wide scope and the portlet private scope.
Portlets can send and receive events from other portlets or can receive
container defined events.
Sharing between Portlet and Servlet: Portlets, servlets and JSPs are
bundled in an extended web application called a portlet application. Portlets,
servlets and JSPs within the same portlet application share the classloader,
application context and session.
A portlet can call servlets and JSPs just like a servlet can invoke other servlets
and JSPs using a request dispatcher
When a servlet or JSP is called from within a portlet, the servlet request given
to the servlet or JSP is based on the portlet request and the servlet response
given to the servlet or JSP is based on the portlet response.
Attributes set in the portlet request are available in the included servlet
request
The portlet and the included servlet or JSP share the same output stream
Attributes set in the portlet session are accessible from the servlet session
and vice versa
Portlet Config