gatein SVN: r3672 - in portal/trunk/examples: portal/war/src/main/webapp/login/jsp and 1 other directory.
by do-not-reply@jboss.org
Author: mstruk
Date: 2010-07-21 05:57:17 -0400 (Wed, 21 Jul 2010)
New Revision: 3672
Modified:
portal/trunk/examples/extension/war/src/main/webapp/login/jsp/login.jsp
portal/trunk/examples/portal/war/src/main/webapp/login/jsp/login.jsp
Log:
GTNPORTAL-1355 Replaced hardcoded text with resource loaded
Modified: portal/trunk/examples/extension/war/src/main/webapp/login/jsp/login.jsp
===================================================================
--- portal/trunk/examples/extension/war/src/main/webapp/login/jsp/login.jsp 2010-07-21 08:40:50 UTC (rev 3671)
+++ portal/trunk/examples/extension/war/src/main/webapp/login/jsp/login.jsp 2010-07-21 09:57:17 UTC (rev 3672)
@@ -53,7 +53,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>Login</title>
+ <title><%=res.getString("UILoginForm.label.Signin")%></title>
<link rel="shortcut icon" type="image/x-icon" href="/<%=portalContainer.getName()%>/favicon.ico" />
<link rel='stylesheet' type='text/css' href='/<%=portalContainer.getName()%>/login/skin/Stylesheet.css'/>
<script type="text/javascript" src="/eXoResources/javascript/eXo.js"></script>
@@ -61,9 +61,9 @@
</head>
<body style="text-align: center; background: #f5f5f5; font-family: arial, tahoma, verdana">
<div class="UILogin">
- <div class="LoginHeader">Sign In</div>
+ <div class="LoginHeader"><%=res.getString("UILoginForm.label.Signin")%></div>
<div class="LoginContent">
- <div class="WelcomeText">Welcome to GateIn Portal</div>
+ <div class="WelcomeText"><%=res.getString("UILoginForm.label.welcome")%></div>
<div class="CenterLoginContent">
<%/*Begin form*/%>
<%
@@ -71,7 +71,7 @@
EntityEncoder encoder = EntityEncoder.FULL;
username = encoder.encode(username);
%>
- <font color="red">Sign in failed. Wrong username or password.</font><%}%>
+ <font color="red"><%=res.getString("UILoginForm.label.SigninFail")%></font><%}%>
<form name="loginForm" action="<%= contextPath + "/login"%>" method="post" style="margin: 0px;">
<% if (uri != null) { %>
<input type="hidden" name="initialURI" value="<%=uri%>"/>
@@ -114,6 +114,6 @@
</div>
</div>
</div>
- <span style="margin: 10px 0px 0px 5px; font-size: 11px; color: #6f6f6f; text-align: center">Copyright © 2010. All rights Reserved, eXo Platform SAS and Red Hat, Inc.</span>
+ <span style="margin: 10px 0px 0px 5px; font-size: 11px; color: #6f6f6f; text-align: center"><%=res.getString("UILoginForm.label.Copyright")%></span>
</body>
</html>
Modified: portal/trunk/examples/portal/war/src/main/webapp/login/jsp/login.jsp
===================================================================
--- portal/trunk/examples/portal/war/src/main/webapp/login/jsp/login.jsp 2010-07-21 08:40:50 UTC (rev 3671)
+++ portal/trunk/examples/portal/war/src/main/webapp/login/jsp/login.jsp 2010-07-21 09:57:17 UTC (rev 3672)
@@ -53,7 +53,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <title>Login</title>
+ <title><%=res.getString("UILoginForm.label.Signin")%></title>
<link rel="shortcut icon" type="image/x-icon" href="/<%=portalContainer.getName()%>/favicon.ico" />
<link rel='stylesheet' type='text/css' href='/<%=portalContainer.getName()%>/login/skin/Stylesheet.css'/>
<script type="text/javascript" src="/eXoResources/javascript/eXo.js"></script>
@@ -61,9 +61,9 @@
</head>
<body style="text-align: center; background: #f5f5f5; font-family: arial, tahoma, verdana">
<div class="UILogin">
- <div class="LoginHeader">Sign In</div>
+ <div class="LoginHeader"><%=res.getString("UILoginForm.label.Signin")%></div>
<div class="LoginContent">
- <div class="WelcomeText">Welcome to GateIn Portal</div>
+ <div class="WelcomeText"><%=res.getString("UILoginForm.label.welcome")%></div>
<div class="CenterLoginContent">
<%/*Begin form*/%>
<%
@@ -71,7 +71,7 @@
EntityEncoder encoder = EntityEncoder.FULL;
username = encoder.encode(username);
%>
- <font color="red">Sign in failed. Wrong username or password.</font><%}%>
+ <font color="red"><%=res.getString("UILoginForm.label.SigninFail")%></font><%}%>
<form name="loginForm" action="<%= contextPath + "/login"%>" method="post" style="margin: 0px;">
<% if (uri != null) { %>
<input type="hidden" name="initialURI" value="<%=uri%>"/>
@@ -114,6 +114,6 @@
</div>
</div>
</div>
- <span style="margin: 10px 0px 0px 5px; font-size: 11px; color: #6f6f6f; text-align: center">Copyright © 2010. All rights Reserved, eXo Platform SAS and Red Hat, Inc.</span>
+ <span style="margin: 10px 0px 0px 5px; font-size: 11px; color: #6f6f6f; text-align: center"><%=res.getString("UILoginForm.label.Copyright")%></span>
</body>
</html>
14 years, 5 months
gatein SVN: r3671 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-07-21 04:40:50 -0400 (Wed, 21 Jul 2010)
New Revision: 3671
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/EventsWrapper.java
Log:
minor : use java 5 iteration style instead of iterator
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/EventsWrapper.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/EventsWrapper.java 2010-07-21 06:39:08 UTC (rev 3670)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/EventsWrapper.java 2010-07-21 08:40:50 UTC (rev 3671)
@@ -63,9 +63,8 @@
public void increaseCounter(UIPortlet portlet)
{
- for (Iterator iter = counters.iterator(); iter.hasNext();)
+ for (CounterWrapper counter : counters)
{
- CounterWrapper counter = (CounterWrapper)iter.next();
if (portlet.getWindowId().equals(counter.portletId))
{
counter.counter++;
@@ -77,9 +76,8 @@
public boolean isInvokedTooManyTimes(UIPortlet portlet)
{
- for (Iterator iter = counters.iterator(); iter.hasNext();)
+ for (CounterWrapper counter : counters)
{
- CounterWrapper counter = (CounterWrapper)iter.next();
if (portlet.getWindowId().equals(counter.portletId))
{
if (counter.counter + 1 > THRESHOLD)
14 years, 5 months
gatein SVN: r3670 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-07-21 02:39:08 -0400 (Wed, 21 Jul 2010)
New Revision: 3670
Added:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_008_AddSomeUserInToGroupAndAfterDeleteAnUser.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html
Log:
TESTVN-1006: Create new GateIn Selenium
Added: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_008_AddSomeUserInToGroupAndAfterDeleteAnUser.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_008_AddSomeUserInToGroupAndAfterDeleteAnUser.html (rev 0)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_008_AddSomeUserInToGroupAndAfterDeleteAnUser.html 2010-07-21 06:39:08 UTC (rev 3670)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>Test_PRL_03_05_008_AddSomeUserInToGroupAndAfterDeleteAnUser</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Test_PRL_03_05_008_AddSomeUserInToGroupAndAfterDeleteAnUser</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/portal/public/classic/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Add some user into group and after delete an user --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>windowMaximize</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Sign in</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>root</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>gtn</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//div[@id='UIPortalLoginFormAction']/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Go to Users and Group Management --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Choose Group Management --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Group Management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Group Management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Customers</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Customers</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>root,,demo</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>membership</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>membership</td>
+ <td>label=manager</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>Demo</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Demo</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>Root</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Root</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Delete user in group --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//img[@alt='DeleteUser']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//img[@alt='DeleteUser']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertConfirmation</td>
+ <td>Are you sure you want to delete user demo from group customers?</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//img[@alt='DeleteUser']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//img[@alt='DeleteUser']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertConfirmation</td>
+ <td>Are you sure you want to delete user root from group customers?</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
Added: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html (rev 0)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm.html 2010-07-21 06:39:08 UTC (rev 3670)
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Test_PRL_03_05_010_AddUserIntoGroupWIthoutSelectCheckboxUserInSelectUserForm</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/portal/public/classic/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Add user into group without select check box user in Select User form--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>windowMaximize</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Sign in</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>root</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>gtn</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//div[@id='UIPortalLoginFormAction']/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Go to User and Group Management --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Choose Group Management --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[1]/div/div/div/div/div/div/a[2]/div[2]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[1]/div/div/div/div/div/div/a[2]/div[2]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Partners</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Partners</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Click Select User icon--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//form[@id='UIGroupMembershipForm']/div[2]/div/table/tbody/tr[1]/td[2]/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//form[@id='UIGroupMembershipForm']/div[2]/div/table/tbody/tr[1]/td[2]/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//form[@id='UIUserSelector']/div[2]/div[2]/table/tbody/tr/td/a[1]/div/div/div</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//form[@id='UIUserSelector']/div[2]/div[2]/table/tbody/tr/td/a[1]/div/div/div</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Please check at least one user. </td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>Please check at least one user. </td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[2]/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//form[@id='UIUserSelector']/div[2]/div[2]/table/tbody/tr/td/a[2]/div/div/div</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//form[@id='UIUserSelector']/div[2]/div[2]/table/tbody/tr/td/a[2]/div/div/div</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
14 years, 5 months
gatein SVN: r3669 - portal/trunk/testsuite/testdefinitions.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-07-21 02:38:11 -0400 (Wed, 21 Jul 2010)
New Revision: 3669
Modified:
portal/trunk/testsuite/testdefinitions/GateIn_v3.1.0_BasicPortlets_TestDefinition.ods
Log:
Update test case for GateIn_v3.1.0GA
Modified: portal/trunk/testsuite/testdefinitions/GateIn_v3.1.0_BasicPortlets_TestDefinition.ods
===================================================================
(Binary files differ)
14 years, 5 months
gatein SVN: r3668 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-07-20 21:59:14 -0400 (Tue, 20 Jul 2010)
New Revision: 3668
Added:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html
Log:
TESTVN-1006: Create new GateIn Selenium
Added: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html (rev 0)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation.html 2010-07-21 01:59:14 UTC (rev 3668)
@@ -0,0 +1,557 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Test_PRL_03_04_007_CheckExistingOfDeletedGroupNavigation</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/portal/public/classic/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Check existing of deleted group's navigation--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>windowMaximize</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Sign in</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>root</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>gtn</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//div[@id='UIPortalLoginFormAction']/div/div/div</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Add new user --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=New Staff</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>Confirmpassword</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>firstName</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>lastName</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>email</td>
+ <td>Test_PRL_03_04_007(a)gmail.com</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>You have registered a new account.</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>You have registered a new account.</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[3]/div/div/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[3]/div/div/div[1]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Go to User and group management--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Choose group management --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[1]/div/div/div/div/div/div/a[2]/div[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[1]/div/div/div/div/div/div/a[2]/div[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Add new group --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/a[3]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/a[3]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>groupName</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>groupName</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>label</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>description</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Add user into group--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Select membership --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>membership</td>
+ <td></td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>membership</td>
+ <td>label=manager</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Login by new user--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/portal/public/classic/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Sign in</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//div[@id='UIPortalLoginFormAction']/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Go to Group Navigation list--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Group</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Add new group navigation --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIGroupNavigationManagement']/div[2]/table/tbody/tr/td/div/div/div/div</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[@id='UIGroupNavigationManagement']/div[2]/table/tbody/tr/td/div/div/div/div</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIAddGroupNavigationGrid']/table/tbody/tr/td[2]/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[@id='UIAddGroupNavigationGrid']/table/tbody/tr/td[2]/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>Each of the groups has navigation now</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Each of the groups has navigation now</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Cancel</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Cancel</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>Test_PRL_03_04_007</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>Test_PRL_03_04_007</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Login by Admin--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/portal/public/classic/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Sign in</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>username</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>username</td>
+ <td>root</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>gtn</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//div[@id='UIPortalLoginFormAction']/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Go to User and group management --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Choose Group management --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Group Management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Group Management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Delete group --</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Test_PRL_03_04_007</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Test_PRL_03_04_007</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/a[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/a[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertConfirmation</td>
+ <td>Are you sure you want to delete this group?</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Group</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextNotPresent</td>
+ <td>Test_PRL_03_04_007</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Add Navigation</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Add Navigation</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextNotPresent</td>
+ <td>/Test_PRL_03_04_007</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Cancel</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>link=Cancel</td>
+ <td></td>
+</tr>
+<tr>
+ <td>echo</td>
+ <td>-- Delete user--</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Users and groups management</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[1]/div/div/div/div/div/div/a[1]/div[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[@id='UIOrganizationPortlet']/div[2]/div[1]/div/div/div/div/div/div/a[1]/div[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>searchTerm</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>searchTerm</td>
+ <td>Test_PRL_03_04_007</td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//form[@id='UISearchForm']/div[2]/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//form[@id='UISearchForm']/div[2]/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//img[@alt='DeleteUser']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//img[@alt='DeleteUser']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertConfirmation</td>
+ <td>Are you sure you want to delete Test_PRL_03_04_007 user?</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForTextPresent</td>
+ <td>No result found.</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyTextPresent</td>
+ <td>No result found.</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[4]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>//div[4]/div/div[2]/div/div/div/div/div/div[3]/div/table/tbody/tr/td/div/div/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
14 years, 5 months
gatein SVN: r3667 - in components/wsrp/trunk: common/src/test/java/org/gatein/wsrp/other and 7 other directories.
by do-not-reply@jboss.org
Author: mwringe
Date: 2010-07-20 15:47:00 -0400 (Tue, 20 Jul 2010)
New Revision: 3667
Added:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupService.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v2/V2MarkupService.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/EventRequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPRequestContext.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java
Log:
GTNWSRP-54: initial check in of GetResource support. Still needs a couple of fixes and test cases to be added.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -32,6 +32,7 @@
import org.gatein.pc.api.StateString;
import org.gatein.pc.api.WindowState;
import org.gatein.pc.api.cache.CacheLevel;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
import org.jboss.logging.Logger;
import javax.servlet.http.HttpServletRequest;
@@ -55,6 +56,7 @@
private boolean requiresRewrite = false;
private URL resourceURL;
+ private boolean preferOperation = false;
private static final Map<String, MediaType> SUPPORTED_RESOURCE_TYPES = new HashMap<String, MediaType>(11);
@@ -95,10 +97,21 @@
{
if (resourceURL != null)
{
- createURLParameter(sb, WSRPRewritingConstants.RESOURCE_URL, getResourceId());
+ createURLParameter(sb, WSRPRewritingConstants.RESOURCE_URL, URLTools.encodeXWWWFormURL(resourceURL.toExternalForm()));
}
createURLParameter(sb, WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE, requiresRewrite ? "true" : "false");
+
+ if (resourceId != null)
+ {
+ createURLParameter(sb, WSRP2RewritingConstants.RESOURCE_ID, resourceId);
+ }
+
+ // false is the default value, so we don't actually need to add it to the string
+ if (preferOperation != false)
+ {
+ createURLParameter(sb, WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION, Boolean.toString(preferOperation));
+ }
}
@Override
@@ -123,34 +136,44 @@
{
try
{
- // todo: deal with resourceId properly, right now just use resourceURL if any
- resourceId = paramValue; // keep the encoded value as it will be used in URLs
-
paramValue = URLTools.decodeXWWWFormURL(paramValue);
-
- resourceURL = new URL(paramValue);
-
+ this.resourceURL = new URL(paramValue);
String extension = URLTools.getFileExtensionOrNullFrom(resourceURL);
-
MediaType mediaType = SUPPORTED_RESOURCE_TYPES.get(extension);
if (mediaType == null)
{
log.debug("Couldn't determine (based on extension) MIME type of file: " + resourceURL.getPath()
- + "\nRetrieving the associated resource will probably fail.");
+ + "\nRetrieving the associated resource will probably fail.");
}
params.remove(WSRPRewritingConstants.RESOURCE_URL);
+
}
catch (MalformedURLException e)
{
throw new IllegalArgumentException("Malformed URL: " + paramValue, e);
}
}
- else
+
+ String resourceIDParam = getRawParameterValueFor(params, WSRP2RewritingConstants.RESOURCE_ID);
+ if (resourceIDParam != null)
{
- throw new IllegalArgumentException("The parsed parameters don't contain a value for the required "
- + WSRPRewritingConstants.RESOURCE_URL + " parameter in " + originalURL);
+ resourceId = resourceIDParam;
}
+
+ String preferOperationParam = getRawParameterValueFor(params, WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
+ {
+ if (preferOperationParam != null)
+ {
+ preferOperation = Boolean.valueOf(preferOperationParam);
+ }
+ }
+
+ if (resourceIDParam == null && paramValue == null)
+ {
+ throw new IllegalArgumentException("The parsed parameters don't contain a value for "
+ + WSRPRewritingConstants.RESOURCE_URL + " or for " + WSRP2RewritingConstants.RESOURCE_ID + " parameter in " + originalURL);
+ }
}
/**
@@ -173,11 +196,10 @@
public String getResourceId()
{
- if (resourceId == null && resourceURL != null)
- {
- resourceId = URLTools.encodeXWWWFormURL(resourceURL.toExternalForm());
- }
- return resourceId;
+ // we need to return a representation of the wsrp resource identification, this is not necessarily just
+ // the wsrp-resourceID, we need to also consider the wsrp-url and other wsrp resource values.
+ // This value returned by this method is used by the PC ResourceInvocation
+ return encodeResource(resourceId, resourceURL, preferOperation);
}
/**
@@ -199,37 +221,6 @@
return cacheability;
}
- /**
- * This method is a hack to provide a minimal resource support before WSRP 2 so that bridged portlets work. We
- * basically build a resource URL based on the server address and the targeted portlet context (which hopefully can
- * be mapped to the context path of the war file it's deployed in). JBoss Portlet Bridge 2.0 uses a resource ID that
- * is the absolute path to resource inside web application context for static resources.
- *
- * @param request
- * @param portletContext
- * @deprecated should be removed when WSRP 2 is implemented
- */
- public void buildURLWith(HttpServletRequest request, PortletContext portletContext)
- {
- String url = createAbsoluteURLFrom(resourceId, URLTools.getServerAddressFrom(request), portletContext.getApplicationName());
- try
- {
- resourceURL = new URL(url);
- String extension = URLTools.getFileExtensionOrNullFrom(resourceURL);
- MediaType type = SUPPORTED_RESOURCE_TYPES.get(extension);
- if (MediaType.TEXT_CSS.equals(type) || MediaType.TEXT_JAVASCRIPT.equals(type) || MediaType.TEXT_HTML.equals(type))
- {
- requiresRewrite = true;
- }
- }
- catch (MalformedURLException e)
- {
- throw new IllegalArgumentException("Malformed URL: " + url, e);
- }
-
- log.info("Attempted to build resource URL that could be accessed directly from consumer: " + resourceURL);
- }
-
public static String createAbsoluteURLFrom(String initial, String serverAddress, String portletApplicationName)
{
String url = serverAddress;
@@ -263,4 +254,54 @@
{
return requiresRewrite;
}
+
+ //TODO: figure out a more clean way to encode and decode the pc resource id (note: different from the wsrp resource id)
+ //we should either use a Map<String, String> directly or pass an object back
+
+ /**
+ * Encodes the wsrp resource information into a single string.
+ *
+ * @param resourceId The original resource ID
+ * @param resourceURL The originial resource url
+ * @param preferedOperation The preferedOperation value
+ * @return
+ */
+ public static String encodeResource(String resourceId, URL resourceURL, boolean preferedOperation)
+ {
+ Map<String, String[]> parameters = new HashMap<String, String[]>();
+
+ if (resourceId != null)
+ {
+ parameters.put(WSRP2RewritingConstants.RESOURCE_ID, new String[]{resourceId});
+ }
+
+ if (resourceURL != null)
+ {
+ parameters.put(WSRPRewritingConstants.RESOURCE_URL, new String[]{resourceURL.toString()});
+ }
+
+ parameters.put(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION, new String[]{Boolean.toString(preferedOperation)});
+
+ return StateString.encodeAsOpaqueValue(parameters);
+ }
+
+ /**
+ * Decodes the resource information specified by the encodeResource back into proper resource values
+ *
+ * @param resourceInfo
+ */
+ public static Map<String, String> decodeResource(String resourceInfo)
+ {
+ Map<String, String[]> resourceParameters = StateString.decodeOpaqueValue(resourceInfo);
+
+ Map<String, String> resource = new HashMap<String, String>();
+
+ for (Map.Entry<String, String[]> entry : resourceParameters.entrySet())
+ {
+ if (entry.getValue() != null && entry.getValue().length > 0)
+ resource.put(entry.getKey(), entry.getValue()[0]);
+ }
+
+ return resource;
+ }
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -55,6 +55,7 @@
import org.oasis.wsrp.v2.GetPortletDescription;
import org.oasis.wsrp.v2.GetPortletProperties;
import org.oasis.wsrp.v2.GetPortletPropertyDescription;
+import org.oasis.wsrp.v2.GetResource;
import org.oasis.wsrp.v2.GetServiceDescription;
import org.oasis.wsrp.v2.HandleEvents;
import org.oasis.wsrp.v2.HandleEventsResponse;
@@ -83,6 +84,9 @@
import org.oasis.wsrp.v2.RegistrationData;
import org.oasis.wsrp.v2.ReleaseSessions;
import org.oasis.wsrp.v2.ResetProperty;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.ResourceResponse;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.ServiceDescription;
import org.oasis.wsrp.v2.SessionContext;
@@ -165,6 +169,24 @@
return getMarkup;
}
+ public static GetResource createDefaultResourceRequest(String handle, String resourceID)
+ {
+ return createResourceRequest(createPortletContext(handle), createDefaultRuntimeContext(), createDefaultResourceParams(resourceID));
+ }
+
+ public static GetResource createResourceRequest(PortletContext portletContext, RuntimeContext runtimeContext, ResourceParams resourceParams)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext, "RuntimeContext");
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
+ ParameterValidation.throwIllegalArgExceptionIfNull(resourceParams, "ResourceParams");
+
+ GetResource getResource = new GetResource();
+ getResource.setPortletContext(portletContext);
+ getResource.setRuntimeContext(runtimeContext);
+ getResource.setResourceParams(resourceParams);
+ return getResource;
+ }
+
/**
* Same as createPerformBlockingInteraction(portletHandle, {@link #createDefaultRuntimeContext}(), {@link
* #createDefaultMarkupParams}(), {@link #createDefaultInteractionParams}());
@@ -367,6 +389,45 @@
return markupParams;
}
+ public static ResourceParams createDefaultResourceParams(String resourceID)
+ {
+ return createResourceParams(false, WSRPConstants.getDefaultLocales(), WSRPConstants.getDefaultMimeTypes(),
+ WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE, resourceID, StateChange.READ_ONLY);
+ }
+
+ public static ResourceParams createResourceParams(boolean secureClientCommunication, List<String> locales, List<String> mimeTypes, String mode, String windowState, String resourceID, StateChange stateChange)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(locales, "locales");
+ if (locales.isEmpty())
+ {
+ throw new IllegalArgumentException("Cannot create a ResourceParams with an empty list of locales!");
+ }
+ ParameterValidation.throwIllegalArgExceptionIfNull(mimeTypes, "MIME types");
+ ParameterValidation.throwIllegalArgExceptionIfNull(stateChange, "State Change");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mode, "mode", "ResourceParams");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(windowState, "window state", "ResourceParams");
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(resourceID, "Resource ID", "ResourceParams");
+
+ ResourceParams resourceParams = new ResourceParams();
+ resourceParams.setSecureClientCommunication(secureClientCommunication);
+ resourceParams.setMode(mode);
+ resourceParams.setWindowState(windowState);
+ if (ParameterValidation.existsAndIsNotEmpty(locales))
+ {
+ resourceParams.getLocales().addAll(locales);
+ }
+
+ if (ParameterValidation.existsAndIsNotEmpty(mimeTypes))
+ {
+ resourceParams.getMimeTypes().addAll(mimeTypes);
+ }
+
+ resourceParams.setResourceID(resourceID);
+ resourceParams.setPortletStateChange(stateChange);
+
+ return resourceParams;
+ }
+
/**
* Same as createRuntimeContext({@link WSRPConstants#NONE_USER_AUTHENTICATION})
*
@@ -445,6 +506,14 @@
markupResponse.setMarkupContext(markupContext);
return markupResponse;
}
+
+ public static ResourceResponse createResourceResponse(ResourceContext resourceContext)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(resourceContext, "ResourceContext");
+ ResourceResponse resourceResponse = new ResourceResponse();
+ resourceResponse.setResourceContext(resourceContext);
+ return resourceResponse;
+ }
/**
* mimeType: The mime type of the returned markup. The mimeType field MUST be specified whenever markup is returned,
@@ -486,8 +555,56 @@
markupContext.setItemBinary(markupBinary);
return markupContext;
}
+
+ /**
+ * mimeType: The mime type of the returned resource. The mimeType field MUST be specified whenever resource is returned,
+ * and if the resourceBinary field is used to return the resource, the mime type MUST include the character set for
+ * textual mime types using the syntax specified in RFC1522[14] (e.g. "text/html; charset=UTF-8"). In this particular
+ * case this character set MAY be different than the response message.
+ * <p/>
+ */
+ public static ResourceContext createResourceContext(String mediaType, String resourceString)
+ {
+ return createResourceContext(mediaType, resourceString, null);
+ }
/**
+ * @param mediaType The mime type of the returned resource. The mimeType field MUST be specified whenever resource is
+ * returned, and if the resourceBinary field is used to return the resource, the mime type MUST include
+ * the character set for textual mime types using the syntax specified in RFC1522[14] (e.g.
+ * "text/html; charset=UTF-8"). In this particular case this character set MAY be different than the
+ * response message.
+ * @return a new ResourceContext
+ */
+ public static ResourceContext createResourceContext(String mediaType, byte[] resourceBinary)
+ {
+ return createResourceContext(mediaType, null, resourceBinary);
+ }
+
+ public static ResourceContext createResourceContext(String mediaType, String resourceString, byte[] resourceBinary)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mediaType, "MIME type", "ResourceContext");
+ if ((resourceString == null) && (resourceBinary == null || resourceBinary.length == 0))
+ {
+ throw new IllegalArgumentException("MarkupContext requires either a non-null markup string or binary markup.");
+ }
+
+ ResourceContext resourceContext = new ResourceContext();
+ resourceContext.setMimeType(mediaType);
+
+ if (resourceString != null)
+ {
+ resourceContext.setItemString(resourceString);
+ }
+ else
+ {
+ resourceContext.setItemBinary(resourceBinary);
+ }
+
+ return resourceContext;
+ }
+
+ /**
* @param sessionID An opaque string the Portlet defines for referencing state that is stored locally on the
* Producer. The maximum length of a sessionID is 4096 characters,
* @param expires Maximum number of seconds between invocations referencing the sessionID before the Producer will
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -31,8 +31,10 @@
import org.gatein.wsrp.WSRPRenderURL;
import org.gatein.wsrp.WSRPResourceURL;
import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
/**
@@ -49,7 +51,7 @@
WSRPPortletURL.setStrict(true);
}
- public void testResource()
+ public void testResourceURL()
{
String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif" +
"&wsrp-requiresRewrite=false/wsrp_rewrite";
@@ -59,9 +61,80 @@
WSRPResourceURL resource = (WSRPResourceURL)url;
assertFalse(resource.requiresRewrite());
assertEquals("http://test.com/images/test.gif", resource.getResourceURL().toExternalForm());
- assertEquals("http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif", resource.getResourceId());
+
+ //resource.getResourceId will not return the actual resource id, but an encoded resource map used to determine how to access the resource
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resource.getResourceId());
+ String resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
+ assertEquals("http://test.com/images/test.gif", resourceURL);
+
+ assertNull(resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID));
+ assertEquals("false",resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION));
}
+
+ public void testResourceID()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-resourceID=resource_123" +
+ "&wsrp-requiresRewrite=false/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+ assertTrue(url instanceof WSRPResourceURL);
+ WSRPResourceURL resource = (WSRPResourceURL)url;
+ assertFalse(resource.requiresRewrite());
+ assertNull(resource.getResourceURL());
+
+ //resource.getResourceId will not return the actual resource id, but an encoded resource map used to determine how to access the resource
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resource.getResourceId());
+ String resourceID = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ assertEquals("resource_123", resourceID);
+
+ assertNull(resourceMap.get(WSRPRewritingConstants.RESOURCE_URL));
+ assertEquals("false", resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION));
+ }
+
+ public void testResources()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-resourceID=resource_123" +
+ "&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif&wsrp-requiresRewrite=false/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+
+ assertTrue(url instanceof WSRPResourceURL);
+ WSRPResourceURL resource = (WSRPResourceURL)url;
+ assertFalse(resource.requiresRewrite());
+ assertEquals("http://test.com/images/test.gif", resource.getResourceURL().toExternalForm());
+
+ //resource.getResourceId will not return the actual resource id, but an encoded resource map used to determine how to access the resource
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resource.getResourceId());
+ String resourceID = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ assertEquals("resource_123", resourceID);
+
+ String resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
+ assertEquals("http://test.com/images/test.gif", resourceURL);
+ assertEquals("false",resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION));
+ }
+
+ public void testPreferOperation()
+ {
+ String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-resourceID=resource_123" +
+ "&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif&wsrp-preferOperation=true&wsrp-requiresRewrite=false/wsrp_rewrite";
+ WSRPPortletURL url = WSRPPortletURL.create(expected);
+
+ assertTrue(url instanceof WSRPResourceURL);
+ WSRPResourceURL resource = (WSRPResourceURL)url;
+ assertFalse(resource.requiresRewrite());
+ assertEquals("http://test.com/images/test.gif", resource.getResourceURL().toExternalForm());
+
+ //resource.getResourceId will not return the actual resource id, but an encoded resource map used to determine how to access the resource
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resource.getResourceId());
+ String resourceID = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ assertEquals("resource_123", resourceID);
+
+ String resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
+ assertEquals("http://test.com/images/test.gif", resourceURL);
+
+ String preferOperation = resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
+ assertEquals("true", preferOperation);
+ }
+
/** Declare a secure interaction back to the Portlet */
public void testSecureInteraction()
{
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -23,6 +23,14 @@
package org.gatein.wsrp.consumer;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.ws.Holder;
+
import org.apache.commons.httpclient.Cookie;
import org.gatein.common.io.IOTools;
import org.gatein.common.net.media.MediaType;
@@ -30,27 +38,38 @@
import org.gatein.common.util.MultiValuedPropertyMap;
import org.gatein.common.util.Tools;
import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.cache.CacheScope;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.ResourceInvocation;
import org.gatein.pc.api.invocation.response.ContentResponse;
+import org.gatein.pc.api.invocation.response.ErrorResponse;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.api.invocation.response.ResponseProperties;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPResourceURL;
+import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.handler.CookieUtil;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
+import org.oasis.wsrp.v2.CacheControl;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetResource;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.ResourceResponse;
import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.SessionContext;
import org.oasis.wsrp.v2.UserContext;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
public class ResourceHandler extends InvocationHandler
{
+ private static final org.gatein.pc.api.cache.CacheControl DEFAULT_CACHE_CONTROL = new org.gatein.pc.api.cache.CacheControl(0, CacheScope.PRIVATE, null);
+
protected ResourceHandler(WSRPConsumerImpl consumer)
{
super(consumer);
@@ -59,28 +78,136 @@
@Override
protected void updateUserContext(Object request, UserContext userContext)
{
- //To change body of implemented methods use File | Settings | File Templates.
+ if (request instanceof GetResource)
+ {
+ getResourceRequest(request).setUserContext(userContext);
+ }
}
@Override
protected void updateRegistrationContext(Object request) throws PortletInvokerException
{
- //To change body of implemented methods use File | Settings | File Templates.
+ if (request instanceof GetResource)
+ {
+ getResourceRequest(request).setRegistrationContext(consumer.getRegistrationContext());
+ }
}
@Override
protected RuntimeContext getRuntimeContextFrom(Object request)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ if (request instanceof GetResource)
+ return getResourceRequest(request).getRuntimeContext();
+ else
+ return null;
}
@Override
+ protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ {
+ if (!(invocation instanceof ResourceInvocation))
+ {
+ throw new IllegalArgumentException("ResourceHandler can only handle ResourceInvocations!");
+ }
+
+ ResourceInvocation resourceInvocation = (ResourceInvocation) invocation;
+
+ String resourceInvocationId = resourceInvocation.getResourceId();
+
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resourceInvocationId);
+
+ String resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ String resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
+ String preferOperation = resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
+
+ int version = 1;
+ try
+ {
+ version = consumer.getMarkupService().getVersion();
+ }
+ catch (PortletInvokerException portletInvokerException)
+ {
+ log.warn("Encountered an exception when trying to get the consumer's markup service's version, assuming WSRP 1.0 compliant.", portletInvokerException);
+ }
+
+ if (version == 2 && resourceId != null && resourceId.length() > 0 && (preferOperation.equalsIgnoreCase("true") || resourceURL != null || resourceURL.isEmpty()))
+ {
+ return prepareGetResourceRequest(requestPrecursor, resourceInvocation, resourceId);
+ }
+ else
+ {
+ return resourceURL;
+ }
+
+ }
+
+ private GetResource prepareGetResourceRequest(RequestPrecursor requestPrecursor, ResourceInvocation invocation, String resourceId)
+ {
+ PortletContext portletContext = requestPrecursor.getPortletContext();
+
+ ResourceParams resourceParams = new ResourceParams();
+
+ resourceParams.setResourceID(resourceId);
+
+ resourceParams.setClientData(requestPrecursor.markupParams.getClientData());
+ resourceParams.setMode(requestPrecursor.markupParams.getMode());
+ resourceParams.setNavigationalContext(requestPrecursor.markupParams.getNavigationalContext());
+ resourceParams.setSecureClientCommunication(requestPrecursor.markupParams.isSecureClientCommunication());
+ resourceParams.setValidateTag(requestPrecursor.markupParams.getValidateTag());
+ resourceParams.setWindowState(requestPrecursor.markupParams.getWindowState());
+
+ resourceParams.getMimeTypes().addAll(requestPrecursor.markupParams.getMimeTypes());
+
+ //TODO
+ //resourceParams.setPortletStateChange(...);
+ //resourceParams.setResourceCacheability(...);
+
+ if (invocation.getResourceState() != null)
+ {
+ resourceParams.setResourceState(invocation.getResourceState().getStringValue());
+ }
+
+ GetResource getResource = WSRPTypeFactory.createResourceRequest(portletContext, requestPrecursor.runtimeContext, resourceParams);
+
+ return getResource;
+ }
+
+ @Override
protected Object performRequest(Object request) throws Exception
{
- ResourceInvocation invocation = (ResourceInvocation)request;
- String resourceId = invocation.getResourceId();
+ if (request instanceof GetResource)
+ {
+ return performGetResourceRequest((GetResource)request);
+ }
+ else if (request instanceof String)
+ {
+ return performURLRequest((String)request);
+ }
+ else
+ {
+ throw new IllegalArgumentException("ResourceHandler performRequest can only be called with a GetResource or String object. Received : " + request);
+ }
- URL url = new URL(resourceId);
+ }
+
+ private ResourceResponse performGetResourceRequest(GetResource getResource) throws Exception
+ {
+ Holder<SessionContext> sessionContextHolder = new Holder<SessionContext>();
+ Holder<ResourceContext> resourceContextHolder = new Holder<ResourceContext>();
+ Holder<PortletContext> portletContextHolder = new Holder<PortletContext>(getResource.getPortletContext());
+
+ consumer.getMarkupService().getResource(getResource.getRegistrationContext(), portletContextHolder, getResource.getRuntimeContext(),
+ getResource.getUserContext(), getResource.getResourceParams(), resourceContextHolder, sessionContextHolder, new Holder<List<Extension>>());
+
+ ResourceResponse resourceResponse = WSRPTypeFactory.createResourceResponse(resourceContextHolder.value);
+ resourceResponse.setPortletContext(portletContextHolder.value);
+ resourceResponse.setSessionContext(sessionContextHolder.value);
+ return resourceResponse;
+ }
+
+ private ContentResponse performURLRequest(String resourceURL) throws Exception
+ {
+ URL url = new URL(resourceURL);
URLConnection urlConnection = url.openConnection();
String contentType = urlConnection.getContentType();
@@ -149,28 +276,92 @@
return result;
}
-
+
@Override
- protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
{
- if (!(invocation instanceof ResourceInvocation))
+ if (response instanceof ResourceResponse)
{
- throw new IllegalArgumentException("ResourceHandler can only handle ResourceInvocations!");
+ return processGetResourceResponse((ResourceResponse)response, invocation, requestPrecursor);
}
-
- return invocation;
+ else if (response instanceof ContentResponse)
+ {
+ return (ContentResponse) response;
+ }
+ else
+ {
+ throw new PortletInvokerException("Invalid response object: " + response + ". Expected either a " + ContentResponse.class + " or a " + ResourceResponse.class);
+ }
}
-
- @Override
- protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
+
+ private PortletInvocationResponse processGetResourceResponse(ResourceResponse resourceResponse, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
{
- if (response instanceof ContentResponse)
+ ResourceContext resourceContext = resourceResponse.getResourceContext();
+
+ String chars = resourceContext.getItemString();
+ byte[] binary = resourceContext.getItemBinary();
+
+ ResponseProperties properties = null;
+ Map<String, Object> attributes = null;
+
+ String mimeType = resourceContext.getMimeType();
+ if (mimeType == null || mimeType.length() == 0)
{
- return (ContentResponse)response;
+ return new ErrorResponse(new IllegalArgumentException("No MIME type was provided for portlet content."));
}
- else
+
+ // generate appropriate CacheControl
+ org.gatein.pc.api.cache.CacheControl cacheControl = createCacheControl(resourceContext);
+
+ return new ContentResponse(properties, attributes, mimeType, binary, chars, cacheControl);
+ }
+
+ private org.gatein.pc.api.cache.CacheControl createCacheControl(ResourceContext resourceContext)
+ {
+ CacheControl cacheControl = resourceContext.getCacheControl();
+ org.gatein.pc.api.cache.CacheControl result = DEFAULT_CACHE_CONTROL;
+
+ int expires;
+ if (cacheControl != null)
{
- throw new PortletInvokerException("Invalid response object: " + response);
+ expires = cacheControl.getExpires();
+ String userScope = cacheControl.getUserScope();
+
+ // check that we support the user scope...
+ if (consumer.supportsUserScope(userScope))
+ {
+ if (debug)
+ {
+ log.debug("RenderHandler.processRenderRequest: trying to cache markup " + userScope + " for " + expires + " seconds.");
+ }
+ CacheScope scope;
+ if (WSRPConstants.CACHE_FOR_ALL.equals(userScope))
+ {
+ scope = CacheScope.PUBLIC;
+ }
+ else if (WSRPConstants.CACHE_PER_USER.equals(userScope))
+ {
+ scope = CacheScope.PRIVATE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown CacheControl user scope: " + userScope); // should not happen
+ }
+
+ result = new org.gatein.pc.api.cache.CacheControl(expires, scope, cacheControl.getValidateTag());
+ }
}
+
+ return result;
}
+
+ private GetResource getResourceRequest(Object request)
+ {
+ if (request instanceof GetResource)
+ {
+ return (GetResource)request;
+ }
+
+ throw new IllegalArgumentException("ResourceHandler: Request is not a GetResource request!");
+ }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupService.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/MarkupService.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -136,5 +136,6 @@
UserContext userContext)
throws AccessDenied, InvalidRegistration, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended;
-
+
+ public abstract int getVersion();
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v1/V1MarkupService.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -307,4 +307,10 @@
throw V1ToV2Converter.toV2Exception(OperationFailed.class, operationFailed);
}
}
+
+ @Override
+ public int getVersion()
+ {
+ return 1;
+ }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v2/V2MarkupService.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v2/V2MarkupService.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/services/v2/V2MarkupService.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -106,4 +106,10 @@
{
return service.initCookie(registrationContext, userContext);
}
+
+ @Override
+ public int getVersion()
+ {
+ return 2;
+ }
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/MarkupTestCase.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -39,6 +39,7 @@
import org.gatein.pc.portlet.impl.spi.AbstractSecurityContext;
import org.gatein.pc.portlet.impl.spi.AbstractUserContext;
import org.gatein.pc.portlet.impl.spi.AbstractWindowContext;
+import org.gatein.wsrp.WSRPResourceURL;
import org.gatein.wsrp.consumer.ProducerSessionInformation;
import org.gatein.wsrp.test.ExtendedAssert;
import org.gatein.wsrp.test.protocol.v1.BehaviorRegistry;
@@ -66,6 +67,9 @@
import javax.servlet.http.HttpSession;
import javax.xml.ws.Holder;
+
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
@@ -208,14 +212,16 @@
ExtendedAssert.assertEquals(3, behavior.getInitCookieCallCount());
}
- public void testResource() throws PortletInvokerException
+ public void testResource() throws PortletInvokerException, MalformedURLException
{
RenderInvocation render = createRenderInvocation(ResourceMarkupBehavior.PORTLET_HANDLE);
PortletInvocationResponse response = consumer.invoke(render);
- //TODO: fix this test properly, we can't test it properly right now without creating a new TestPortletInvocationContext as it will disrupt other tests
- checkRenderResult(response, "<img src='Resource id=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif ns=null ws=null m=null'/>");
- //checkRenderResult(response, "<img src='http://localhost:8080/test-resource-portlet/gif/logo.gif'/>");
+ String resourceID = WSRPResourceURL.encodeResource(null, new URL("http://localhost:8080/test-resource-portlet/gif/logo.gif"), false);
+ String expectedResult = "<img src='Resource id=" + resourceID + " ns=null ws=null m=null'/>";
+
+ //NOTE: the value we get back is from the TestPortletInvocationContext, not what we would normally receive
+ checkRenderResult(response, expectedResult);
}
private ProducerSessionInformation commonInitCookieTest(String handle, InitCookieMarkupBehavior behavior, String cookieProtocol)
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ActionRequestProcessor.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -37,6 +37,7 @@
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PerformBlockingInteraction;
@@ -77,7 +78,7 @@
return performBlockingInteraction.getRuntimeContext();
}
- MarkupParams getMarkupParams()
+ MimeRequest getParams()
{
return performBlockingInteraction.getMarkupParams();
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/EventRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/EventRequestProcessor.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/EventRequestProcessor.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -42,6 +42,7 @@
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.OperationNotSupported;
@@ -102,7 +103,7 @@
}
@Override
- MarkupParams getMarkupParams()
+ MimeRequest getParams()
{
return handleEvents.getMarkupParams();
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/MarkupHandler.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -25,6 +25,7 @@
import org.gatein.common.NotYetImplemented;
import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.invocation.response.ContentResponse;
import org.gatein.pc.api.invocation.response.ErrorResponse;
import org.gatein.pc.api.invocation.response.FragmentResponse;
import org.gatein.pc.api.invocation.response.HTTPRedirectionResponse;
@@ -75,6 +76,7 @@
{
static final String PBI = "PerformBlockingInteraction";
static final String GET_MARKUP = "GetMarkup";
+ static final String GET_RESOURCE = "GetResource";
MarkupHandler(WSRPProducerImpl producer)
{
@@ -108,6 +110,33 @@
return (MarkupResponse)requestProcessor.processResponse(response);
}
+ public ResourceResponse getResource(GetResource getResource) throws AccessDenied, InconsistentParameters,
+ InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession, InvalidUserCategory, MissingParameters,
+ ModifyRegistrationRequired, OperationFailed, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType,
+ UnsupportedMode, UnsupportedWindowState
+ {
+ WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(getResource, GET_RESOURCE);
+
+ ResourceRequestProcessor requestProcessor = new ResourceRequestProcessor(producer, getResource);
+
+ String handle = requestProcessor.getPortletContext().getPortletHandle();
+ PortletInvocationResponse response;
+ try
+ {
+ log.debug("ResourceInvocation on portlet '" + handle + "'");
+ response = producer.getPortletInvoker().invoke(requestProcessor.getInvocation());
+ log.debug("ResourceInvocation done");
+ }
+ catch (PortletInvokerException e)
+ {
+ throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Could not access portlet resource '" + handle + "'", e);
+ }
+
+ checkForError(response);
+
+ return (ResourceResponse)requestProcessor.processResponse(response);
+ }
+
public BlockingInteractionResponse performBlockingInteraction(PerformBlockingInteraction performBlockingInteraction) throws InvalidSession, UnsupportedMode, UnsupportedMimeType, OperationFailed, UnsupportedWindowState, UnsupportedLocale, AccessDenied, PortletStateChangeRequired, InvalidRegistration, MissingParameters, InvalidUserCategory, InconsistentParameters, InvalidHandle, InvalidCookie
{
WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(performBlockingInteraction, PBI);
@@ -188,11 +217,6 @@
return (HandleEventsResponse)requestProcessor.processResponse(response);
}
- public ResourceResponse getResource(GetResource getResource) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
- {
- throw new NotYetImplemented();
- }
-
static void throwOperationFaultOnSessionOperation() throws OperationFailed
{
throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "JBoss Portal's Producer" +
@@ -221,7 +245,7 @@
throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, errorResult.getMessage(), cause);
}
- else if (!(response instanceof HTTPRedirectionResponse || response instanceof FragmentResponse || response instanceof UpdateNavigationalStateResponse))
+ else if (!(response instanceof HTTPRedirectionResponse || response instanceof FragmentResponse || response instanceof UpdateNavigationalStateResponse || response instanceof ContentResponse))
{
throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Unsupported result type: " + response.getClass().getName(), null);
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RenderRequestProcessor.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -40,6 +40,7 @@
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.MarkupContext;
import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
@@ -78,7 +79,7 @@
return getMarkup.getRuntimeContext();
}
- MarkupParams getMarkupParams()
+ MimeRequest getParams()
{
return getMarkup.getMarkupParams();
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/RequestProcessor.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -45,8 +45,8 @@
import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.oasis.wsrp.v2.InvalidHandle;
import org.oasis.wsrp.v2.InvalidRegistration;
-import org.oasis.wsrp.v2.MarkupParams;
import org.oasis.wsrp.v2.MarkupType;
+import org.oasis.wsrp.v2.MimeRequest;
import org.oasis.wsrp.v2.MissingParameters;
import org.oasis.wsrp.v2.NamedString;
import org.oasis.wsrp.v2.NavigationalContext;
@@ -102,8 +102,8 @@
checkForSessionIDs(runtimeContext);
- // get markup parameters
- final MarkupParams params = getMarkupParams();
+ // get parameters
+ final MimeRequest params = getParams();
WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(params, "MarkupParams", getContextName());
// get portlet handle
@@ -176,7 +176,7 @@
abstract RuntimeContext getRuntimeContext();
- abstract MarkupParams getMarkupParams();
+ abstract MimeRequest getParams();
abstract PortletContext getPortletContext();
@@ -200,7 +200,7 @@
* @param portlet
* @return a MarkupRequest containing the most appropriate information to base markup generation for this request
*/
- private MarkupRequest createMarkupRequestFrom(List<MarkupType> markupTypes, MarkupParams params, Portlet portlet)
+ private MarkupRequest createMarkupRequestFrom(List<MarkupType> markupTypes, MimeRequest params, Portlet portlet)
throws UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
{
List<String> desiredMIMETypes = params.getMimeTypes();
@@ -283,7 +283,7 @@
}
catch (IllegalArgumentException e)
{
- throw WSRP2ExceptionFactory.throwWSException(UnsupportedWindowState.class, "Unsupported window state '" + params.getMode() + "'", e);
+ throw WSRP2ExceptionFactory.throwWSException(UnsupportedWindowState.class, "Unsupported window state '" + params.getWindowState() + "'", e);
}
// get the character set
@@ -400,7 +400,7 @@
return UserContextConverter.createPortalUserContextFrom(userContext, supportedLocales, preferredLocale);
}
- private PortalContext createPortalContext(final MarkupParams params, final MarkupRequest markupRequest)
+ private PortalContext createPortalContext(final MimeRequest params, final MarkupRequest markupRequest)
{
return new PortalContext()
{
@@ -463,7 +463,7 @@
// fix-me: check that the correct semantics is used.
- private SecurityContext createSecurityContext(final MarkupParams params, final RuntimeContext runtimeContext,
+ private SecurityContext createSecurityContext(final MimeRequest params, final RuntimeContext runtimeContext,
final org.oasis.wsrp.v2.UserContext wsrpUserContext)
{
return new SecurityContext()
Added: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java (rev 0)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -0,0 +1,229 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.gatein.wsrp.producer;
+
+import org.gatein.common.NotYetImplemented;
+import org.gatein.common.net.URLTools;
+import org.gatein.pc.api.Portlet;
+import org.gatein.pc.api.cache.CacheLevel;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.ResourceInvocation;
+import org.gatein.pc.api.invocation.response.ContentResponse;
+import org.gatein.pc.api.invocation.response.FragmentResponse;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.state.AccessMode;
+import org.gatein.pc.portlet.impl.jsr168.PortletUtils;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.servlet.ServletAccess;
+import org.oasis.wsrp.v2.CacheControl;
+import org.oasis.wsrp.v2.GetResource;
+import org.oasis.wsrp.v2.InvalidHandle;
+import org.oasis.wsrp.v2.InvalidRegistration;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.MimeRequest;
+import org.oasis.wsrp.v2.MissingParameters;
+import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.PortletDescription;
+import org.oasis.wsrp.v2.RegistrationContext;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.ResourceResponse;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.UnsupportedMimeType;
+import org.oasis.wsrp.v2.UnsupportedMode;
+import org.oasis.wsrp.v2.UnsupportedWindowState;
+import org.oasis.wsrp.v2.UserContext;
+
+/**
+ *
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class ResourceRequestProcessor extends RequestProcessor
+{
+
+ private static final String EMPTY = "";
+
+ private final GetResource getResource;
+ private String namespace;
+
+ public ResourceRequestProcessor(WSRPProducerImpl producer, GetResource getResource) throws InvalidRegistration, OperationFailed, MissingParameters, InvalidHandle, UnsupportedMimeType, UnsupportedWindowState, UnsupportedMode
+ {
+ super(producer);
+ this.getResource = getResource;
+ prepareInvocation();
+ }
+
+ public PortletInvocation getInvocation()
+ {
+ return invocation;
+ }
+
+ public PortletContext getPortletContext()
+ {
+ return getResource.getPortletContext();
+ }
+
+ public ResourceResponse processResponse(PortletInvocationResponse response)
+ {
+ ContentResponse content = (ContentResponse)response;
+ String resourceString = null;
+ byte[] resourceBinary = null;
+ switch (content.getType())
+ {
+ case ContentResponse.TYPE_CHARS:
+ resourceString = processFragmentString(content.getChars());
+ break;
+ case ContentResponse.TYPE_BYTES:
+ resourceBinary = content.getBytes(); // fix-me: might need to convert to Base64?
+ break;
+ case ContentResponse.TYPE_EMPTY:
+ resourceString = EMPTY;
+ break;
+ }
+
+ ResourceContext resourceContext;
+ if (resourceString != null)
+ {
+ resourceContext = WSRPTypeFactory.createResourceContext(content.getContentType(), resourceString);
+ }
+ else
+ {
+ resourceContext = WSRPTypeFactory.createResourceContext(content.getContentType(), resourceBinary);
+ }
+
+ resourceContext.setLocale(markupRequest.getLocale());
+
+ //TODO: figure out requiresRewriting and useCachedItem
+ Boolean requiresRewriting = false;
+ Boolean useCachedItem = false;
+ resourceContext.setRequiresRewriting(requiresRewriting);
+ resourceContext.setUseCachedItem(useCachedItem);
+
+ //TODO: check if anything actually uses the ccpp profile warning
+ String ccppProfileWarning = null;
+ resourceContext.setCcppProfileWarning(ccppProfileWarning);
+
+ // cache information
+ int expires = content.getCacheControl().getExpirationSecs();
+ // only create a CacheControl if expiration time is not 0
+ if (expires != 0)
+ {
+ // if expires is negative, replace by -1 to make sure
+ if (expires < 0)
+ {
+ expires = -1;
+ }
+
+ resourceContext.setCacheControl(WSRPTypeFactory.createCacheControl(expires, WSRPConstants.CACHE_PER_USER));
+ }
+
+ return WSRPTypeFactory.createResourceResponse(resourceContext);
+ }
+
+ /**
+ * Process String returned from RenderResult to add rewriting token if necessary, replacing namespaces by the WSRP
+ * rewrite token. fix-me: need to check for producer rewriting
+ *
+ * @param renderString the String to be processed for rewriting marking
+ * @return a String processed to add rewriting tokens as necessary
+ */
+ private String processFragmentString(String renderString)
+ {
+ String result = renderString.replaceAll(namespace, WSRPRewritingConstants.WSRP_REWRITE_TOKEN);
+
+ result = URLTools.replaceURLsBy(result, new WSRPUtils.AbsoluteURLReplacementGenerator(ServletAccess.getRequest()));
+ return result;
+ }
+
+ @Override
+ AccessMode getAccessMode() throws MissingParameters
+ {
+ return AccessMode.READ_ONLY;
+ }
+
+ @Override
+ String getContextName()
+ {
+ return MarkupHandler.GET_RESOURCE;
+ }
+
+ @Override
+ MimeRequest getParams()
+ {
+ return getResource.getResourceParams();
+ }
+
+ @Override
+ RegistrationContext getRegistrationContext()
+ {
+ return getResource.getRegistrationContext();
+ }
+
+ @Override
+ RuntimeContext getRuntimeContext()
+ {
+ return getResource.getRuntimeContext();
+ }
+
+ @Override
+ UserContext getUserContext()
+ {
+ return getResource.getUserContext();
+ }
+
+ @Override
+ PortletInvocation initInvocation(WSRPPortletInvocationContext context)
+ {
+ // MUST match namespace generation used in PortletResponseImpl.getNamespace in portlet module...
+ namespace = PortletUtils.generateNamespaceFrom(context.getWindowContext().getId());
+ ResourceInvocation resourceInvocation = new ResourceInvocation(context);
+
+ ResourceParams resourceParams = this.getResource.getResourceParams();
+
+ resourceInvocation.setResourceId(this.getResource.getResourceParams().getResourceID());
+
+ WSRPRequestContext requestContext = WSRPRequestContext.createRequestContext(markupRequest, resourceParams);
+ resourceInvocation.setRequestContext(requestContext);
+ resourceInvocation.setForm(requestContext.getForm());
+
+ //TODO: property set validation token for caching (ie ETAG)
+ String validationToken = null;
+ resourceInvocation.setValidationToken(validationToken);
+
+ resourceInvocation.setResourceState(createNavigationalState(resourceParams.getResourceState()));
+
+ if (resourceParams.getResourceCacheability() != null)
+ {
+ CacheLevel cacheLevel = CacheLevel.valueOf(resourceParams.getResourceCacheability());
+ resourceInvocation.setCacheLevel(cacheLevel);
+ }
+
+ return resourceInvocation;
+ }
+}
+
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPPortletInvocationContext.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -136,7 +136,6 @@
if (url instanceof WSRPResourceURL)
{
WSRPResourceURL resourceURL = (WSRPResourceURL)url;
- resourceURL.buildURLWith(request, instanceContext.getPortletContext());
}
return url.toString();
}
Modified: components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPRequestContext.java
===================================================================
--- components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPRequestContext.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/WSRPRequestContext.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -28,6 +28,7 @@
import org.gatein.pc.api.spi.RequestContext;
import org.oasis.wsrp.v2.InteractionParams;
import org.oasis.wsrp.v2.NamedString;
+import org.oasis.wsrp.v2.ResourceParams;
import org.oasis.wsrp.v2.UploadContext;
import javax.mail.MessagingException;
@@ -231,10 +232,16 @@
public static WSRPRequestContext createRequestContext(MarkupRequest markupRequest, InteractionParams interactionParams)
{
- List<NamedString> formParams = interactionParams.getFormParameters();
- List<UploadContext> uploadContexts = interactionParams.getUploadContexts();
-
-
+ return createRequestContext(markupRequest, interactionParams.getFormParameters(), interactionParams.getUploadContexts());
+ }
+
+ public static WSRPRequestContext createRequestContext(MarkupRequest markupRequest, ResourceParams resourceParams)
+ {
+ return createRequestContext(markupRequest, resourceParams.getFormParameters(), resourceParams.getUploadContexts());
+ }
+
+ public static WSRPRequestContext createRequestContext(MarkupRequest markupRequest, List<NamedString> formParams, List<UploadContext> uploadContexts)
+ {
if (uploadContexts != null && !uploadContexts.isEmpty())
{
try
Modified: components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java
===================================================================
--- components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java 2010-07-20 16:10:35 UTC (rev 3666)
+++ components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java 2010-07-20 19:47:00 UTC (rev 3667)
@@ -31,6 +31,7 @@
import org.oasis.wsrp.v2.EventParams;
import org.oasis.wsrp.v2.Extension;
import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.GetResource;
import org.oasis.wsrp.v2.HandleEvents;
import org.oasis.wsrp.v2.HandleEventsFailed;
import org.oasis.wsrp.v2.HandleEventsResponse;
@@ -56,6 +57,7 @@
import org.oasis.wsrp.v2.ReleaseSessions;
import org.oasis.wsrp.v2.ResourceContext;
import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.ResourceResponse;
import org.oasis.wsrp.v2.ResourceSuspended;
import org.oasis.wsrp.v2.ReturnAny;
import org.oasis.wsrp.v2.RuntimeContext;
@@ -182,7 +184,20 @@
InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
{
- throw new NotYetImplemented();
+ forceSessionAccess();
+ GetResource getResource = new GetResource();
+ getResource.setPortletContext(portletContext.value);
+ getResource.setRegistrationContext(registrationContext);
+ getResource.setResourceParams(resourceParams);
+ getResource.setRuntimeContext(runtimeContext);
+ getResource.setUserContext(userContext);
+
+ ResourceResponse response = producer.getResource(getResource);
+
+ resourceContext.value = response.getResourceContext();
+ sessionContext.value = response.getSessionContext();
+ portletContext.value = response.getPortletContext();
+ extensions.value = response.getExtensions();
}
public void performBlockingInteraction(@WebParam(name = "registrationContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RegistrationContext registrationContext, @WebParam(name = "portletContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") PortletContext portletContext, @WebParam(name = "runtimeContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") RuntimeContext runtimeContext, @WebParam(name = "userContext", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") UserContext userContext, @WebParam(name = "markupParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") MarkupParams markupParams, @WebParam(name = "interactionParams", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types") InteractionParams interactionParams, @WebParam(name = "updateResponse", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<UpdateResponse> updateResponse, @WebParam(name = "redirectURL", targetNamespace = "urn:oasis:na!
mes:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<String> redirectURL, @WebParam(name = "extensions", targetNamespace = "urn:oasis:names:tc:wsrp:v2:types", mode = WebParam.Mode.OUT) Holder<List<Extension>> extensions) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession, InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, PortletStateChangeRequired, ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
14 years, 5 months
gatein SVN: r3666 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-07-20 12:10:35 -0400 (Tue, 20 Jul 2010)
New Revision: 3666
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
Log:
remove useless method
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2010-07-20 16:06:50 UTC (rev 3665)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2010-07-20 16:10:35 UTC (rev 3666)
@@ -80,13 +80,6 @@
addChild(selector);
}
- @Override
- public String url(String name) throws Exception
- {
- // TODO Auto-generated method stub
- return super.url(name);
- }
-
public String getName()
{
return name_;
14 years, 5 months
gatein SVN: r3665 - portal/trunk/server/tomcat/patch/src/main/tomcat/bin.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-07-20 12:06:50 -0400 (Tue, 20 Jul 2010)
New Revision: 3665
Modified:
portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein-dev.sh
portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein.sh
Log:
GTNPORTAL-1446 : Use headless awt mode in tomcat startup scripts
Modified: portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein-dev.sh
===================================================================
--- portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein-dev.sh 2010-07-20 15:38:08 UTC (rev 3664)
+++ portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein-dev.sh 2010-07-20 16:06:50 UTC (rev 3665)
@@ -24,7 +24,7 @@
# Sets some variables
LOG_OPTS="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog"
SECURITY_OPTS="-Djava.security.auth.login.config=../conf/jaas.conf"
-EXO_OPTS="-Dexo.product.developing=true -Dexo.conf.dir.name=gatein/conf"
+EXO_OPTS="-Dexo.product.developing=true -Dexo.conf.dir.name=gatein/conf -Djava.awt.headless=true"
EXO_CONFIG_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.exoplatform.container.configuration.debug"
JPDA_TRANSPORT=dt_socket
Modified: portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein.sh
===================================================================
--- portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein.sh 2010-07-20 15:38:08 UTC (rev 3664)
+++ portal/trunk/server/tomcat/patch/src/main/tomcat/bin/gatein.sh 2010-07-20 16:06:50 UTC (rev 3665)
@@ -27,7 +27,7 @@
# Sets some variables
LOG_OPTS="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog"
SECURITY_OPTS="-Djava.security.auth.login.config=../conf/jaas.conf"
-EXO_OPTS="-Dexo.product.developing=false -Dexo.conf.dir.name=gatein/conf"
+EXO_OPTS="-Dexo.product.developing=false -Dexo.conf.dir.name=gatein/conf -Djava.awt.headless=true"
JAVA_OPTS="-Xms128m -Xmx384m -XX:MaxPermSize=192m $JAVA_OPTS $LOG_OPTS $SECURITY_OPTS $EXO_OPTS"
export JAVA_OPTS
14 years, 5 months
gatein SVN: r3664 - portal/trunk/component/web/src/main/java/org/exoplatform/web/resource/config/xml.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-07-20 11:38:08 -0400 (Tue, 20 Jul 2010)
New Revision: 3664
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/resource/config/xml/FCKConfigListener.java
Log:
note for inspection
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/resource/config/xml/FCKConfigListener.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/resource/config/xml/FCKConfigListener.java 2010-07-20 12:24:21 UTC (rev 3663)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/resource/config/xml/FCKConfigListener.java 2010-07-20 15:38:08 UTC (rev 3664)
@@ -3,6 +3,9 @@
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
+/**
+ * todo : julien : is it still used ?
+ */
public class FCKConfigListener implements ServletContextListener
{
public static String FCK_CONTEXT_PATH;
14 years, 5 months
gatein SVN: r3663 - in portal/trunk/packaging: jboss-as/pkg and 1 other directories.
by do-not-reply@jboss.org
Author: mpodolin
Date: 2010-07-20 08:24:21 -0400 (Tue, 20 Jul 2010)
New Revision: 3663
Modified:
portal/trunk/packaging/jboss-as/pkg/pom.xml
portal/trunk/packaging/jboss-as/pkg/src/assembly/jboss-as-init.xml
portal/trunk/packaging/pom.xml
Log:
GTNMAVEN-15: jboss-as packager enhancements (downloading of the AS by default)
Modified: portal/trunk/packaging/jboss-as/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/jboss-as/pkg/pom.xml 2010-07-20 06:36:06 UTC (rev 3662)
+++ portal/trunk/packaging/jboss-as/pkg/pom.xml 2010-07-20 12:24:21 UTC (rev 3663)
@@ -10,7 +10,13 @@
</parent>
<artifactId>exo.portal.packaging.jboss-as.pkg</artifactId>
<packaging>pom</packaging>
- <name>GateIn PKG</name>
+ <name>GateIn for JBoss AS packaging</name>
+
+ <properties>
+ <download.dir.app-server>${basedir}/app-serv-downloads/</download.dir.app-server>
+ <download.url.jboss-as51>http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-5.1.0.GA/jboss...</download.url.jboss-as51>
+ <download.archive-dir.jboss-as51>jboss-5.1.0.GA</download.archive-dir.jboss-as51>
+ </properties>
<dependencies>
<dependency>
@@ -21,54 +27,77 @@
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <!-- default profile - user did not specified a path to the jboss-as, downloading one from sourceforge -->
+
+ <id>jboss-as-provided-by-packager</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+
+ <properties>
+ <jbossas.dir>${download.dir.app-server}/${download.archive-dir.jboss-as51}/${download.archive-dir.jboss-as51}</jbossas.dir>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0.2</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>jboss5x</containerId>
+ <zipUrlInstaller>
+ <url>${download.url.jboss-as51}</url>
+ <installDir>${download.dir.app-server}</installDir>
+ </zipUrlInstaller>
+ </container>
+ </configuration>
+ <executions>
+ <execution>
+ <id>download-jboss-as-51</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <!-- packager will use the jboss-as provided by ${jbossas.dir} variable -->
+
+ <id>jboss-as-user-defined</id>
+ <activation>
+ <property>
+ <name>jbossas.dir</name>
+ </property>
+ </activation>
+ </profile>
+ </profiles>
+
<build>
<finalName>jboss-as-pkg</finalName>
<plugins>
- <!-- Ensure your environment is correctly setup -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>jbossas-check-environment-ready</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireProperty>
- <property>exo.projects.directory.dependencies</property>
- <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
- </requireProperty>
- <requireProperty>
- <property>exo.projects.app.jboss.version</property>
- <message>"You must define the property exo.projects.app.jboss.version to give the name of the directory where is stored JBossAS"</message>
- </requireProperty>
- <requireFilesExist>
- <files>
- <file>${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}/</file>
- </files>
- <message>"The following JBossAS directory doesn't exist: ${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}"</message>
- </requireFilesExist>
- </rules>
- <fail>true</fail>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
+ <!-- copy jboss-as to working directory etc... -->
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>src/assembly/jboss-as-init.xml</descriptor>
</descriptors>
</configuration>
+ <version>2.2-beta-5</version>
<executions>
<execution>
<id>init-assembly</id>
- <phase>generate-resources</phase>
+ <phase>process-resources</phase>
<goals>
<goal>single</goal>
</goals>
@@ -77,6 +106,7 @@
</plugin>
<plugin>
+ <!-- unpack/copy GateIn artifacts into the jboss-as deploy dir -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
@@ -154,6 +184,7 @@
</plugin>
<plugin>
+ <!-- patch several files (log4j config etc...) -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-patch-plugin</artifactId>
<version>1.1.1</version>
Modified: portal/trunk/packaging/jboss-as/pkg/src/assembly/jboss-as-init.xml
===================================================================
--- portal/trunk/packaging/jboss-as/pkg/src/assembly/jboss-as-init.xml 2010-07-20 06:36:06 UTC (rev 3662)
+++ portal/trunk/packaging/jboss-as/pkg/src/assembly/jboss-as-init.xml 2010-07-20 12:24:21 UTC (rev 3663)
@@ -11,7 +11,7 @@
<fileSets>
<!-- copy jboss as - without unix executables -->
<fileSet>
- <directory>${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}</directory>
+ <directory>${jbossas.dir}</directory>
<outputDirectory>jboss-as</outputDirectory>
<excludes>
<exclude>bin/*.sh</exclude>
@@ -19,7 +19,7 @@
</fileSet>
<!-- copy jboss as - only unix executabls -->
<fileSet>
- <directory>${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}/bin</directory>
+ <directory>${jbossas.dir}/bin</directory>
<outputDirectory>jboss-as/bin</outputDirectory>
<includes>
<include>*.sh</include>
Modified: portal/trunk/packaging/pom.xml
===================================================================
--- portal/trunk/packaging/pom.xml 2010-07-20 06:36:06 UTC (rev 3662)
+++ portal/trunk/packaging/pom.xml 2010-07-20 12:24:21 UTC (rev 3663)
@@ -47,11 +47,16 @@
<profile>
<id>pkg-jbossas-beta</id>
<modules>
- <module>module</module>
- <module>product</module>
<module>jboss-as</module>
<module>reports</module>
</modules>
</profile>
+ <profile>
+ <id>pkg-tomcat-beta</id>
+ <modules>
+ <module>tomcat</module>
+ <module>reports</module>
+ </modules>
+ </profile>
</profiles>
</project>
14 years, 5 months