Java门户是一类特殊的Web应用程序,它使您能够开发类似于Content Management Systems(CMS)的复杂且模块化的信息系统,但适用于公司部门。这意味着他们通常具有处理页面,应用程序,用户,流程,国际化等层次结构的能力,并且可以将其集成到公司信息基础结构中。
这些系统的市场上有来自Oracle,SAP,IBM(现为HCL Technologies Ltd),Red Hat JBoss等知名公司的商业产品,此外还有Liferay门户网站,该门户网站具有不错的开源版本以及教育和其他面向主题的门户网站系统。 ,没有足够的门户,但是支持DMS Alfresco等门户技术的信息系统。支持性的意思是,即使从理论上讲,为一个系统开发的应用程序可以安装在另一个系统上,但实际上并非完全如此。制造商添加了自己的功能,这些功能与其他功能不兼容,从而使这一无与伦比的功能无法实现。
许多专家低估了技术和标准之间互操作性的重要性。通常,门户的开发组织可能会长期困难,因为许多商业供应商继续生活在封闭的世界中,通常通过解决开发人员问题来赚钱。门户网站本身旨在承受高负载,过去对系统也有不错的要求。随着Portlet 3.0应用程序标准的发布,这种情况会大大改善,今天,我们将尝试建立一个通用的同时相对舒适的门户网站应用程序开发过程。
“”, . .
java . Portlets 1.0 , Portlets 2.0, Portlets 3.0.
, - - ;). npm spring-boot . .. SPA , “ ” . , . : JSON , , , xml-, .
, - -. .. java , Spring, Struts, Faces, Jersey . PHP Ruby.
WSRP .
. 4- . .
Java , “” .
Apache Pluto, , .. .
.
Unix-like Windows git shell . git cmd.exe
git clone https://github.com/apache/portals-pluto
. , - , 8 ant. .
mvn package
ant -f dist-build.xml -DpackageOnly=true
-DincludeDemos=true , - , demo/pom.xml build
<finalName>${project.name}</finalName>
Windows pom.xml,.. -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
target/dist , . , .. .
pluto-3.1.1-SNAPSHOT-bundle.tar.bz2
.
, :\projects
cd c:\projects
tar xvjf c:\portals-pluto\pluto-3.1.1-SNAPSHOT-bundle.tar.bz2
cd pluto-3.1.1-SNAPSHOT
bin\startup.bat
startup.sh .
, .
, :
tail logs\catalina-.out -f
Windows .
org.apache.catalina.startup.Catalina.start Server startup
, ,
- pluto .
.
, , Apache Pluto , , , , Liferay WebSphere/HCL DXP.
Pluto Admin, .
http://localhost:8080/pluto/portal/Pluto%20Admin
demo, , .war webapps/.
. maven, . windows M2_HOME M2_HOME\bin Path.
cd projects
mvn archetype:generate -DarchetypeGroupId=org.apache.portals.pluto.archetype -DarchetypeArtifactId=mvcbean-jsp-portlet-archetype -DarchetypeVersion=3.1.0 -DgroupId=com.mycompany -DartifactId=hello-portlet
- Enter.
pom.xml .
<finalName>${project.name}</finalName>
.
, .. pluto .
cd hello-portlet
mvn -Ppluto package
, , . .. “” .
pluto liferay-cdi liferay-spring, Liferay . .. .. , .
target/’ Java- .war .
.war webapps.
- .
.
, Firefox, Chrome. - , , , .war webapps/ . , , .
, , , , , . VIEW render , EDIT, HELP . “ ” == “ ”. .. . . ( ) , , , .
hello-portlet/ maven IntelliJ IDEA. , gradle , .. . maven.
, MVC .
, .. , portletName portletNames. , Portlet .
:
@Inject - -
@RenderMethod -
@ActionMethod - GET, POST “ ”
@ServeResourceMethod - JSON
- actionName, id.
WAR , ..
src/main/webapp/resources
@RenderMethod(portletNames = "HelloPortlet", include = "/WEB-INF/jsp/helloView.jsp")
<portlet:actionURL var="placeOrderURL" name="placeOrder"></portlet:actionURL>
<portlet:resourceURL var="getSettingsURL" id="getSettings"></portlet:resourceURL>
rest .
request.setAttribute JSTL (.. ) JSP
<%
String ctxPath = request.getContextPath();
List<String> settings = (List<String>) renderRequest.getAttribute("settings");
%>
, . , . .
, <portlet:namespace> contextPath .. id , , , .
, . React, Angular, Vue . -, .. . skinny-widgets (https://www.npmjs.com/package/skinny-widgets) - .
GET public render parameters
@PortletConfiguration(portletName="portlet1", publicParams = {"categoryId"},
… { }
)
POST , .
RenderURL renderURL = resp.createRenderURL();
MutableRenderParameters renderParams = renderURL.getRenderParameters();
String idString = renderParams.getValue(name);
Liferay ( ) , .
multipart
Part part = request.getPart("image");
“ ” , . , @PortletConfiguration, .
, PortletPreferences, .. . Apache Pluto , Liferay .
@PortletConfiguration portlet.xml, .
“ ”, demo/ . “ ?”, “ ?”.
, .. , , weld, jandex 1.2.2.Final lib/ .
, . , , .
- : http://bitbucket.org/finistmart
JAX-RS - MySQL c Postgres.
: ;) .
, .
Pluto Liferay ( i7 2 U 8 Gb RAM , liferay, , ;) .
Liferay, , sourceforge.net
在Liferay中,Portlet Cooks被上载到部署/,而服务器Cooks被上载到tomcat-xyz / webapps,为了在portlet-ext.properties中进行舒适的开发,您需要添加禁用各种缓存的参数(可以谷歌搜索)。经过一些调整后,它也是一个不错的开发选择。