本文整理汇总了Java中javax.portlet.PortletURL类的典型用法代码示例。如果您正苦于以下问题:Java PortletURL类的具体用法?Java PortletURL怎么用?Java PortletURL使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PortletURL类属于javax.portlet包,在下文中一共展示了PortletURL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateURLJsonObject
import javax.portlet.PortletURL; //导入依赖的package包/类
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;
}
示例2: add
import javax.portlet.PortletURL; //导入依赖的package包/类
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());
}
示例3: dossierDangkyAction
import javax.portlet.PortletURL; //导入依赖的package包/类
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());
}
示例4: doGetSummary
import javax.portlet.PortletURL; //导入依赖的package包/类
@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);
}
示例5: prepareRuntimePortlet
import javax.portlet.PortletURL; //导入依赖的package包/类
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});
}
}
}
示例6: getURLViewInContext
import javax.portlet.PortletURL; //导入依赖的package包/类
@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();
}
示例7: update
import javax.portlet.PortletURL; //导入依赖的package包/类
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());
}
示例8: publish
import javax.portlet.PortletURL; //导入依赖的package包/类
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());
}
示例9: reCalculate
import javax.portlet.PortletURL; //导入依赖的package包/类
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());
}
示例10: getURLEdit
import javax.portlet.PortletURL; //导入依赖的package包/类
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;
}
示例11: getURLAdd
import javax.portlet.PortletURL; //导入依赖的package包/类
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;
}
}
示例12: doGetSummary
import javax.portlet.PortletURL; //导入依赖的package包/类
@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);
}
示例13: loadAccessTokenOrRedirectToObtainIt
import javax.portlet.PortletURL; //导入依赖的package包/类
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;
}
示例14: getLinkForOffset
import javax.portlet.PortletURL; //导入依赖的package包/类
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;
}
示例15: resolveListViewRedirectPage
import javax.portlet.PortletURL; //导入依赖的package包/类
/**
* 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());
}
}