adalm pluto
Several facts have participated in getting Portal technologies used recently. Business needs have many kind of complexities, companies want to get their employees more productive, customers want to be served efficiently, managers want to save their time getting required information easily and many other reasons are considered for appealing the users adopting Portal technologies.
最近有一些事实参与了Portal技术的使用。 业务需求具有多种复杂性,公司希望提高其员工的生产力,客户希望有效地为其提供服务,经理希望节省其时间以轻松获得所需的信息,并考虑了许多其他因素来吸引采用Portal技术的用户。
Developing of Portal and all accompanies APIs were unorganized efforts, in that every propriety has developed its own Portal/Portlet without giving any chance to be aligned with any of type of standards that makes the integration between all of implementations quite easy. Java Community has noticed that and for seeking a kind of standardization, they have released the first Java Specification Request (JSR-168) before introducing a JSR-286 in March 2008.
开发Portal和所有随附的API都是无组织的,因为每个所有者都已开发了自己的Portal / Portlet,而没有任何机会与任何类型的标准保持一致,这使得所有实现之间的集成非常容易。 Java社区已经注意到,为了寻求一种标准化,他们在2008年3月推出JSR-286之前发布了第一个Java规范请求( JSR-168 )。
JSR-168 has defined set of APIs for Portal computing and addressing the areas of aggregation, presentation, security and personalization as it’s also enabled interoperability between Portlets and Portals. At the same time, JSR-286 has aligned with a Java EE containers and integrated with all Portlet relevant specifications like WSRP specification 2.0.
JSR-168为门户计算定义了一组API,并解决了聚合,表示,安全性和个性化方面的问题,因为它还启用了Portlet和Portal之间的互操作性。 同时, JSR-286与Java EE容器对齐,并与所有与Portlet相关的规范(例如WSRP规范2.0)集成在一起。
This tutorial will help you in getting started with developing and deploying your Portlet applications into a standard and compliant Portlet container. Following bullets point shows you the main subjects that you’re going to pass through before finally getting a HelloWorld sample developed and deployed.
本教程将帮助您开始开发Portlet应用程序并将其部署到标准且符合要求的Portlet容器中。 接下来的要点向您显示了在最终开发和部署HelloWorld示例之前要通过的主要主题。
Apache Pluto represents the reference implementation of both of the Java portlet specifications mentioned above. Apache Pluto is partitioned into these following main parts:
Apache Pluto代表上述两个Java Portlet规范的参考实现。 Apache Pluto分为以下几个主要部分:
As we’ve stated earlier, Apache Pluto is a reference implementation for the specifications of portlet container. Using of Apache Pluto will help you getting your portlets developed, deployed and tested easily.
如前所述,Apache Pluto是Portlet容器规范的参考实现。 使用Apache Pluto将帮助您轻松地开发,部署和测试Portlet。
However, this section will help you mainly getting Apache Pluto installed and running through using of Eclipse IDE. Following below all required steps for doing that:
但是,本部分将主要通过使用Eclipse IDE帮助您安装并运行Apache Pluto。 请按照以下所有必要步骤进行操作:
tomcat-users.xml
tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<user name="tomcat" password="tomcat" roles="tomcat,pluto,manager,manager-gui" />
<user name="pluto" password="pluto" roles="pluto,manager,manager-gui" />
</tomcat-users>
A Portlet application is just like any normal WAR file that you may create. Even it contains some sort of additional sources that serve both of Portal and Portlet Container environments, but it’s finally deployed as a WAR.
Portlet应用程序就像您可以创建的任何普通WAR文件一样。 甚至它还包含可同时为Portal和Portlet Container环境提供服务的某种其他资源,但是最终将其部署为WAR。
Before getting started build the first HelloWorld portlet and deploy it into Apache Pluto Portal, just let’s see the structure of the assumed WAR file that we’re going to create.
在开始构建第一个HelloWorld Portlet并将其部署到Apache Pluto Portal之前,让我们看看我们将要创建的假定WAR文件的结构。
Here’s detailed explanation for the structure being shown in the previous figure:
这是上图中显示的结构的详细说明:
Let’s now build up our HelloWorld Portlet application and see how can we use the Eclipse IDE & Maven for such that purpose. Following all required steps:
现在,让我们构建我们的HelloWorld Portlet应用程序,并查看如何为此目的使用Eclipse IDE和Maven。 遵循所有必需的步骤:
"HelloWorldPortlet.xml
"HelloWorldPortlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/HelloWorldPortlet" docBase="HelloWorldPortlet" crossContext="true"></Context>
Maven is a build automation and Project Management tool. Developers that they want to develop a portlet web application needs to read this portion thoroughly. Without proper using of Maven in creating your Portlet application, you may face a lot of obstacles specially when it comes to deployment phase. Following below required Maven build file that would help you avoiding a lot of work you must achieve for getting proper deployment WAR package.
Maven是一个构建自动化和项目管理工具。 他们想要开发portlet Web应用程序的开发人员需要彻底阅读这一部分。 在创建Portlet应用程序时,如果没有正确使用Maven,特别是在部署阶段,您可能会遇到很多障碍。 遵循以下所需的Maven构建文件,该文件将帮助您避免为了获得正确的部署WAR包而必须完成的许多工作。
pom.xml
pom.xml
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.journaldev</groupId>
<artifactId>HelloWorldPortlet</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>HelloWorldPortlet Maven Webapp</name>
<url>https://maven.apache.org</url>
<dependencies>
<!-- Java Portlet Specification V2.0 -->
<dependency>
<groupId>org.apache.portals</groupId>
<artifactId>portlet-api_2.0_spec</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- bind 'pluto2:assemble' goal to 'process-resources' lifecycle -->
<!-- This plugin will read your portlet.xml and web.xml and injects required lines -->
<plugin>
<groupId>org.apache.portals.pluto</groupId>
<artifactId>maven-pluto-plugin</artifactId>
<version>2.1.0-M3</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- configure maven-war-plugin to use updated web.xml -->
<!-- This plugin will make sure your WAR will contain the updated web.xml-->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
</configuration>
</plugin>
</plugin>
</build>
</project>
Here’s detailed explanation for code listed above:
这是上面列出的代码的详细说明:
After building up your Project and setting your Maven file, it’s time to get into developing your first Portlet mission. Portlet is just like any Servlet you’ve ever created before, but instead of putting your code inside doGet, doPost, and so on, you are requesting to put your code inside doView, doEdit and doHelp.
建立项目并设置Maven文件之后,该开始开发第一个Portlet任务了。 Portlet就像您以前创建的任何Servlet一样,但是您不是将代码放入doGet,doPost等内部,而是要求将代码放入doView,doEdit和doHelp中。
Developing of Servlet was very easy, as you can print directly into your browser using of response.getWrite().print(). That’s applicable also when you’re working with Portlet. Next coming tutorials will highlight all of these concepts more than your expectation, so let’s see a simple HelloWorldPortlet that print out a hello message.
Servlet的开发非常容易,因为您可以使用response.getWrite()。print()直接打印到浏览器中。 当您使用Portlet时,这也适用。 接下来的教程将重点介绍所有这些概念,超出您的预期,因此让我们看一个简单的HelloWorldPortlet,它可以打印出问候消息。
package com.journaldev.portlet;
import java.io.IOException;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
public class HelloWorldPortlet extends GenericPortlet{
public void doView( RenderRequest request, RenderResponse response )
throws PortletException, IOException {
response.getWriter().print("Jounral Dev Provides you Hello World Portlet !");
}
}
Here’s detailed explanation for the code listed above:
这是上面列出的代码的详细说明:
Our portlet class is ready, but let’s see what are the lines you need to add into your portlet.xml.
我们的portlet类已经准备好,但是让我们看看需要添加到portlet.xml中的几行。
portlet.xml
portlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="https://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
https://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
<portlet>
<description>Write here a short description about your portlet.</description>
<portlet-name>HelloWorldPortlet</portlet-name>
<display-name>HelloWorldPortlet Portlet</display-name>
<portlet-class>com.journaldev.portlet.HelloWorldPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<portlet-info>
<title>Hello World Portlet</title>
<short-title>Hello World</short-title>
<keywords>Hello,pluto</keywords>
</portlet-info>
</portlet>
</portlet-app>
Here’s detailed explanation for the code listed above:
这是上面列出的代码的详细说明:
Now, it’s time to get your Portlet installed into your Portal, but before going forward, let’s see the form of the web.xml file before executing Pluto maven’s plugin.
现在,是时候将Portlet安装到门户中了,但是在继续之前,让我们在执行Pluto maven的插件之前先看一下web.xml文件的形式。
web.xml
web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"https://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
As you’ve noticed, nothing defined here. Just open your command and navigate into your Project and type mvn clean package
followed by enter. Your Deployment Descriptor will look like:
您已经注意到,这里没有定义任何内容。 只需打开您的命令并导航到您的Project,然后键入mvn clean package
然后按Enter。 您的部署描述符将如下所示:
web.xml
web.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "https://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>HelloWorldPortlet</servlet-name>
<servlet-class>org.apache.pluto.container.driver.PortletServlet</servlet-class>
<init-param>
<param-name>portlet-name</param-name>
<param-value>HelloWorldPortlet</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldPortlet</servlet-name>
<url-pattern>/PlutoInvoker/HelloWorldPortlet</url-pattern>
</servlet-mapping>
</web-app>
Here’s detailed explanation for the code listed above:
这是上面列出的代码的详细说明:
Now, copy your generated WAR file into Apache Pluto Tomcat webapps folder.
现在,将生成的WAR文件复制到Apache Pluto Tomcat webapps文件夹中。
Find your Eclipse console, as you should notice that a new WAR has been deployed and a new Portlet has been registered.
找到您的Eclipse控制台,您应该注意到已经部署了新的WAR,并且已经注册了新的Portlet。
As you’ve noticed, messages of deploying a web application archive and registering a new Portlet are displayed into your Eclipse console. If you were reached into this phase, you can say that about of 90% of the work has been done.
您已经注意到,部署Web应用程序归档文件和注册新Portlet的消息显示在Eclipse控制台中。 如果您已进入此阶段,则可以说大约90%的工作已经完成。
Just open your Apache Pluto application and ensure that your Portlet is deployed successfully.
只需打开Apache Pluto应用程序并确保成功部署了Portlet。
Another way to ensure that your deployment went properly just enter the manager of the Apache Tomcat itself and find your deployment there.
确保部署正确进行的另一种方法是,进入Apache Tomcat本身的管理器,然后在此处找到您的部署。
As we’ve stated earlier, Portlet hasn’t been separated component like Servlet, in order to see a Portlet, you must include it inside a Portal Page. Creating of Portal Page against Apache Pluto isn’t a complicated mission.
如前所述,Portlet尚未像Servlet那样被分离,为了查看Portlet,必须将其包含在Portal页面中。 针对Apache Pluto创建门户页面并不是一项复杂的任务。
If you were laying on Pluto Admin, you can use Add Page to add a new Page. Let’s add a new Pluto page and called it JournalDev.
如果您使用的是Pluto Admin,则可以使用“添加页面”来添加新页面。 让我们添加一个新的Pluto页面,并将其称为JournalDev。
For now, you have a new page called JournalDev, as you can add whatever you want of Portlet inside it by using the Portlet Applications. Just make sure you’re selected the JournalDev page and by navigating Portlet Applications, choose HelloWorldPortlet-0.0.1-SNAPSHOT and select HelloWorldPortlet after then. Finally click on Add Portlet located at the end of the page.
现在,您将拥有一个名为JournalDev的新页面,因为您可以使用Portlet应用程序在其中添加所需的Portlet 。 只需确保选择了JournalDev页面,然后通过导航Portlet应用程序,选择HelloWorldPortlet-0.0.1-SNAPSHOT,然后选择HelloWorldPortlet。 最后,单击页面末尾的“添加Portlet”。
As you’ve noticed a new Page JournalDev has been added at the most right position. So you can navigate into by clicking on. There you will see your HelloWorldPortlet like below.
如您所见 ,在最正确的位置添加了新的Page JournalDev 。 因此,您可以通过单击进入。 在那里,您将看到如下所示的HelloWorldPortlet。
Find below final Project Structure image.
在下面的最终项目结构图像中查找。
Apache Pluto is a reference implementation for Java Specification Portlet API 2.0. This tutorial intended to provide you the whole steps required for getting Portlet application developed and deployed against Apache Pluto Portal. Contribute us by commenting below and find a full downloaded source code for your reference.
Apache Pluto是Java Specification Portlet API 2.0的参考实现。 本教程旨在为您提供针对Apache Pluto Portal开发和部署Portlet应用程序所需的全部步骤。 通过在下面发表评论来贡献我们,并找到完整的下载源代码供您参考。
adalm pluto