Programming Notes

Portlets With Wicket 1.5.x in Liferay Portal

| Comments

After Wicket dropped support for portlets and moving it to wicketstuff the settings in XMLs are changed:

portlet.xml should look like

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<portlet>
  <description>wickettest4</description>
  <portlet-name>wickettest4</portlet-name>
  <display-name>wickettest4</display-name>
  <portlet-class>org.apache.wicket.portlet.WicketPortlet</portlet-class>
  <init-param>
      <name>wicketFilterPath</name>
      <value>/bla</value>
  </init-param>
  <supports>
      <mime-type>text/html</mime-type>
      <portlet-mode>VIEW</portlet-mode>
  </supports>
  <portlet-info>
      <title>wickettest4</title>
      <keywords>wickettest4</keywords>
  </portlet-info>
</portlet>

Note new portlet-class. Also, mime-type have to be text/html.

web.xml also changed, notice filter class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<filter>
  <filter-name>wicket.wicket</filter-name>
  <filter-class>org.apache.wicket.portlet.PortletFilter</filter-class>
  <init-param>
      <param-name>applicationClassName</param-name>
      <param-value>org.wicket.WicketApplication</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>wicket.wicket</filter-name>
  <url-pattern>/bla/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>INCLUDE</dispatcher>
  <dispatcher>FORWARD</dispatcher>
</filter-mapping>

And of course Maven dependencies also changed:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<dependency>
  <groupId>org.apache.wicket</groupId>
  <artifactId>wicket-core</artifactId>
  <version>${wicket.version}</version>
</dependency>
<dependency>
  <groupId>org.apache.portals.bridges</groupId>
  <artifactId>portals-bridges-common</artifactId>
  <version>2.0</version>
</dependency>
<dependency>
  <groupId>org.wicketstuff</groupId>
  <artifactId>wicketstuff-portlet</artifactId>
  <version>${wicket.version}</version>
</dependency>

Comments