How to access PortalRequestContext object in EPP

Solution Unverified - Updated -

Issue

  • How to access the PortalRequestContext from a FilterServlet and from a HTTPServlet. For instance, if a customer is interested in fetching the siteName.

  • Error when trying to access PortalRequestContext to fetch the siteName.

WARN  [SetCurrentIdentityFilter] An error occured while cache user profile
java.lang.NullPointerException
    at org.exoplatform.portal.webui.util.Util.getPortalRequestContext(Util.java:53)
    at filters.TestFilter.doFilter(TestFilter.java:43)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

Code snippet used to fetch is similar to -

    PortalRequestContext context = Util.getPortalRequestContext();
//  String remUser = context.getRemoteUser();
//        String siteName = context.getSiteName();
//   System.out.println("Site Name is:" +siteName);
    String requestParam = context.getRequestParameter("requestParameter");

and the entry in web.xml has

 <filter>
           <filter-name>TestFilter</filter-name>
           <filter-class>filters.TestFilter</filter-class>
      </filter>
      <filter-mapping>
           <filter-name>TestFilter</filter-name>
           <url-pattern>/abc</url-pattern>
      </filter-mapping>

Environment

  • JBoss Enterprise Portal Platform (EPP)
    • 5.2.0
    • 6.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.