Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-73282 Implement Portlet 3.0
  3. LPS-91247

Portlet 3.0: Make ServletContext to be injectable via @Inject

    Details

      Description

      This task involves developing a CDI producer that provides the ability to do the following in a bean portlet:

      TestPortlet.java
      public class TestPortlet {
      
      	@Inject
      	ServletContext _servletContext;
      
      	@RenderMethod(portletNames = { "portlet1" })
      	public String doRender() {
      		return "<hr/><p>servletContext=" + _servletContext + "</p>";
      	}
      }
      

      Steps to Verify:

      • Deploy the attached portlet WAR to $LIFERAY_HOME/deploy and add the portlet named "LPS-91247" to the portal page.

      Expected Results

      The portlet will render something similar to the following:

      LPS-91247 Test PASSED: servletContext=org.apache.catalina.core.ApplicationContextFacade@46f85464
      

        Attachments

          Activity

            People

            Assignee:
            shuyang.zhou Shuyang Zhou
            Reporter:
            neil.griffin Neil Griffin
            Recent user:
            Tomáš Polešovský
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 21 weeks, 4 days ago

                Packages

                Version Package
                7.1.X
                Master