Example usage for com.liferay.portal.kernel.service ServiceContext getCurrentURL

List of usage examples for com.liferay.portal.kernel.service ServiceContext getCurrentURL

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service ServiceContext getCurrentURL.

Prototype

public String getCurrentURL() 

Source Link

Document

Returns the current URL of this service context

Usage

From source file:com.liferay.calendar.web.internal.social.CalendarActivityInterpreter.java

License:Open Source License

@Override
protected String getPath(SocialActivity activity, ServiceContext serviceContext) throws Exception {

    long plid = _portal.getPlidFromPortletId(serviceContext.getScopeGroupId(), CalendarPortletKeys.CALENDAR);

    PortletURL portletURL = PortletURLFactoryUtil.create(serviceContext.getRequest(),
            CalendarPortletKeys.CALENDAR, plid, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("mvcPath", "/view_calendar_booking.jsp");
    portletURL.setParameter("backURL", serviceContext.getCurrentURL());
    portletURL.setParameter("calendarBookingId", String.valueOf(activity.getClassPK()));

    return portletURL.toString();
}

From source file:com.liferay.exportimport.internal.notifications.ExportImportUserNotificationHandler.java

License:Open Source License

@Override
protected String getLink(UserNotificationEvent userNotificationEvent, ServiceContext serviceContext)
        throws Exception {

    PortletURL renderURL = PortletURLFactoryUtil.create(serviceContext.getRequest(),
            ExportImportPortletKeys.EXPORT_IMPORT, PortletRequest.RENDER_PHASE);

    renderURL.setParameter("mvcPath", "/view_export_import.jsp");

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload());

    long backgroundTaskId = jsonObject.getLong("backgroundTaskId");

    BackgroundTask backgroundTask = _backgroundTaskLocalService.fetchBackgroundTask(backgroundTaskId);

    if (backgroundTask == null) {
        return StringPool.BLANK;
    }//  www.  j a v a 2 s  . c  om

    renderURL.setParameter("backgroundTaskId", String.valueOf(backgroundTaskId));

    renderURL.setParameter("backURL", serviceContext.getCurrentURL());

    return renderURL.toString();
}

From source file:com.liferay.invitation.invite.members.service.impl.MemberRequestLocalServiceImpl.java

License:Open Source License

protected String getRedirectURL(ServiceContext serviceContext) {
    String redirectURL = (String) serviceContext.getAttribute("redirectURL");

    if (Validator.isNull(redirectURL)) {
        redirectURL = serviceContext.getCurrentURL();
    }//from  w  w  w.  j  a va  2  s.co m

    return redirectURL;
}