本文整理汇总了Java中com.liferay.portlet.PortletURLFactoryUtil类的典型用法代码示例。如果您正苦于以下问题:Java PortletURLFactoryUtil类的具体用法?Java PortletURLFactoryUtil怎么用?Java PortletURLFactoryUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PortletURLFactoryUtil类属于com.liferay.portlet包,在下文中一共展示了PortletURLFactoryUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: dossierDangkyAction
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的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());
}
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:25,代码来源:DossierProcPortlet.java
示例2: getURLAdd
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的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;
}
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:20,代码来源:CourseAssetRendererFactory.java
示例3: resolveListViewRedirectPage
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的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());
}
}
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:28,代码来源:ChatRoomPortlet.java
示例4: montarlinkParaSala
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
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;
}
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:25,代码来源:RedirecionaSalasPortalBean.java
示例5: listChucDanh1
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
public void listChucDanh1(ActionRequest request,
ActionResponse response) throws PortletException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
System.out.println(" ----------- " + themeDisplay.getPortletDisplay().getPortletName());
String portletName = "jobposmanagement_WAR_oepusermgtportlet";
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();
}
long workingUnitId = ParamUtil
.getLong(request, WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
PortletURL redirectURL = PortletURLFactoryUtil.create(
PortalUtil.getHttpServletRequest(request), portletName, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
redirectURL.setParameter(WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, String.valueOf(workingUnitId));
response.sendRedirect(redirectURL.toString());
}
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:29,代码来源:WorkingUnitPortlet.java
示例6: listCanBo
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
public void listCanBo(ActionRequest request,
ActionResponse response) throws PortletException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
//ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
String pageName = "/danh-sach-can-bo";
String portletName = "employeemanagement_WAR_oepusermgtportlet";
long plid = 0L;
try {
plid = LayoutLocalServiceUtil.getFriendlyURLLayout(
themeDisplay.getScopeGroupId(), false, pageName).getPlid();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(" ----------- " + pageName + " " + themeDisplay.getPlid());
long workingUnitId = ParamUtil
.getLong(request, WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
PortletURL redirectURL = PortletURLFactoryUtil.create(
PortalUtil.getHttpServletRequest(request), portletName, plid,
PortletRequest.RENDER_PHASE);
redirectURL.setParameter(WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, String.valueOf(workingUnitId));
response.sendRedirect(redirectURL.toString());
}
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:29,代码来源:WorkingUnitPortlet.java
示例7: getURLEdit
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
@Override
public final PortletURL getURLEdit(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse) throws Exception {
PortletURL portletURL = null;
if((_editDetails)&&(GetterUtil.getBoolean(liferayPortletRequest.getAttribute(EDIT_DETAILS)))) {
portletURL = getURLEditDetails(liferayPortletRequest, liferayPortletResponse);
if(Validator.isNotNull(portletURL)) {
prepareRuntimePortlet(portletURL);
return portletURL;
}
}
ThemeDisplay themeDisplay = (ThemeDisplay)liferayPortletRequest.getAttribute(
WebKeys.THEME_DISPLAY);
if(_learningactivity.getModuleId()==0){
portletURL=
PortletURLFactoryUtil.create(liferayPortletRequest,"lmsactivitieslist_WAR_liferaylmsportlet",getControlPanelPlid(themeDisplay), PortletRequest.RENDER_PHASE);
portletURL.setWindowState(LiferayWindowState.POP_UP);
}else{
portletURL = PortletURLFactoryUtil.create(liferayPortletRequest,_portletId,getControlPanelPlid(themeDisplay),PortletRequest.RENDER_PHASE);
}
portletURL.setParameter("editing", StringPool.TRUE);
portletURL.setParameter("resId",Long.toString( _learningactivity.getActId()));
portletURL.setParameter("resModuleId",Long.toString( _learningactivity.getModuleId()));
return portletURL;
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:29,代码来源:LearningActivityBaseAssetRenderer.java
示例8: getURLEditDetails
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
@Override
protected PortletURL getURLEditDetails(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse) throws Exception {
PortletURL portletURL = PortletURLFactoryUtil.create(liferayPortletRequest,getPortletId(),getLayout().getPlid(),PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcPath", "/html/surveyactivity/admin/editquestions.jsp");
portletURL.setParameter("actionEditingDetails", StringPool.TRUE);
portletURL.setParameter("resId",Long.toString( getLearningactivity().getActId()));
return portletURL;
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:10,代码来源:SurveyAssetRenderer.java
示例9: getURLEditDetails
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
@Override
protected PortletURL getURLEditDetails(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse) throws Exception {
PortletURL portletURL = PortletURLFactoryUtil.create(liferayPortletRequest,getPortletId(),getLayout().getPlid(),PortletRequest.RENDER_PHASE);
portletURL.setParameter("mvcPath", "/html/execactivity/test/admin/editquestions.jsp");
portletURL.setParameter("actionEditingDetails", StringPool.TRUE);
portletURL.setParameter("resId",Long.toString( getLearningactivity().getActId()));
return portletURL;
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:10,代码来源:TestAssetRenderer.java
示例10: montarlinkParaBotaoVoltar
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
private String montarlinkParaBotaoVoltar() {
String url = StringPool.BLANK;
try {
ThemeDisplay themeDisplay = (ThemeDisplay) LiferayFacesContext.getInstance().getPortletRequest().getAttribute(WebKeys.THEME_DISPLAY);
long plid = themeDisplay.getPlid();
if (plid != LayoutConstants.DEFAULT_PLID) {
PortletRequest request = (PortletRequest) LiferayFacesContext.getInstance().getExternalContext().getRequest();
PortletURL portletURL = PortletURLFactoryUtil.create(request, CD_CHAT_ROOM_COMPLETE_LIST_PORTLET_ID, plid, PortletRequest.RENDER_PHASE);
url = portletURL.toString();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return url;
}
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:16,代码来源:RedirecionaSalasPortalBean.java
示例11: getURLViewInContext
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
@Override
public String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect) {
try {
long plid = PortalUtil.getPlidFromPortletId(
_song.getGroupId(), PortletKeys.SONGS);
if (plid == LayoutConstants.DEFAULT_PLID) {
return StringPool.BLANK;
}
PortletURL portletURL = PortletURLFactoryUtil.create(
liferayPortletRequest, PortletKeys.SONGS, plid,
PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/songs/view_song.jsp");
portletURL.setParameter(
"songId", String.valueOf(_song.getSongId()));
return portletURL.toString();
}
catch (Exception e) {
}
return StringPool.BLANK;
}
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:30,代码来源:SongAssetRenderer.java
示例12: getURLViewInContext
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
@Override
public String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect) {
try {
long plid = PortalUtil.getPlidFromPortletId(
_album.getGroupId(), PortletKeys.ALBUMS);
if (plid == LayoutConstants.DEFAULT_PLID) {
return StringPool.BLANK;
}
PortletURL portletURL = PortletURLFactoryUtil.create(
liferayPortletRequest, PortletKeys.ALBUMS, plid,
PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/albums/view_album.jsp");
portletURL.setParameter(
"albumId", String.valueOf(_album.getAlbumId()));
return portletURL.toString();
}
catch (Exception e) {
}
return StringPool.BLANK;
}
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:30,代码来源:AlbumAssetRenderer.java
示例13: getURLViewInContext
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
@Override
public String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect) {
try {
long plid = PortalUtil.getPlidFromPortletId(
_artist.getGroupId(), PortletKeys.ARTISTS);
if (plid == LayoutConstants.DEFAULT_PLID) {
return StringPool.BLANK;
}
PortletURL portletURL = PortletURLFactoryUtil.create(
liferayPortletRequest, PortletKeys.ARTISTS, plid,
PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/artists/view_artist.jsp");
portletURL.setParameter(
"artistId", String.valueOf(_artist.getArtistId()));
return portletURL.toString();
}
catch (Exception e) {
}
return StringPool.BLANK;
}
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:30,代码来源:ArtistAssetRenderer.java
示例14: redirectUpdateAccount
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
protected void redirectUpdateAccount(
HttpServletRequest request, HttpServletResponse response, User user)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
WebKeys.THEME_DISPLAY);
PortletURL portletURL = PortletURLFactoryUtil.create(
request, PortletKeys.LOGIN, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
portletURL.setParameter("saveLastPath", Boolean.FALSE.toString());
portletURL.setParameter("struts_action", "/login/update_account");
PortletURL redirectURL = PortletURLFactoryUtil.create(
request, PortletKeys.FAST_LOGIN, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
redirectURL.setParameter("struts_action", "/login/login_redirect");
redirectURL.setParameter("emailAddress", user.getEmailAddress());
redirectURL.setParameter("anonymousUser", Boolean.FALSE.toString());
redirectURL.setPortletMode(PortletMode.VIEW);
redirectURL.setWindowState(LiferayWindowState.POP_UP);
portletURL.setParameter("redirect", redirectURL.toString());
portletURL.setParameter("userId", String.valueOf(user.getUserId()));
portletURL.setParameter("emailAddress", user.getEmailAddress());
portletURL.setParameter("firstName", user.getFirstName());
portletURL.setParameter("lastName", user.getLastName());
portletURL.setPortletMode(PortletMode.VIEW);
portletURL.setWindowState(LiferayWindowState.POP_UP);
response.sendRedirect(portletURL.toString());
}
开发者ID:sergiogonzalez,项目名称:google-login-hook,代码行数:35,代码来源:GoogleOAuth.java
示例15: getRestoreURL
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
protected PortletURL getRestoreURL(
PortletRequest portletRequest, long classPK)
throws PortalException {
String portletId = PortletKeys.ALBUMS;
Album album = AlbumLocalServiceUtil.getAlbum(classPK);
long plid = PortalUtil.getPlidFromPortletId(
album.getGroupId(), PortletKeys.ALBUMS);
PortletURL portletURL = PortletURLFactoryUtil.create(
portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/albums/view_album.jsp");
return portletURL;
}
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:19,代码来源:AlbumTrashHandler.java
示例16: getRestoreURL
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
protected PortletURL getRestoreURL(
PortletRequest portletRequest, long classPK)
throws PortalException {
String portletId = PortletKeys.SONGS;
Song song = SongLocalServiceUtil.getSong(classPK);
long plid = PortalUtil.getPlidFromPortletId(
song.getGroupId(), PortletKeys.SONGS);
PortletURL portletURL = PortletURLFactoryUtil.create(
portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/songs/view_song.jsp");
return portletURL;
}
开发者ID:juliocamarero,项目名称:jukebox-portlet,代码行数:19,代码来源:SongTrashHandler.java
示例17: getLink
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
@Override
protected String getLink(UserNotificationEvent userNotificationEvent,
ServiceContext serviceContext) throws Exception {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload());
String notificationType = jsonObject.getString("notificationType");
ThemeDisplay themeDisplay = serviceContext.getThemeDisplay();
long portletPlid = 0L;
PortletURL portletUrl = null;
switch(notificationType) {
case MicroSiteConstants.REQUEST_STATUS_PENDING:
portletPlid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), MICROSITES_PORTLET_ID);
if(portletPlid != 0) {
portletUrl = PortletURLFactoryUtil.
create(serviceContext.getLiferayPortletRequest(), MICROSITES_PORTLET_ID, portletPlid, PortletRequest.RENDER_PHASE);
portletUrl.setParameter("redirect", serviceContext.getLayoutFullURL());
portletUrl.setParameter("tabs1","micro-sites-requests");
return portletUrl.toString();
}
return null;
case MicroSiteConstants.REQUEST_STATUS_COMPLETE:
long siteId = jsonObject.getLong("siteId");
Group group = GroupLocalServiceUtil.fetchGroup(siteId);
if(group != null) {
return "/web" + group.getFriendlyURL();
}
return null;
case MicroSiteConstants.REQUEST_STATUS_REJECTED:
portletPlid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), MY_SITES_PORTLET_ID);
if(portletPlid != 0) {
portletUrl = PortletURLFactoryUtil.
create(serviceContext.getLiferayPortletRequest(), MY_SITES_PORTLET_ID, portletPlid, PortletRequest.RENDER_PHASE);
portletUrl.setParameter("redirect", serviceContext.getLayoutFullURL());
portletUrl.setParameter("tabs1","micro-sites-requests");
return portletUrl.toString();
}
return null;
default:
return null;
}
}
开发者ID:rivetlogic,项目名称:liferay-microsite-manager,代码行数:43,代码来源:MicrositeNotificationHandler.java
示例18: getRestoreURL
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
protected PortletURL getRestoreURL(
PortletRequest portletRequest, long classPK)
throws PortalException, SystemException {
String portletId = PortletKeys.ALBUMS;
Album album = AlbumLocalServiceUtil.getAlbum(classPK);
long plid = PortalUtil.getPlidFromPortletId(
album.getGroupId(), PortletKeys.ALBUMS);
PortletURL portletURL = PortletURLFactoryUtil.create(
portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/albums/view_album.jsp");
return portletURL;
}
开发者ID:juliocamarero,项目名称:jukebox,代码行数:19,代码来源:AlbumTrashHandler.java
示例19: getRestoreURL
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
protected PortletURL getRestoreURL(
PortletRequest portletRequest, long classPK)
throws PortalException, SystemException {
String portletId = PortletKeys.SONGS;
Song song = SongLocalServiceUtil.getSong(classPK);
long plid = PortalUtil.getPlidFromPortletId(
song.getGroupId(), PortletKeys.SONGS);
PortletURL portletURL = PortletURLFactoryUtil.create(
portletRequest, portletId, plid, PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/songs/view_song.jsp");
return portletURL;
}
开发者ID:juliocamarero,项目名称:jukebox,代码行数:19,代码来源:SongTrashHandler.java
示例20: execute
import com.liferay.portlet.PortletURLFactoryUtil; //导入依赖的package包/类
public String execute(
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
WebKeys.THEME_DISPLAY);
String cmd = ParamUtil.getString(request, Constants.CMD);
String redirectUri = PortalUtil.getPortalURL(request) + _REDIRECT_URI;
if (cmd.equals("login")) {
GoogleAuthorizationCodeFlow flow = getFlow();
GoogleAuthorizationCodeRequestUrl
googleAuthorizationCodeRequestUrl = flow.newAuthorizationUrl();
googleAuthorizationCodeRequestUrl.setRedirectUri(redirectUri);
String url = googleAuthorizationCodeRequestUrl.build();
response.sendRedirect(url);
}
else if (cmd.equals("token")) {
HttpSession session = request.getSession();
String code = ParamUtil.getString(request, "code");
if (Validator.isNotNull(code)) {
Credential credential = exchangeCode(code, redirectUri);
Userinfo userinfo = getUserInfo(credential);
User user = setGoogleCredentials(
session, themeDisplay.getCompanyId(), userinfo);
if ((user != null) &&
(user.getStatus() == WorkflowConstants.STATUS_INCOMPLETE)) {
redirectUpdateAccount(request, response, user);
return null;
}
PortletURL portletURL = PortletURLFactoryUtil.create(
request, PortletKeys.FAST_LOGIN, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
portletURL.setWindowState(LiferayWindowState.POP_UP);
portletURL.setParameter(
"struts_action", "/login/login_redirect");
response.sendRedirect(portletURL.toString());
}
}
return null;
}
开发者ID:sergiogonzalez,项目名称:google-login-hook,代码行数:60,代码来源:GoogleOAuth.java
注:本文中的com.liferay.portlet.PortletURLFactoryUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论