通过分析知道基于Ajax的portlet的呈现过程,体现了Ajax技术的价值:异步处理局部数据。
增加一个portlet
请求:
Hypertext Transfer Protocol
POST /c/portal/update_layout HTTP/1.1/r/n
Referer: http://10.108.10.205:8080/web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=normal&/r/n
method: POST /c/portal/update_layout HTTP/1.1/r/n
Content-Type: application/x-www-form-urlencoded/r/n
Accept-Encoding: gzip, deflate/r/n
Host: 10.108.10.205:8080/r/n
Content-Length: 136
Connection: Keep-Alive/r/n
Cache-Control: no-cache/r/n
Cookie: COOKIE_SUPPORT=true; LOGIN=test@liferay.com; SCREEN_NAME=DkOc2AWkcEQ=; GUEST_LANGUAGE_ID=en_US; JSESSIONID=2DFE59B64996E95DE0C64BA609CF79D1/r/n
/r/n
Line-based text data: application/x-www-form-urlencoded
p_l_id=10102&p_p_id=EXT_1&doAsUserId=&cmd=add¤tURL=%2Fweb%2Fguest%2Fhome%3Fp_p_id%3DEXT_1%26p_p_action%3D0%26p_p_state%3Dnormal%26
响应:
Hypertext Transfer Protocol
HTTP/1.1 200 OK/r/n
Server: Apache-Coyote/1.1/r/n
Set-Cookie: COOKIE_SUPPORT=true; Expires=Thu, 05-Mar-2009 07:53:59 GMT; Path=//r/n
Liferay-Portal: Liferay Enterprise Portal 4.3.3 (Owen / Build 4303 / October 9, 2007)/r/n
Content-Encoding: gzip/r/n
Content-Type: text/html;charset=UTF-8/r/n
Content-Length: 924
Date: Wed, 05 Mar 2008 07:54:00 GMT/r/n
/r/n
Content-encoded entity body (gzip): 924 bytes -> 2534 bytes
Line-based text data: text/html
<div id="p_p_id_EXT_1_" class="portlet-boundary portlet-boundary_EXT_1_" >/r
<a name="p_EXT_1"></a>/r
<div class="portlet" id="portlet-wrapper-EXT_1">/n
<div class="portlet-topper">/n
<span class="portlet-title">/n
Reports/n
</span>/n
<div class="portlet-icons" id="portlet-small-icon-bar_EXT_1">/n
/r
<a href="javascript: Liferay.PortletCSS.init('EXT_1');" target="_self"><img align="absmiddle" border="0"
src="/html/themes/genesis/images/common/../portlet/portlet_css.png" title="Look and Feel" /></a>/r
<a href="javascript: self.location = 'http%3A%2F%2F10.108.10.205%3A8080%2Fweb%2Fguest%2Fhome%3Fp_p_id%3D86%26p_p_action%3D0%26p_p_state%3Dmaximized%
26_86_struts_action%3D%252Fportlet_configuration%252Fedit_permissions%26_86_redirect%3D%252
<span id="p_p_body_EXT_1_min_buttons">/r
<a href="javascript: minimizePortlet('10102', 'EXT_1', false, '');"><img align="absmiddle" border="0"
src="/html/themes/genesis/images/portlet/minimize.png" title="Minimize" /></a>/r
</span>/r
<a href="http://10.108.10.205:8080/web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=maximized&" target="_self"><img align="absmiddle" border="0"
src="/html/themes/genesis/images/common/../portlet/maximize.png" title="Maximize" /></a>/r
<a href="javascript: closePortlet('10102', 'EXT_1', '');" target="_self"><img align="absmiddle" border="0"
src="/html/themes/genesis/images/common/../portlet/close.png" title="Remove" /></a>/r
</div>/n
</div>/n
<div class="portlet-content">/n
<div class="portlet-content-container" style="">/r
<div>/r
<a href="http://10.108.10.205:8080/web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=maximized&p_p_mode=view&">Test 123</a>/r
</div>/r
</div>/r
</div>/n
</div>/r
</div>/r
<script type="text/javascript">/r
document.getElementById("p_p_id_EXT_1_").portletId = "EXT_1";/r
document.getElementById("p_p_id_EXT_1_").columnPos = 0;/r
if (!Liferay.Portlet.isAjax("EXT_1")) {/r
Liferay.Portlet.process("EXT_1");/r
}/r
jQuery(/r
function() {/r
Liferay.Util.portletTitleEdit(/r
{/r
obj: jQuery("#p_p_id_EXT_1_"),/r
plid: "10102",/r
doAsUserId: "",/r
portletId: "EXT_1"/r
}/r
);/r
}/r
);/r
</script>/r
最小化一个portlet
请求:
Hypertext Transfer Protocol
POST /c/portal/update_layout HTTP/1.1/r/n
Referer: http://10.108.10.205:8080/web/guest/home/r/n
method: POST /c/portal/update_layout HTTP/1.1/r/n
Content-Type: application/x-www-form-urlencoded/r/n
Accept-Encoding: gzip, deflate/r/n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)/r/n
Host: 10.108.10.205:8080/r/n
Content-Length: 68
Connection: Keep-Alive/r/n
Cache-Control: no-cache/r/n
Cookie: COOKIE_SUPPORT=true; LOGIN=test@liferay.com; SCREEN_NAME=DkOc2AWkcEQ=; GUEST_LANGUAGE_ID=en_US; JSESSIONID=2DFE59B64996E95DE0C64BA609CF79D1/r/n
/r/n
Line-based text data: application/x-www-form-urlencoded
p_l_id=10102&p_p_id=EXT_1&p_p_restore=false&doAsUserId=&cmd=minimize
响应:
Hypertext Transfer Protocol
HTTP/1.1 200 OK/r/n
Server: Apache-Coyote/1.1/r/n
Set-Cookie: COOKIE_SUPPORT=true; Expires=Thu, 05-Mar-2009 07:57:17 GMT; Path=//r/n
Liferay-Portal: Liferay Enterprise Portal 4.3.3 (Owen / Build 4303 / October 9, 2007)/r/n
Content-Type: text/html;charset=UTF-8/r/n
Content-Length: 0
Date: Wed, 05 Mar 2008 07:57:17 GMT/r/n
/r/n
恢复一个portlet(从最小化)
请求:
Hypertext Transfer Protocol
POST /c/portal/update_layout HTTP/1.1/r/n
Accept: */*/r/n
Accept-Language: en-us/r/n
Referer: http://10.108.10.205:8080/web/guest/home/r/n
method: POST /c/portal/update_layout HTTP/1.1/r/n
Content-Type: application/x-www-form-urlencoded/r/n
Accept-Encoding: gzip, deflate/r/n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)/r/n
Host: 10.108.10.205:8080/r/n
Content-Length: 67
Connection: Keep-Alive/r/n
Cache-Control: no-cache/r/n
Cookie: COOKIE_SUPPORT=true; LOGIN=test@liferay.com; SCREEN_NAME=DkOc2AWkcEQ=; GUEST_LANGUAGE_ID=en_US; JSESSIONID=2DFE59B64996E95DE0C64BA609CF79D1/r/n
/r/n
Line-based text data: application/x-www-form-urlencoded
p_l_id=10102&p_p_id=EXT_1&p_p_restore=true&doAsUserId=&cmd=minimize
响应:
Hypertext Transfer Protocol
HTTP/1.1 200 OK/r/n
Server: Apache-Coyote/1.1/r/n
Set-Cookie: COOKIE_SUPPORT=true; Expires=Thu, 05-Mar-2009 07:57:17 GMT; Path=//r/n
Liferay-Portal: Liferay Enterprise Portal 4.3.3 (Owen / Build 4303 / October 9, 2007)/r/n
Content-Type: text/html;charset=UTF-8/r/n
Content-Length: 0
Date: Wed, 05 Mar 2008 07:57:17 GMT/r/n
/r/n
最大化一个portlet
请求:
Hypertext Transfer Protocol
GET /web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=maximized& HTTP/1.1/r/n
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-
shockwave-flash, */*/r/n
Referer: http://10.108.10.205:8080/web/guest/home/r/n
Accept-Language: en-us/r/n
Accept-Encoding: gzip, deflate/r/n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)/r/n
Host: 10.108.10.205:8080/r/n
Connection: Keep-Alive/r/n
Cookie: LFR_SESSION_STATE_10111=1204702463265; COOKIE_SUPPORT=true; LOGIN=test@liferay.com; SCREEN_NAME=DkOc2AWkcEQ=; GUEST_LANGUAGE_ID=en_US;
JSESSIONID=2DFE59B64996E95DE0C64BA609CF79D1/r/n
/r/n
响应:
Hypertext Transfer Protocol
HTTP/1.1 200 OK/r/n
Server: Apache-Coyote/1.1/r/n
Set-Cookie: COOKIE_SUPPORT=true; Expires=Thu, 05-Mar-2009 07:39:37 GMT; Path=//r/n
Liferay-Portal: Liferay Enterprise Portal 4.3.3 (Owen / Build 4303 / October 9, 2007)/r/n
Content-Encoding: gzip/r/n
Content-Type: text/html;charset=UTF-8/r/n
Content-Length: 4473
Date: Wed, 05 Mar 2008 07:39:47 GMT/r/n
/r/n
Content-encoded entity body (gzip): 4473 bytes -> 19199 bytes
Line-based text data: text/html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">/r
<html dir="ltr">/r
<head>/r
<title>liferay.com - Welcome</title>/r
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />/r
<link rel="Shortcut Icon" href="/html/themes/genesis/images/liferay.ico" _fcksavedurl=""/html/themes/genesis/images/liferay.ico"" />/r
<link href="/c/portal/css_cached?themeId=genesis&colorSchemeId=01&t=1204702034813" type="text/css" rel="stylesheet" />/r
<style type="text/css">/r
</style>/r
<script type="text/javascript">/r
var themeDisplay = {/r
getCompanyId: function() {/r
return "10094";/r
},/r
getDoAsUserIdEncoded: function() {/r
return "";/r
},/r
................................(省略了整个页面的代码)
恢复一个portle(从全屏)
请求:
Hypertext Transfer Protocol
GET /web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=normal& HTTP/1.1/r/n
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-
shockwave-flash, */*/r/n
Referer: http://10.108.10.205:8080/web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=maximized&/r/n
Accept-Language: en-us/r/n
Accept-Encoding: gzip, deflate/r/n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)/r/n
Host: 10.108.10.205:8080/r/n
Connection: Keep-Alive/r/n
Cookie: LFR_SESSION_STATE_10111=1204702790765; COOKIE_SUPPORT=true; LOGIN=test@liferay.com; SCREEN_NAME=DkOc2AWkcEQ=; GUEST_LANGUAGE_ID=en_US;
JSESSIONID=2DFE59B64996E95DE0C64BA609CF79D1/r/n
/r/n
响应:
Hypertext Transfer Protocol
HTTP/1.1 200 OK/r/n
Server: Apache-Coyote/1.1/r/n
Set-Cookie: COOKIE_SUPPORT=true; Expires=Thu, 05-Mar-2009 07:39:37 GMT; Path=//r/n
Liferay-Portal: Liferay Enterprise Portal 4.3.3 (Owen / Build 4303 / October 9, 2007)/r/n
Content-Encoding: gzip/r/n
Content-Type: text/html;charset=UTF-8/r/n
Content-Length: 4473
Date: Wed, 05 Mar 2008 07:39:47 GMT/r/n
/r/n
Content-encoded entity body (gzip): 4473 bytes -> 19199 bytes
Line-based text data: text/html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">/r
<html dir="ltr">/r
<head>/r
<title>liferay.com - Welcome</title>/r
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />/r
<link rel="Shortcut Icon" href="/html/themes/genesis/images/liferay.ico" _fcksavedurl=""/html/themes/genesis/images/liferay.ico"" />/r
<link href="/c/portal/css_cached?themeId=genesis&colorSchemeId=01&t=1204702034813" type="text/css" rel="stylesheet" />/r
<style type="text/css">/r
</style>/r
<script type="text/javascript">/r
var themeDisplay = {/r
getCompanyId: function() {/r
return "10094";/r
},/r
getDoAsUserIdEncoded: function() {/r
return "";/r
},/r
................................(省略了整个页面的代码)
拖动一个portlet
请求:
Hypertext Transfer Protocol
POST /c/portal/update_layout HTTP/1.1/r/n
Accept: */*/r/n
Accept-Language: en-us/r/n
Referer: http://10.108.10.205:8080/web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=normal&/r/n
method: POST /c/portal/update_layout HTTP/1.1/r/n
Content-Type: application/x-www-form-urlencoded/r/n
Accept-Encoding: gzip, deflate/r/n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)/r/n
Host: 10.108.10.205:8080/r/n
Content-Length: 80
Connection: Keep-Alive/r/n
Cache-Control: no-cache/r/n
Cookie: COOKIE_SUPPORT=true; LOGIN=test@liferay.com; SCREEN_NAME=DkOc2AWkcEQ=; GUEST_LANGUAGE_ID=en_US; JSESSIONID=2DFE59B64996E95DE0C64BA609CF79D1/r/n
/r/n
Line-based text data: application/x-www-form-urlencoded
p_l_id=10102&p_p_id=EXT_1&p_p_col_id=column-2&p_p_col_pos=0&doAsUserId=&cmd=move
响应:
Hypertext Transfer Protocol
HTTP/1.1 200 OK/r/n
Server: Apache-Coyote/1.1/r/n
Set-Cookie: COOKIE_SUPPORT=true; Expires=Thu, 05-Mar-2009 07:49:39 GMT; Path=//r/n
Liferay-Portal: Liferay Enterprise Portal 4.3.3 (Owen / Build 4303 / October 9, 2007)/r/n
Content-Type: text/html;charset=UTF-8/r/n
Content-Length: 0
Date: Wed, 05 Mar 2008 07:49:39 GMT/r/n
/r/n
删除一个portlet
请求:
Hypertext Transfer Protocol
POST /c/portal/update_layout HTTP/1.1/r/n
Accept: */*/r/n
Accept-Language: en-us/r/n
Referer: http://10.108.10.205:8080/web/guest/home?p_p_id=EXT_1&p_p_action=0&p_p_state=normal&/r/n
method: POST /c/portal/update_layout HTTP/1.1/r/n
Content-Type: application/x-www-form-urlencoded/r/n
Accept-Encoding: gzip, deflate/r/n
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; .NET CLR 1.1.4322; .NET CLR 2.0.50727)/r/n
Host: 10.108.10.205:8080/r/n
Content-Length: 48
Connection: Keep-Alive/r/n
Cache-Control: no-cache/r/n
Cookie: COOKIE_SUPPORT=true; LOGIN=test@liferay.com; SCREEN_NAME=DkOc2AWkcEQ=; GUEST_LANGUAGE_ID=en_US; JSESSIONID=2DFE59B64996E95DE0C64BA609CF79D1/r/n
/r/n
Line-based text data: application/x-www-form-urlencoded
p_l_id=10102&p_p_id=EXT_1&doAsUserId=&cmd=delete
响应:
Hypertext Transfer Protocol
HTTP/1.1 200 OK/r/n
Server: Apache-Coyote/1.1/r/n
Set-Cookie: COOKIE_SUPPORT=true; Expires=Thu, 05-Mar-2009 07:52:25 GMT; Path=//r/n
Liferay-Portal: Liferay Enterprise Portal 4.3.3 (Owen / Build 4303 / October 9, 2007)/r/n
Content-Type: text/html;charset=UTF-8/r/n
Content-Length: 0
Date: Wed, 05 Mar 2008 07:52:25 GMT/r/n
/r/n