当前位置: 首页 > 工具软件 > Pluto Portal > 使用案例 >

adalm pluto_Apache Pluto RI入门,门户和Portlet容器示例教程

丌官子安
2023-12-01

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门户–简介 (Apache Pluto Portal – Introduction)

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分为以下几个主要部分:

  • Apache Pluto – Container: Is a Pluto container which is considered as a core component of the Apache Pluto. It’s meant to be embedded inside the Pluto Portal to provide Java Portlet Specification Compliance.

    Apache Pluto –容器:是一个Pluto容器,被视为Apache Pluto的核心组件。 它旨在嵌入到Pluto Portal中以提供Java Portlet规范合规性。
  • Apache Pluto – Portal: Is a Pluto’s user interface components (web application), it’s just a user interface has embedded within it a lightweight environment for developing and testing portlets.

    Apache Pluto –门户:是Pluto的用户界面组件(Web应用程序),只是在其中嵌入了一个用于开发和测试Portlet的轻量级环境的用户界面。
  • Apache Pluto – Portal Driver: Is a driver library for the Pluto portlet container, that said, all of required services implementations and utilities for implementing a portal which utilizes the container are implemented inside the Portal Driver.

    Apache Pluto –门户驱动程序:是Pluto Portlet容器的驱动程序库,也就是说,用于实施利用该容器的门户的所有必需服务实现和实用程序均在门户驱动程序内部实现。

Apache Pluto Portal –安装 (Apache Pluto Portal – Installation)

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。 请按照以下所有必要步骤进行操作:

  • Download Apache Pluto binary from Apache site. We have two versions of Apache Pluto, pluto-bundle that provides you a Pluto and Tomcat bundled together. Meanwhile, pluto-source-release which provides you the Pluto source code; requires you build and deploy Pluto into your own environment. Basically, we’d like download the bundled version that’s released under pluto-2.0.3-bundle.zip.

    从Apache站点下载Apache Pluto二进制文件。 我们有Apache Pluto的两个版本, pluto-bundle ,为您提供捆绑在一起的Pluto和Tomcat。 同时, pluto-source-release提供了Pluto的源代码。 需要您将Pluto构建并部署到您自己的环境中。 基本上,我们想下载在pluto-2.0.3-bundle.zip下发布的捆绑版本。
  • Extract the bundle into your local storage. We’ve supposed D:\Apache Pluto\pluto-2.0.3 path for tutorial purposes.

    将捆绑软件解压缩到本地存储中。 我们假定D:\ Apache Pluto \ pluto-2.0.3出于教程目的。
  • Configure your tomcat-users.xml file. It looks like:

    配置您的tomcat-users.xml文件。 看起来像:

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>
  • Start up your Tomcat server by executing D:\Apache Pluto\pluto-2.0.3\bin\startup.bat.

    通过执行D:\ Apache Pluto \ pluto-2.0.3 \ bin \ startup.bat来启动Tomcat服务器。
  • Waiting your Tomcat server to be started.

    等待您的Tomcat服务器启动。
  • Open your browser and type in https://localhost:8080/pluto and you must see the below log in screen.

    打开浏览器并输入https:// localhost:8080 / pluto ,您必须看到以下登录屏幕。
  • Log in into Apache Pluto Portal using username: tomcat and password: tomcat. Once you’ve logged in you should see the main page of Apache Pluto. In case you cannot, just double check into your tomcat-users.xml file and make sure it’s identical to that one provided.

    使用用户名:tomcat和密码:tomcat登录到Apache Pluto Portal。 登录后,您应该会看到Apache Pluto的主页。 如果不能,请仔细检查您的tomcat-users.xml文件,并确保它与提供的文件相同。
  • Main page of Apache Pluto is just a page addressed by https://localhost:8080/pluto/portal and it contains two portlets.

    Apache Pluto的主页只是https:// localhost:8080 / pluto / portal寻址的页面,它包含两个portlet。
  • Shut down your Apache Pluto by closing the running console and open your eclipse IDE. For this purpose, we’ve used Eclipse IDE Kepler 4.3.

    通过关闭正在运行的控制台来关闭Apache Pluto,然后打开Eclipse IDE。 为此,我们使用了Eclipse IDE Kepler 4.3。
  • From server window click on No servers are available. Click this link to create a new server ...

    在服务器窗口中,单击“ 无服务器可用”。 单击此链接创建一个新服务器
  • Select Tomcat v7.0 Server as a server type to be created and click next.

    选择Tomcat v7.0 Server作为要创建的服务器类型,然后单击下一步。
  • Configure the Tomcat server by browsing the Apache Pluto home.

    通过浏览Apache Pluto主页配置Tomcat服务器。
  • Click finish.

    单击完成。
  • Double click on the added server to specify the server path (catalina-base) and deploy path.

    双击添加的服务器以指定服务器路径(基于Catalina)并部署路径。
  • Make sure your server configuration is configured like below

    确保您的服务器配置如下配置
  • Start up your server from the Servers pane. Your Eclipse console should look like below

    从“服务器”窗格中启动服务器。 您的Eclipse控制台应如下所示
  • Open your browser and type the same url that’s already typed before and you will be able to see the same log in page. In case you’ve missed out the configuration step that’s already happened from inside the Eclipse IDE, you won’t be able to see your log in screen.

    打开浏览器,输入之前已经输入的相同网址,您将能够看到相同的登录页面。 如果您错过了Eclipse IDE内部已经发生的配置步骤,则将无法看到登录屏幕。
  • After you’ve logged in into your Apache Pluto, just try to navigate into Pluto Admin to check the tomcat-users.xml configuration. Generally, you must be able to see the manager page that will be used for deploying/undeploying your portlet applications once you’ve clicked on Upload and deploy a new portlet war.

    登录到Apache Pluto后,只需尝试导航到Pluto Admin中以检查tomcat-users.xml配置。 通常,单击“ 上传并部署新的portlet war”后 ,您必须能够看到将用于部署/取消部署portlet应用程序的管理器页面。

设置HelloWorld Portlet项目 (Setting Up HelloWorld Portlet Project)

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:

这是上图中显示的结构的详细说明:

  • You are about getting normal WAR file.

    您即将获得正常的WAR文件。
  • Your Portlet, is a normal Java class that’s located inside your source folder.

    Portlet是位于源文件夹内的普通Java类。
  • ContextDefinition.xml is a Tomcat context deployment descriptor that must has the same name as your artifactId with an XML extension. This deployment descriptor will allow Pluto web application to access any required resources from your deployed Portlet application.

    ContextDefinition.xml是Tomcat上下文部署描述符,其名称必须与带有XML扩展名的artifactId相同。 该部署描述符将允许Pluto Web应用程序从已部署的Portlet应用程序访问任何必需的资源。
  • Portlet.xml file that’s located beneath WEB-INF folder will be required by the Portlet container for defining the portlets.

    Portlet容器将需要WEB-INF文件夹下面的Portlet.xml文件来定义portlet。

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。 遵循所有必需的步骤:

  • Right-click from Project Explorer panel and make sure you are selecting New – Project – Other.

    在“项目资源管理器”面板上单击鼠标右键,并确保选择“新建–项目–其他”。
  • Expand Maven and select Maven Project and make a double next.

    展开Maven并选择Maven Project,然后双击。
  • From New Maven project, select maven-archetype-webapp.

    在New Maven项目中,选择maven-archetype-webapp。
  • Click next and fill in all required information (groupId, artifactId, version and package) to get ready-for-use project.

    单击下一步,然后填写所有必需的信息(groupId,artifactId,版本和程序包)以获取可立即使用的项目。
  • Click finish. Look below at the initial view.

    单击完成。 在下面查看初始视图。
  • In case you didn’t find your src/main/java, just create it as simple as that; on Java Resources – Right-click – New – Source Folder. Specify your Project name (i.e HelloWorldPortlet) and Folder name (i.e. src/main/java). May Eclipse tell you that this folder is already created, where it’s not. Just type src/main/jav and rename the folder after after then to be identical for what you did see int the figure above.

    如果您找不到src / main / java,只需创建它就这么简单; Java资源上–右键单击–新建–源文件夹。 指定您的项目名称(即HelloWorldPortlet)和文件夹名称(即src / main / java)。 可能Eclipse告诉您该文件夹已经创建,但尚未创建。 只需键入src / main / jav并在之后重命名该文件夹即可,与上图所示的完全相同。
  • Create your own Tomcat context file. Beneath of resources, create a HelloWorldPortlet.xml file. Make sure it contains the following lines as it’s named like your typed ArtifactId.

    创建您自己的Tomcat上下文文件。 在资源下,创建一个HelloWorldPortlet.xml文件。 确保它包含以下几行,因为其名称与您键入的ArtifactId相似。

"HelloWorldPortlet.xml

"HelloWorldPortlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/HelloWorldPortlet" docBase="HelloWorldPortlet" crossContext="true"></Context>
  • Create your portlet deployment descriptor (portlet.xml) file and make it empty.

    创建您的Portlet部署描述符(portlet.xml)文件并将其为空。

准备Maven构建文件 (Prepare Maven Build File)

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:

这是上面列出的代码的详细说明:

  • Portlet API is just the only required library that you should add. Several libraries are needed, but all of them will already be provided by the Apache Tomcat itself.

    Portlet API只是您应该添加的唯一必需的库。 需要几个库,但是所有这些库都已经由Apache Tomcat本身提供了。
  • To make sure your web.xml file will contain all needed lines for getting your Portlet deployed properly, you should use Maven Pluto Plugin. This plugin will read your portlet.xml file and updated your web.xml file with all required lines. This plugin will generate the updated web.xml file and put it into your target/pluto-resources folder.

    为确保web.xml文件包含正确部署Portlet所需的所有行,应使用Maven Pluto插件。 该插件将读取您的portlet.xml文件,并使用所有必需的行更新您的web.xml文件。 该插件将生成更新的web.xml文件,并将其放入您的target / pluto-resources文件夹中。
  • You won’t get the updated web.xml file into your generated WAR if you’ve not used the Maven WAR plugin. This plugin will read your generated web.xml file that’s located beneath target/pluto-resources and export it with your generated WAR.

    如果您未使用Maven WAR插件,则不会将更新的web.xml文件放入生成的WAR中。 该插件将读取位于目标/冥王星资源下的生成的web.xml文件,并将其与生成的WAR一起导出。

创建HelloWorld Portlet (Create HelloWorld Portlet)

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:

这是上面列出的代码的详细说明:

  • HelloWorldPortlet is a Java class that extends GenericPortlet.

    HelloWorldPortlet是扩展GenericPortlet的Java类。
  • GenericPortlet is a ready-made class that’s imported from javax.portlet package.

    GenericPortlet是从javax.portlet包导入的现成类。
  • javax.portlet package represents the API of Java Portlet Specification 2.0 that’s imported by the Maven build file.

    javax.portlet软件包表示由Maven构建文件导入的Java Portlet Specification 2.0的API。
  • Even that you cannot invoke your Portlet directly through using of url typed into address – as you did with Servlet – instead of that, you’re defining a Portal page that contains your Portlet.

    即使您不能像使用Servlet一样通过使用键入地址的url直接调用Portlet,也要定义包含Portlet的Portal页面。
  • Once you’ve requested a Portal page, the Portal will communicate with the Portlet container and execute your doView as a callback for your request.

    一旦请求了Portal页面,Portal将与Portlet容器通信并执行doView作为请求的回调。

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:

这是上面列出的代码的详细说明:

  • Your Portlet must be defined inside your portlet.xml ( Portlet deployment descriptor).

    您必须在portlet.xml(Portlet部署描述符)中定义您的Portlet。
  • You define your portlet inside a block that begins with <portlet> and ends with </portlet>.

    您可以在以<portlet>开头和</ portlet>结束的块内定义portlet。
  • You specify your portlet’s description, portlet-name, display-name, portlet-class, mime-type, portlet mode and supported locales. There are very amount of options that can be provided here, and they will be explained later on.

    您可以指定portlet的描述,portlet名称,显示名称,portlet类,mime类型,portlet模式和支持的语言环境。 这里可以提供很多选项,稍后将对其进行说明。
  • Make sure you are adding a portlet-info, in case you’ve missed them out, you will get an exception says Can’t find bundle resources.

    确保添加了portlet-info,以防万一您错过了它们,您将得到一个异常消息“找不到捆绑包资源”。

部署HelloWorld Portlet (Deploying HelloWorld Portlet)

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:

这是上面列出的代码的详细说明:

  • Pluto maven plugin has read your portlet.xml file and update your deployment descriptor accordingly. Note that the updated web.xml file will be part of the WAR file only, the source file in the project will not be updated.

    Pluto maven插件已读取您的portlet.xml文件并相应地更新了部署描述符。 请注意,更新的web.xml文件将仅是WAR文件的一部分,项目中的源文件将不会更新。
  • Portlet container is built on Servlet container and it has Servlet Container feature for achieving its work. So that a new Servlet HelloWorldPortlet has been defined and a special url pattern added also.

    Portlet容器基于Servlet容器构建,并且具有Servlet容器功能以实现其工作。 这样就定义了新的Servlet HelloWorldPortlet并添加了特殊的url模式。

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本身的管理器,然后在此处找到您的部署。

定义Apache Pluto门户页面 (Define Apache Pluto Portal Page)

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。

最终的HelloWorld Portlet应用程序结构 (Final HelloWorld Portlet Application Structure)

Find below final Project Structure image.

在下面的最终项目结构图像中查找。

摘要 (Summary)

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应用程序所需的全部步骤。 通过在下面发表评论来贡献我们,并找到完整的下载源代码供您参考。

翻译自: https://www.journaldev.com/4562/introduction-into-apache-pluto-ri-portal-portlet-container-example-tutorial

adalm pluto

 类似资料: