Java 类javax.portlet.PortletURL 实例源码

项目:opencps-v2    文件:FrontendWebRegisterPortlet.java   
private JSONObject generateURLJsonObject(RenderResponse renderResponse)
    throws WindowStateException {

    JSONObject urlObject = JSONFactoryUtil.createJSONObject();

    PortletURL customerRegistrationsDetail = renderResponse.createRenderURL();
    customerRegistrationsDetail.setWindowState(LiferayWindowState.EXCLUSIVE);
    customerRegistrationsDetail.setParameter(
        "mvcPath", "/templates/registrations_detail.ftl");

    urlObject.put("registrations_detail", customerRegistrationsDetail);

    PortletURL customerRegistrationsMenu = renderResponse.createRenderURL();
    customerRegistrationsMenu.setWindowState(LiferayWindowState.EXCLUSIVE);
    customerRegistrationsMenu.setParameter(
        "mvcPath", "/templates/registrations_menu.ftl");

    urlObject.put("registrations_menu", customerRegistrationsMenu);

    return urlObject;
}
项目:arquillian-liferay    文件:SamplePortlet.java   
public void add(
    ActionRequest actionRequest, ActionResponse actionResponse) {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
        WebKeys.THEME_DISPLAY);

    int firstParameter = ParamUtil.getInteger(
        actionRequest, "firstParameter");
    int secondParameter = ParamUtil.getInteger(
        actionRequest, "secondParameter");

    int result = _sampleService.add(firstParameter, secondParameter);

    PortletURL portletURL = PortletURLFactoryUtil.create(
        actionRequest, "arquillian_sample_portlet", themeDisplay.getPlid(),
        PortletRequest.RENDER_PHASE);

    portletURL.setParameter(
        "firstParameter", String.valueOf(firstParameter));
    portletURL.setParameter(
        "secondParameter", String.valueOf(secondParameter));
    portletURL.setParameter("result", String.valueOf(result));

    actionRequest.setAttribute(WebKeys.REDIRECT, portletURL.toString());
}
项目:OEPv2    文件:DossierProcPortlet.java   
public void dossierDangkyAction(ActionRequest request,
        ActionResponse response) throws PortletException, IOException {
    ThemeDisplay themeDisplay = (ThemeDisplay) request
            .getAttribute(WebKeys.THEME_DISPLAY);
    String pageName = "/dichvucongtructuyen";
    String portletName = "oepeserviceregisteronline_WAR_oepeserviceportlet";
    String dossierProcId = ParamUtil
            .getString(request, "dossierProcId", "");
    long plid = 0L;
    try {
        plid = LayoutLocalServiceUtil.getFriendlyURLLayout(
                themeDisplay.getScopeGroupId(), false, pageName).getPlid();
    } catch (Exception e) {
        e.printStackTrace();
    }

    PortletURL redirectURL = PortletURLFactoryUtil.create(
            PortalUtil.getHttpServletRequest(request), portletName, plid,
            PortletRequest.RENDER_PHASE);
    redirectURL.setParameter("dossierProcId", dossierProcId); 
    redirectURL.setParameter("data", "This Value Comes From Welcome Page");
    response.sendRedirect(redirectURL.toString());

}
项目:govapps    文件:ApplicationIndexer.java   
@Override
protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL) throws Exception {
    _log.debug("doGetSummary()");
    String title = document.get(Field.TITLE);
    String content = snippet;
    if (Validator.isNull(snippet)) {
        content = document.get(Field.DESCRIPTION);
        if (Validator.isNull(content)) {
            content = StringUtil.shorten(document.get(Field.DESCRIPTION), 200);
        }
    }
       String resourcePrimKey = document.get(Field.ENTRY_CLASS_PK);

       portletURL.setParameter("jspPage", "/devel/view.jsp");
       portletURL.setParameter("resourcePrimKey", resourcePrimKey);

       return new Summary(title, content, portletURL);
}
项目:liferaylms-portlet    文件:LearningActivityBaseAssetRenderer.java   
private void prepareRuntimePortlet(PortletURL portletURL)
        throws SystemException, PortalException {
    if(_isRuntimePortlet){

        portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);

        PortletPreferencesFactoryUtil.getLayoutPortletSetup(_layout, _portletId);
        String resourcePrimKey = PortletPermissionUtil.getPrimaryKey(_layout.getPlid(), _portletId);
        String portletName = _portletId;

        int warSeparatorIndex = portletName.indexOf(PortletConstants.WAR_SEPARATOR);
        if (warSeparatorIndex != -1) {
            portletName = portletName.substring(0, warSeparatorIndex);
        }

        if ((ResourcePermissionLocalServiceUtil.getResourcePermissionsCount(
                _learningactivity.getCompanyId(), portletName,
                ResourceConstants.SCOPE_INDIVIDUAL, resourcePrimKey) == 0)&&
            (ResourceActionLocalServiceUtil.fetchResourceAction(portletName, ACTION_VIEW)!=null)) {
            Role siteMember = RoleLocalServiceUtil.getRole(_learningactivity.getCompanyId(),RoleConstants.SITE_MEMBER);
            ResourcePermissionLocalServiceUtil.setResourcePermissions(_learningactivity.getCompanyId(), portletName, ResourceConstants.SCOPE_INDIVIDUAL, 
                    resourcePrimKey,siteMember.getRoleId(), new String[]{ACTION_VIEW});
        }

    }
}
项目:liferaylms-portlet    文件:LearningActivityBaseAssetRenderer.java   
@Override
public final String getURLViewInContext(
        LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse,
        String noSuchEntryRedirect) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);
    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(_layout.getPlid(), _portletId, PortletRequest.RENDER_PHASE);
    portletURL.setParameter("actId",Long.toString( _learningactivity.getActId()));
    portletURL.setParameter("moduleId",Long.toString( _learningactivity.getModuleId()));
    portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
    portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
    portletURL.setParameter("actionEditingModule", StringPool.FALSE);
    portletURL.setParameter("actionCalifications", StringPool.FALSE);
    portletURL.setParameter("activityStarted", StringPool.TRUE);        

    String mvcPath = getMvcPathView(themeDisplay.getUserId(),liferayPortletResponse,liferayPortletRequest.getWindowState());
    if(Validator.isNotNull(mvcPath)){
        portletURL.setParameter("mvcPath",mvcPath);
    }

    prepareRuntimePortlet(portletURL);
    return portletURL.toString();
}
项目:liferaylms-portlet    文件:EvaluationActivity.java   
public void update(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception{

    LearningActivity learningActivity = LearningActivityLocalServiceUtil.getLearningActivity(ParamUtil.getLong(actionRequest, "actId"));

    Document document = SAXReaderUtil.read(learningActivity.getExtracontent());
    Element rootElement = document.getRootElement();

    Element firedDateElement = rootElement.element("firedDate");
    //if(firedDateElement==null){
        rootElement.addElement("firedDate").setText(_dateFormat.format(new Date()));
        learningActivity.setExtracontent(document.formattedString());
        LearningActivityLocalServiceUtil.updateLearningActivity(learningActivity);

        evaluate(learningActivity.getActId());
    //}

    PortletURL viewPortletURL = ((LiferayPortletResponse)actionResponse).createRenderURL();
    viewPortletURL.setParameter("jspPage","/html/evaluationtaskactivity/view.jsp"); 

    String returnToFullPageURL = actionRequest.getParameter("returnToFullPageURL");
    if(Validator.isNotNull(returnToFullPageURL)) {
        viewPortletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
    }

    actionResponse.sendRedirect(viewPortletURL.toString());
}
项目:liferaylms-portlet    文件:EvaluationActivity.java   
public void publish(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception{

    LearningActivity learningActivity = LearningActivityLocalServiceUtil.getLearningActivity(ParamUtil.getLong(actionRequest, "actId"));

    Document document = SAXReaderUtil.read(learningActivity.getExtracontent());
    Element rootElement = document.getRootElement();

    Element publishDate = rootElement.element("publishDate");
    if(publishDate==null){
        rootElement.addElement("publishDate").setText(_dateFormat.format(new Date()));
    }
    learningActivity.setExtracontent(document.formattedString());
    LearningActivityLocalServiceUtil.updateLearningActivity(learningActivity);


    PortletURL viewPortletURL = ((LiferayPortletResponse)actionResponse).createRenderURL();
    viewPortletURL.setParameter("jspPage","/html/evaluationtaskactivity/view.jsp");

    String returnToFullPageURL = actionRequest.getParameter("returnToFullPageURL");
    if(Validator.isNotNull(returnToFullPageURL)) {
        viewPortletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
    }

    actionResponse.sendRedirect(viewPortletURL.toString());
}
项目:liferaylms-portlet    文件:EvaluationActivity.java   
public void reCalculate(ActionRequest actionRequest,ActionResponse actionResponse) throws Exception{

        long userId = ParamUtil.getLong(actionRequest, "userId");

        if(userId==0){
            SessionErrors.add(actionRequest, "evaluationtaskactivity.reCalculate.userId");          
        }
        else{
            LearningActivity learningActivity = LearningActivityLocalServiceUtil.getLearningActivity(ParamUtil.getLong(actionRequest, "actId"));
            evaluateUser(learningActivity.getActId(), userId, getLearningActivities(learningActivity));     
            SessionMessages.add(actionRequest, "evaluationtaskactivity.reCalculate.ok");
        }

        PortletURL viewPortletURL = ((LiferayPortletResponse)actionResponse).createRenderURL();
        viewPortletURL.setParameter("jspPage","/html/evaluationtaskactivity/view.jsp");

        String returnToFullPageURL = actionRequest.getParameter("returnToFullPageURL");
        if(Validator.isNotNull(returnToFullPageURL)) {
            viewPortletURL.setParameter("returnToFullPageURL", returnToFullPageURL);
        }

        actionResponse.sendRedirect(viewPortletURL.toString());
    }
项目:liferaylms-portlet    文件:TaskAssetRenderer.java   
public PortletURL getURLEdit(
        LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse) throws Exception 
{

    _log.debug("getURLEdit: entrada");

    HttpServletRequest request = liferayPortletRequest.getHttpServletRequest();
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
    PortletURL portletURL = liferayPortletResponse.createRenderURL("taskactivity_WAR_liferaylmsportlet");
    portletURL.setParameter("mvcPath", "/html/taskactivity/admin/edit.jsp");
    portletURL.setParameter("jspPage", "/html/taskactivity/admin/edit.jsp");
    portletURL.setParameter("actId", Long.toString(_learningactivity.getActId()));

    _log.debug("getURLEdit: "+portletURL.toString());
    return portletURL;

}
项目:liferaylms-portlet    文件:CourseAssetRendererFactory.java   
public PortletURL getURLAdd(LiferayPortletRequest liferayPortletRequest, LiferayPortletResponse liferayPortletResponse){
ThemeDisplay themeDisplay = (ThemeDisplay)liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);

try {
    if(!themeDisplay.getPermissionChecker().
            hasPermission(themeDisplay.getScopeGroupId(), "com.liferay.lms.coursemodel",themeDisplay.getScopeGroupId(),"ADD_COURSE")){
        return null;
    }

        PortletURL portletURL = PortletURLFactoryUtil.create(liferayPortletRequest,PORTLET_ID,getControlPanelPlid(themeDisplay),PortletRequest.RENDER_PHASE);
        portletURL.setParameter("mvcPath", "/html/courseadmin/editcourse.jsp");
    return portletURL;

}
catch(Throwable t) {
    return null;
}

  }
项目:liferaylms-portlet    文件:CourseIndexer.java   
@Override
protected Summary doGetSummary(Document document, Locale locale, String snippet,
        PortletURL portletURL) throws Exception {

    if(log.isDebugEnabled())log.debug("doGetSummary");

    String title = document.get(locale, Field.TITLE);

    String content = snippet;

    if (Validator.isNull(snippet)) {
        content = StringUtil.shorten(
            document.get(locale, Field.CONTENT), 200);
    }

    return new Summary(title, content, portletURL);
}
项目:docs-samples    文件:OAuthPortletFilter.java   
protected AccessToken loadAccessTokenOrRedirectToObtainIt(String username, OAuthProvider oauthProvider,
        RenderRequest request, RenderResponse response) throws IOException, PortletException {
    // Try requestContext first. Otherwise obtain OAuthProvider via API
    AccessToken accessToken = requestContext.getAccessToken(oauthProviderKey);
    if (accessToken == null) {
        accessToken = oauthProvider.loadAccessToken(username);
    }

    if (accessToken == null) {
        // Will be processed by method AbstractSocialPortlet.actionRedirectToOAuthFlow
        PortletURL actionURL = response.createActionURL();
        actionURL.setParameter(ActionRequest.ACTION_NAME, AbstractSocialPortlet.ACTION_OAUTH_REDIRECT);

        request.setAttribute(ATTRIBUTE_ERROR_MESSAGE, oauthProvider.getFriendlyName()
                + " access token not available for you.");
        request.setAttribute(ATTRIBUTE_OAUTH_PROVIDER, oauthProvider);
        PortletRequestDispatcher prd = filterConfig.getPortletContext().getRequestDispatcher("/jsp/error/token.jsp");
        prd.include(request, response);
    }

    return accessToken;
}
项目:concourseconnect-community    文件:PagedListInfo.java   
public String getLinkForOffset(int newOffset, RenderResponse response) {
  String thisLink;
  if (response == null) {
    thisLink = addParameter(link, "pagedListInfoId", String.valueOf(this.getId())) +
        (getExpandedSelection() ? "&pagedListSectionId=" + this.getId() : "") +
        "&offset=" + (newOffset > 0 ? newOffset : 0);
  } else {
    PortletURL renderURL = response.createRenderURL();
    Map<String, String[]> params;
    if (renderParameters == null) {
      params = new HashMap<String, String[]>();
    } else {
      params = new HashMap<String, String[]>(renderParameters);
    }
    params.put("pagedListInfoId", new String[]{this.getId()});
    params.put("pagedListSectionId", new String[]{this.getId()});
    params.put("offset", new String[]{String.valueOf(newOffset > 0 ? newOffset : 0)});
    params.put("page", new String[]{String.valueOf(newOffset > 0 ? newOffset % 10 : 0)});
    renderURL.setParameters(params);
    thisLink = renderURL.toString();
  }
  return thisLink;
}
项目:edemocracia    文件:ChatRoomPortlet.java   
/**
 * Verifica se a comunidade atual possui alguma página com o portlet de
 * todas as comunidades. Se encontrar alguma, faz o redirect para a página.
 * Se não encontrar envia para a página de listagem padrão onde são exibidas
 * somente as salas da comunidade atual.
 * 
 * @throws SystemException
 * @throws PortalException
 * @throws IOException
 * 
 */
private void resolveListViewRedirectPage(ActionRequest req, ActionResponse rsp) throws PortalException, SystemException, IOException {
    ThemeDisplay td = (ThemeDisplay) req.getAttribute(WebKeys.THEME_DISPLAY);
    long plid = PortalUtil.getPlidFromPortletId(td.getScopeGroupId(), CD_CHAT_ROOM_COMPLETE_LIST_PORTLET_ID);

    if (plid != LayoutConstants.DEFAULT_PLID) {
        PortletURL portletURL = PortletURLFactoryUtil.create(req, CD_CHAT_ROOM_COMPLETE_LIST_PORTLET_ID, plid, PortletRequest.ACTION_PHASE);
        portletURL.setParameter("javax.portlet.action", "listChatRooms");
        portletURL.setParameter("p_p_lifecycle", "1");

        String url = portletURL.toString();

        rsp.sendRedirect(url);
    } else {
        rsp.setRenderParameter(ChatPortletConstants.VIEW_PARAM, ChatRoomView.LIST.getUrlParamValue());
    }
}
项目:edemocracia    文件:RedirecionaSalasPortalBean.java   
private String montarlinkParaSala(Long roomId, String lifecycle, String parameterKey, String parameterValue, String parameter_p_p_LifeCycle) {
    String url = StringPool.BLANK;
    try {
        ChatRoom chatRoom = ChatRoomLocalServiceUtil.getChatRoom(roomId);
        long groupId = chatRoom.getGroupId();
        long plid = PortalUtil.getPlidFromPortletId(groupId, CD_CHAT_ROOM_PORTLET_ID);
        if (plid != LayoutConstants.DEFAULT_PLID) {
            PortletRequest request = (PortletRequest) LiferayFacesContext.getInstance().getExternalContext().getRequest();
            PortletURL portletURL = PortletURLFactoryUtil.create(request, CD_CHAT_ROOM_PORTLET_ID, plid, lifecycle);
            portletURL.setParameter(parameterKey, parameterValue);
            portletURL.setParameter("roomId", roomId.toString());
            portletURL.setParameter("p_p_lifecycle", parameter_p_p_LifeCycle);

            url = portletURL.toString();
            // LiferayFacesContext.getInstance().getExternalContext().redirect(url);
            // // colocar quando sair nova versão do bridge jsf do liferay
            // (stateless)
            LinkSalasCacheUtil.setLinkEntrar(roomId, url);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return url;
}
项目:edemocracia    文件:EditPage.java   
public EditPage() {

        // Obtém a página de visualização
        RenderResponse rRes = UIUtils.getRenderResponse();
        PortletURL pURL = rRes.createRenderURL();
        try {
            pURL.setPortletMode(PortletMode.VIEW);
        } catch (PortletModeException e) {
        }
        viewUrl = pURL.toString();

        PortletPreferences pp = UIUtils.getPortletPreferences();

        initFeedbackPanel();
        initForm();
        initMensagem(pp);
        initUrl(pp);
        initVoltar();
    }
项目:arquillian-extension-liferay    文件:SamplePortlet.java   
public void add(
    ActionRequest actionRequest, ActionResponse actionResponse) {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
        WebKeys.THEME_DISPLAY);

    int firstParameter = ParamUtil.getInteger(
        actionRequest, "firstParameter");
    int secondParameter = ParamUtil.getInteger(
        actionRequest, "secondParameter");

    int result = _sampleService.add(firstParameter, secondParameter);

    PortletURL portletURL = PortletURLFactoryUtil.create(
        actionRequest, "arquillian_sample_portlet", themeDisplay.getPlid(),
        PortletRequest.RENDER_PHASE);

    portletURL.setParameter(
        "firstParameter", String.valueOf(firstParameter));
    portletURL.setParameter(
        "secondParameter", String.valueOf(secondParameter));
    portletURL.setParameter("result", String.valueOf(result));

    actionRequest.setAttribute(WebKeys.REDIRECT, portletURL.toString());
}
项目:jukebox-portlet    文件:AlbumSearch.java   
public AlbumSearch(
    PortletRequest portletRequest, int delta, PortletURL iteratorURL) {

    super(
        portletRequest, new AlbumDisplayTerms(portletRequest),
        new AlbumSearchTerms(portletRequest), DEFAULT_CUR_PARAM, delta,
        iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);

    AlbumDisplayTerms displayTerms = (AlbumDisplayTerms)getDisplayTerms();

    iteratorURL.setParameter(
        AlbumDisplayTerms.ARTIST, displayTerms.getTitle());
    iteratorURL.setParameter(
        AlbumDisplayTerms.TITLE, displayTerms.getTitle());
    iteratorURL.setParameter(
        AlbumDisplayTerms.YEAR, String.valueOf(displayTerms.getYear()));
}
项目:jukebox-portlet    文件:SongSearch.java   
public SongSearch(
    PortletRequest portletRequest, int delta, PortletURL iteratorURL) {

    super(
        portletRequest, new SongDisplayTerms(portletRequest),
        new SongSearchTerms(portletRequest), DEFAULT_CUR_PARAM, delta,
        iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);

    SongDisplayTerms displayTerms = (SongDisplayTerms)getDisplayTerms();

    iteratorURL.setParameter(
        SongDisplayTerms.ALBUM, displayTerms.getAlbum());
    iteratorURL.setParameter(
        SongDisplayTerms.ARTIST, displayTerms.getArtist());
    iteratorURL.setParameter(
        SongDisplayTerms.TITLE, displayTerms.getTitle());
}
项目:jukebox-portlet    文件:ArtistAssetRenderer.java   
@Override
public PortletURL getURLEdit(
        LiferayPortletRequest liferayPortletRequest,
        LiferayPortletResponse liferayPortletResponse)
    throws Exception {

    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(
        getControlPanelPlid(liferayPortletRequest),
        ArtistsPortlet.PORTLET_ID, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("jspPage", "/html/artists/edit_artist.jsp");
    portletURL.setParameter(
        "artistId", String.valueOf(_artist.getArtistId()));

    return portletURL;
}
项目:jukebox-portlet    文件:ArtistAssetRenderer.java   
@Override
public PortletURL getURLView(
        LiferayPortletResponse liferayPortletResponse,
        WindowState windowState)
    throws Exception {

    PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(
        ArtistsPortlet.PORTLET_ID, PortletRequest.RENDER_PHASE);

    portletURL.setParameter("jspPage", "/html/artists/view_artist.jsp");
    portletURL.setParameter(
        "artistId", String.valueOf(_artist.getArtistId()));
    portletURL.setWindowState(windowState);

    return portletURL;
}
项目:reverse-web-proxy-portlet    文件:ReverseProxyIFramePortlet.java   
@Override
public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException {

  response.setContentType("text/html");

  PortletPreferences prefs = request.getPreferences();
  Map<String, String[]> map = prefs.getMap();
  Map<String, String> prefsMap = new HashMap<>();
  for (String key : map.keySet()) {
    String[] prefValue = map.get(key);
    prefsMap.put(key, prefValue == null || prefValue[0] == null ? "" : prefValue[0]);
  }
  request.setAttribute("prefs", prefsMap);

  PortletURL editPrefsURL = response.createActionURL();
  editPrefsURL.setParameter("action", "editPrefs");
  request.setAttribute("actionURL", editPrefsURL.toString());

  forward(editJsp, request, response);
}
项目:portals-pluto    文件:PortletTests_EventPortlet_ApiEvent.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp)
      throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   PrintWriter writer = portletResp.getWriter();

   /* TestCase: V2PortletTests_EventPortlet_ApiEvent_processEvent */
   /* Details: "Method processEvent(EventRequest, EventResponse): is */
   /* called when an event is targeted to the portlet" */
   {
      PortletURL aurl = portletResp.createActionURL();
      aurl.setParameters(portletReq.getPrivateParameterMap());
      TestButton tb = new TestButton(
            V2PORTLETTESTS_EVENTPORTLET_APIEVENT_PROCESSEVENT, aurl);
      tb.writeTo(writer);
   }

}
项目:portals-pluto    文件:AddlFilterTests_SPEC2_20_Render.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp)
    throws PortletException, IOException {

  long tid = Thread.currentThread().getId();
  portletReq.setAttribute(THREADID_ATTR, tid);

  PrintWriter writer = portletResp.getWriter();

  // Create result objects for the tests

  /* TestCase: V2AddlFilterTests_SPEC2_20_Render_filterWrapper5 */
  /* Details: "An RENDER_PHASE filter can wrap the RenderRequest object */
  /* with a custom wrapper" */
  PortletURL rurl = portletResp.createActionURL();
  TestLink tl = new TestLink(V2ADDLFILTERTESTS_SPEC2_20_RENDER_FILTERWRAPPER5, rurl);
  tl.writeTo(writer);
}
项目:portals-pluto    文件:DispatcherTests_SPEC2_19_IncludeServletEvent_event.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   portletResp.setContentType("text/html");
   PrintWriter writer = portletResp.getWriter();
   writer.write("<h3>Event Companion Portlet </h3>\n");
   writer.write("<p>DispatcherTests_SPEC2_19_IncludeServletEvent_event</p>\n");

   String msg = (String) portletReq.getPortletSession().getAttribute(
         RESULT_ATTR_PREFIX + "DispatcherTests_SPEC2_19_IncludeServletEvent", APPLICATION_SCOPE);
   msg = (msg == null) ? "Not ready. click test case link." : msg;
   writer.write("<p>" + msg + "</p>\n");

   PortletURL rurl = portletResp.createRenderURL();
   rurl.setParameter("qparm2", "renderVal2");
   TestSetupLink tl1 = new TestSetupLink(V2DISPATCHERTESTS_SPEC2_19_INCLUDESERVLETEVENT_DISPATCH2, rurl);
   tl1.writeTo(writer);

}
项目:portals-pluto    文件:DispatcherTests_SPEC2_19_ForwardServletEvent_event.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   portletResp.setContentType("text/html");
   PrintWriter writer = portletResp.getWriter();
   writer.write("<h3>Event Companion Portlet </h3>\n");
   writer.write("<p>DispatcherTests_SPEC2_19_ForwardServletEvent_event</p>\n");

   String msg = (String) portletReq.getPortletSession().getAttribute(
         RESULT_ATTR_PREFIX + "DispatcherTests_SPEC2_19_ForwardServletEvent", APPLICATION_SCOPE);
   msg = (msg == null) ? "Not ready. click test case link." : msg;
   writer.write("<p>" + msg + "</p>\n");

   PortletURL rurl = portletResp.createRenderURL();
   rurl.setParameter("qparm2", "renderVal2");
   TestSetupLink tl1 = new TestSetupLink(V2DISPATCHERTESTS_SPEC2_19_FORWARDSERVLETEVENT_DISPATCH2, rurl);
   tl1.writeTo(writer);

}
项目:portals-pluto    文件:DispatcherTests2_SPEC2_19_IncludeJSPEvent_event.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   portletResp.setContentType("text/html");
   PrintWriter writer = portletResp.getWriter();
   writer.write("<h3>Event Companion Portlet </h3>\n");
   writer.write("<p>DispatcherTests2_SPEC2_19_IncludeJSPEvent_event</p>\n");

   String msg = (String) portletReq.getPortletSession().getAttribute(
         RESULT_ATTR_PREFIX + "DispatcherTests2_SPEC2_19_IncludeJSPEvent", APPLICATION_SCOPE);
   msg = (msg == null) ? "Not ready. click test case link." : msg;
   writer.write("<p>" + msg + "</p>\n");

   /* TestCase: V2DispatcherTests2_SPEC2_19_IncludeJSPEvent_dispatch2 */
   /* Details: "Parameters specified in the query strings must be */
   /* aggregated with the portlet render parameters" */
   PortletURL urlEvent = ((MimeResponse) portletResp).createRenderURL();
   urlEvent.setParameter("qparm2", "renderVal2");
   TestSetupLink tlEvent = new TestSetupLink(V2DISPATCHERTESTS2_SPEC2_19_INCLUDEJSPEVENT_DISPATCH2, urlEvent);
   tlEvent.writeTo(writer);

}
项目:portals-pluto    文件:DispatcherTests2_SPEC2_19_ForwardJSPEvent_event.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   portletResp.setContentType("text/html");
   PrintWriter writer = portletResp.getWriter();
   writer.write("<h3>Event Companion Portlet </h3>\n");
   writer.write("<p>DispatcherTests2_SPEC2_19_ForwardJSPEvent_event</p>\n");

   String msg = (String) portletReq.getPortletSession().getAttribute(
         RESULT_ATTR_PREFIX + "DispatcherTests2_SPEC2_19_ForwardJSPEvent", APPLICATION_SCOPE);
   msg = (msg == null) ? "Not ready. click test case link." : msg;
   writer.write("<p>" + msg + "</p>\n");

   /* TestCase: V2DispatcherTests2_SPEC2_19_ForwardJSPEvent_dispatch2 */
   /* Details: "Parameters specified in the query strings must be */
   /* aggregated with the portlet render parameters" */
   PortletURL urlEvent = ((MimeResponse) portletResp).createRenderURL();
   urlEvent.setParameter("qparm2", "renderVal2");
   TestSetupLink tlEvent = new TestSetupLink(V2DISPATCHERTESTS2_SPEC2_19_FORWARDJSPEVENT_DISPATCH2, urlEvent);
   tlEvent.writeTo(writer);

}
项目:portals-pluto    文件:DispatcherTests4_SPEC2_19_ForwardServletEvent.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   PrintWriter writer = portletResp.getWriter();

   /* TestCase: V2DispatcherTests4_SPEC2_19_ForwardServletEvent_invoke3 */
   /* Details: "Parameters to the forward method for a target servlet */
   /* can be wrapped request and response classes from the portlet */
   /* lifecyle method initiating the include" */
   {
      PortletURL aurl = portletResp.createActionURL();
      aurl.setParameters(portletReq.getPrivateParameterMap());
      TestButton tb = new TestButton(V2DISPATCHERTESTS4_SPEC2_19_FORWARDSERVLETEVENT_INVOKE3, aurl);
      tb.writeTo(writer);
   }

}
项目:portals-pluto    文件:DispatcherTests4_SPEC2_19_ForwardJSPEvent.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   PrintWriter writer = portletResp.getWriter();

   /* TestCase: V2DispatcherTests4_SPEC2_19_ForwardJSPEvent_invoke3 */
   /* Details: "Parameters to the forward method for a target servlet */
   /* can be wrapped request and response classes from the portlet */
   /* lifecyle method initiating the include" */
   {
      PortletURL aurl = portletResp.createActionURL();
      aurl.setParameters(portletReq.getPrivateParameterMap());
      TestButton tb = new TestButton(V2DISPATCHERTESTS4_SPEC2_19_FORWARDJSPEVENT_INVOKE3, aurl);
      tb.writeTo(writer);
   }

}
项目:portals-pluto    文件:NameBean.java   
/**
 * writes the action form as string. This method is placed within the bean 
 * to allow easier access to form state data, which might be part of the bean
 * state, but not part of the bean public API.  
 * 
 * @return the action form as string
 */
@RenderMethod(portletNames = {"BeanPortlet"}, ordinal=200)
public String getActionForm() {
   StringBuilder txt = new StringBuilder(128);

   PortletURL aurl = mimeresp.createActionURL(Copy.ALL);
   txt.append("<FORM id='").append(pid).append("-setParams' METHOD='POST' ACTION='").append(aurl);
   txt.append("' enctype='application/x-www-form-urlencoded' accept-charset='UTF-8'>");
   txt.append("   <table><tr><td align='left'>");
   txt.append("   Enter your name:");
   txt.append("   </td><td>");
   txt.append("   <input name='").append(PARAM_NAME);
   txt.append("' type='text' value='").append((name == null) ? "" : name);
   txt.append("' size='50' maxlength='50'>");
   txt.append("   <input type='hidden' name='").append(ActionRequest.ACTION_NAME);
   txt.append("' value='setName'>");
   txt.append("   </td></tr><tr><td>");
   txt.append("   <INPUT VALUE='send' TYPE='submit'>");
   txt.append("   </td></tr></table>");
   txt.append("</FORM>");

   return txt.toString();
}
项目:portals-pluto    文件:AddlPortletTests_SPEC2_15_Event.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp)
    throws PortletException, IOException {

  long tid = Thread.currentThread().getId();
  portletReq.setAttribute(THREADID_ATTR, tid);

  PrintWriter writer = portletResp.getWriter();

  /* TestCase: V2AddlPortletTests_SPEC2_15_Event_event1 */
  /* Details: "Event names are defined in the deployment descriptor" */
  {
    PortletURL aurl = portletResp.createActionURL();
    aurl.setParameters(portletReq.getPrivateParameterMap());
    TestButton tb = new TestButton(V2ADDLPORTLETTESTS_SPEC2_15_EVENT_EVENT1, aurl);
    tb.writeTo(writer);
  }

}
项目:portals-pluto    文件:DispatcherTests3S_SPEC2_19_ForwardServletResource_servlet.java   
protected void processTCKReq(HttpServletRequest request, HttpServletResponse response) throws ServletException,
      IOException {

   PortletRequest portletReq = (PortletRequest) request.getAttribute("javax.portlet.request");
   PortletResponse portletResp = (PortletResponse) request.getAttribute("javax.portlet.response");
   request.getAttribute("javax.portlet.config");
   Thread.currentThread().getId();
   portletReq.getAttribute(THREADID_ATTR);

   PrintWriter writer = ((MimeResponse) portletResp).getWriter();

   // Create result objects for the tests

   PortletURL purl = ((MimeResponse) portletResp).createRenderURL();
   TestLink tl = new TestLink(V2DISPATCHERTESTS3S_SPEC2_19_FORWARDSERVLETRESOURCE_DISPATCH4, purl);
   tl.writeTo(writer);

}
项目:portals-pluto    文件:DispatcherTests3S_SPEC2_19_IncludeServletAction.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   PrintWriter writer = portletResp.getWriter();

   PortletSession ps = portletReq.getPortletSession();
   String msg = (String) ps.getAttribute(RESULT_ATTR_PREFIX + V2DISPATCHERTESTS3S_SPEC2_19_INCLUDESERVLETACTION_DISPATCH4);
   if (msg != null) {
      writer.write("<p>" + msg + "</p><br/>\n");
      ps.removeAttribute(RESULT_ATTR_PREFIX + V2DISPATCHERTESTS3S_SPEC2_19_INCLUDESERVLETACTION_DISPATCH4);
   }

   /* TestCase: V2DispatcherTests3S_SPEC2_19_IncludeServletAction_dispatch4 */
   /* Details: "The parameters associated with a request dispatcher are */
   /* scoped only for the duration of the include or forward call" */
   {
      PortletURL aurl = portletResp.createActionURL();
      aurl.setParameters(portletReq.getPrivateParameterMap());
      TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_INCLUDESERVLETACTION_DISPATCH4, aurl);
      tb.writeTo(writer);
   }

}
项目:portals-pluto    文件:DispatcherTests3S_SPEC2_19_IncludeJSPEvent.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   PrintWriter writer = portletResp.getWriter();

   /* TestCase: V2DispatcherTests3S_SPEC2_19_IncludeJSPEvent_dispatch4 */
   /* Details: "The parameters associated with a request dispatcher are */
   /* scoped only for the duration of the include or forward call" */
   {
      PortletURL aurl = portletResp.createActionURL();
      aurl.setParameters(portletReq.getPrivateParameterMap());
      TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_INCLUDEJSPEVENT_DISPATCH4, aurl);
      tb.writeTo(writer);
   }

}
项目:portals-pluto    文件:DispatcherTests3S_SPEC2_19_ForwardJSPEvent.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   PrintWriter writer = portletResp.getWriter();

   /* TestCase: V2DispatcherTests3S_SPEC2_19_ForwardJSPEvent_dispatch4 */
   /* Details: "The parameters associated with a request dispatcher are */
   /* scoped only for the duration of the include or forward call" */
   {
      PortletURL aurl = portletResp.createActionURL();
      aurl.setParameters(portletReq.getPrivateParameterMap());
      TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_FORWARDJSPEVENT_DISPATCH4, aurl);
      tb.writeTo(writer);
   }

}
项目:portals-pluto    文件:DispatcherTests3S_SPEC2_19_IncludeServletEvent.java   
@Override
public void render(RenderRequest portletReq, RenderResponse portletResp) throws PortletException, IOException {

   long tid = Thread.currentThread().getId();
   portletReq.setAttribute(THREADID_ATTR, tid);

   PrintWriter writer = portletResp.getWriter();

   /* TestCase: V2DispatcherTests3S_SPEC2_19_IncludeServletEvent_dispatch4 */
   /* Details: "The parameters associated with a request dispatcher are */
   /* scoped only for the duration of the include or forward call" */
   {
      PortletURL aurl = portletResp.createActionURL();
      aurl.setParameters(portletReq.getPrivateParameterMap());
      TestButton tb = new TestButton(V2DISPATCHERTESTS3S_SPEC2_19_INCLUDESERVLETEVENT_DISPATCH4, aurl);
      tb.writeTo(writer);
   }

}
项目:flashlight-search    文件:JournalArticleSearchResultProcessor.java   
/**
 * Gets the search result's view URL
 *
 * @param document The searched document
 * @param request The request
 * @param response The response
 * @param currentLayout The current page
 * @param tabId The search tab ID
 *
 * @return The search result URL
 */
private String getAssetViewURL(Document document, PortletRequest request, PortletResponse response, Layout currentLayout, String tabId, String keywords) {
    String className = document.get(Field.ENTRY_CLASS_NAME);
    long classPK = GetterUtil.getLong(document.get(Field.ENTRY_CLASS_PK));
    String currentUrl = this.portal.getCurrentURL(request);
    String returnedUrl;

    if(ASSET_TYPE.equals(className) && classPK > 0) {
        try {
            String portletId = (String) request.getAttribute(WebKeys.PORTLET_ID);
            PortletURL viewInPortletUrlObj = this.portletUrlFactory.create(request, portletId, currentLayout, LIFECYCLE_RENDER);
            viewInPortletUrlObj.setParameter(PortletRequestParameter.VIEW_MODE.getName(), ViewMode.VIEW_JOURNAL.getParamValue());
            viewInPortletUrlObj.setParameter(Field.ENTRY_CLASS_PK, Long.toString(classPK));
            viewInPortletUrlObj.setParameter(PortletRequestParameter.TAB_ID.getName(), tabId);
            viewInPortletUrlObj.setParameter(PortletRequestParameter.KEYWORDS.getName(), keywords);
            String viewInPortletUrl = viewInPortletUrlObj.toString();

            AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(className);
            AssetRenderer<?> assetRenderer = assetRendererFactory.getAssetRenderer(classPK);
            returnedUrl = assetRenderer.getURLViewInContext((LiferayPortletRequest) request, (LiferayPortletResponse) response, viewInPortletUrl);
        } catch(Exception e) {
            returnedUrl = currentUrl;
        }
    } else {
        returnedUrl = currentUrl;
    }

    return returnedUrl;
}
项目:opencps-v2    文件:LookupDossierResult.java   
@Override
public void render(
    RenderRequest renderRequest, RenderResponse renderResponse)
    throws IOException, PortletException {

    ThemeDisplay themeDisplay =
        (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
    PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
    String portletId = portletDisplay.getId();

    JSONObject urlObject = JSONFactoryUtil.createJSONObject();
    JSONObject apiObject = JSONFactoryUtil.createJSONObject();

    // url
    PortletURL dossierInfoURL = PortletURLFactoryUtil.create(
        renderRequest, portletId, themeDisplay.getPlid(),
        PortletRequest.RENDER_PHASE);

    dossierInfoURL.setPortletMode(PortletMode.VIEW);
    dossierInfoURL.setWindowState(LiferayWindowState.EXCLUSIVE);
    dossierInfoURL.setParameter(
        "mvcPath", "/templates/lookup_dossier/dossierinfo.ftl");

    urlObject.put("dossierinfo", dossierInfoURL.toString());

    // api
    apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2");
    apiObject.put(
        "portletNamespace",
        themeDisplay.getPortletDisplay().getNamespace());

    // set varible
    renderRequest.setAttribute("ajax", urlObject);
    renderRequest.setAttribute("api", apiObject);

    super.render(renderRequest, renderResponse);

}