1

I'm trying to create a servlet which shares liferay session contents with my application.So I need to use PortalDelegateServlet.But I can not find in how to import this library to my project.I can not find any .jar files or something.

How can I import liferay java library to my project?

mekafe
  • 596
  • 4
  • 13
  • 32
  • http://www.liferay.com/downloads/liferay-portal/available-releases –  Nov 05 '14 at 09:50
  • I already downloaded and installed Liferay with Tomcat Bundle.But i can not find PortalDelegateServlet.What is your advice? – mekafe Nov 05 '14 at 09:55

1 Answers1

2

PortalDelegateServlet is in portal-service.jar which is a required part of the Liferay container. If you grabbed a bundle (which in comment you mention the Tomcat bundle), then it is provided for you. All you should need to do is configure your web.xml:

  <servlet>
    <!-- http://issues.liferay.com/browse/LEP-2297 -->
    <servlet-name>service</servlet-name>
    <servlet-class>com.liferay.portal.kernel.servlet.PortalDelegateServlet</servlet-class>
    <init-param>
      <param-name>servlet-class</param-name>
      <param-value>com.example.MyServlet</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>service</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

This Liferay issue (which is linked to in the source for PortalDelegateServlet) makes it sound as if this has been available since version 4.3.0

Lucas
  • 14,227
  • 9
  • 74
  • 124