use of javax.portlet.PortletRequest in project uPortal by Jasig.
the class PersonLookupHelperImpl method getSelf.
/* (non-Javadoc)
* @see org.apereo.portal.portlets.lookup.IPersonLookupHelper#getSelf(org.springframework.webflow.context.ExternalContext)
*/
public IPersonAttributes getSelf(ExternalContext externalContext) {
final PortletRequest portletRequest = (PortletRequest) externalContext.getNativeRequest();
final String username = portletRequest.getRemoteUser();
return this.personAttributeDao.getPerson(username);
}
use of javax.portlet.PortletRequest in project uPortal by Jasig.
the class PersonLookupHelperImpl method getQueryAttributes.
/* (non-Javadoc)
* @see org.apereo.portal.portlets.swapper.IPersonLookupHelper#getQueryAttributes(org.springframework.webflow.context.ExternalContext)
*/
public Set<String> getQueryAttributes(ExternalContext externalContext) {
final PortletRequest portletRequest = (PortletRequest) externalContext.getNativeRequest();
final PortletPreferences preferences = portletRequest.getPreferences();
final Set<String> queryAttributes;
final String[] configuredAttributes = preferences.getValues(PERSON_LOOKUP_PERSON_LOOKUP_QUERY_ATTRIBUTES, null);
final String[] excludedAttributes = preferences.getValues(PERSON_LOOKUP_PERSON_LOOKUP_QUERY_ATTRIBUTES_EXCLUDES, null);
//If attributes are configured in portlet prefs just use them
if (configuredAttributes != null) {
queryAttributes = new LinkedHashSet<String>(Arrays.asList(configuredAttributes));
} else //Otherwise provide all available attributes from the IPersonAttributeDao
{
final Set<String> availableAttributes = this.personAttributeDao.getAvailableQueryAttributes();
queryAttributes = new TreeSet<String>(availableAttributes);
}
//Remove excluded attributes
if (excludedAttributes != null) {
for (final String excludedAttribute : excludedAttributes) {
queryAttributes.remove(excludedAttribute);
}
}
return queryAttributes;
}
use of javax.portlet.PortletRequest in project uPortal by Jasig.
the class PortletSessionExpirationManager method onEnd.
/* (non-Javadoc)
* @see org.apache.pluto.spi.optional.PortletInvocationListener#onEnd(org.apache.pluto.spi.optional.PortletInvocationEvent)
*/
@SuppressWarnings("unchecked")
public void onEnd(PortletInvocationEvent event) {
final PortletRequest portletRequest = event.getPortletRequest();
final PortletSession portletSession = portletRequest.getPortletSession(false);
if (portletSession == null) {
return;
}
final HttpServletRequest portalRequest = this.portalRequestUtils.getPortletHttpRequest(portletRequest);
final HttpSession portalSession = portalRequest.getSession();
if (portalSession != null) {
NonSerializableMapHolder<String, PortletSession> portletSessions;
synchronized (WebUtils.getSessionMutex(portalSession)) {
portletSessions = (NonSerializableMapHolder<String, PortletSession>) portalSession.getAttribute(PORTLET_SESSIONS_MAP);
if (portletSessions == null || !portletSessions.isValid()) {
portletSessions = new NonSerializableMapHolder(new ConcurrentHashMap<String, PortletSession>());
portalSession.setAttribute(PORTLET_SESSIONS_MAP, portletSessions);
}
}
final String contextPath = portletRequest.getContextPath();
portletSessions.put(contextPath, portletSession);
}
}
use of javax.portlet.PortletRequest in project uPortal by Jasig.
the class PortalWebUtils method currentRequestContextPath.
/**
* Get the request context path from the current request. Copes with both HttpServletRequest and
* PortletRequest and so usable when handling Spring-processed Servlet or Portlet requests.
* Requires that Spring have bound the request, as in the case of dispatcher servlet or portlet
* or when the binding filter or listener is active. This should be the case for all requests in
* the uPortal framework and framework portlets.
*
* @return request.getContextPath() for the relevant servlet or portlet request
* @throws IllegalStateException if the request is not Spring-bound or is neither Servlet nor
* Portlet flavored
*/
public static String currentRequestContextPath() {
final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (null == requestAttributes) {
throw new IllegalStateException("Request attributes are not bound. " + "Not operating in context of a Spring-processed Request?");
}
if (requestAttributes instanceof ServletRequestAttributes) {
final ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
final HttpServletRequest request = servletRequestAttributes.getRequest();
return request.getContextPath();
} else if (requestAttributes instanceof PortletRequestAttributes) {
final PortletRequestAttributes portletRequestAttributes = (PortletRequestAttributes) requestAttributes;
final PortletRequest request = portletRequestAttributes.getRequest();
return request.getContextPath();
} else {
throw new IllegalStateException("Request attributes are an unrecognized implementation.");
}
}
use of javax.portlet.PortletRequest in project uPortal by Jasig.
the class RuntimeMvcViewFactory method createMvcView.
/* (non-Javadoc)
* @see org.springframework.webflow.mvc.view.AbstractMvcViewFactory#createMvcView(org.springframework.web.servlet.View, org.springframework.webflow.execution.RequestContext)
*/
@Override
protected AbstractMvcView createMvcView(View view, RequestContext context) {
final ExternalContext externalContext = context.getExternalContext();
final Object nativeRequest = externalContext.getNativeRequest();
if (nativeRequest instanceof PortletRequest) {
return new PortletMvcView(view, context);
}
return new ServletMvcView(view, context);
}
Aggregations