Here's my code...
public boolean saveRoleInfo(WebdavResource session)
{
boolean retVal = true;
PropertyName name = new PropertyName("D", "group-member-set");
if (dirtyFlag)
{
StringBuffer output = new StringBuffer();
for (Iterator iter = roleMembers.iterator();
iter.hasNext();)
{
StringBuffer userOut = new StringBuffer();
String userID = (String)iter.next();
userOut.append("<D:href>");
userOut.append(userID);
userOut.append("</D:href>");
output.append(userOut.toString());
}
try
{
HttpURL sessionURL = session.getHttpURL();
String basePath = sessionURL.getPath();
int idx = basePath.indexOf("/",1);
if (idx >= 0)
basePath = basePath.substring(0,idx);
String fullPath = basePath+"/roles/"+roleName;
PropPatchMethod method = new PropPatchMethod(fullPath);
method.addPropertyToSet(name.toString(),
output.toString());
session.executeHttpRequestMethod(session.retrieveSessionInstance(),
method);
}
catch (HttpException hx)
{
hx.printStackTrace();
retVal = false;
}
catch (IOException iox)
{
iox.printStackTrace();
retVal = false;
}
}
return retVal;
}
You'll notice that I don't do the whole CData thing, yet this still
seems to work. I've also noticed that I get some really strange errors
when I tried using "DAV:" as the namespace on the PropertyName, but it
seems to work if I just use the "D" namespace.
Hope this helps,
Lance
-----Original Message-----
From: Sven Pfeiffer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 01, 2005 9:40 AM
To: Slide Users Mailing List
Subject: RE: howto-create-users.html
Hi Lance
could you give me a tip on this, I am trying the same as you.
I am getting the group-member-set Attribute and adding my new user to
the String.
Then I am trying to do the propPatch, and that's not working for me.
That's what I try:
HttpURL url = new
HttpURL("http://localhost:8080/slide/roles/user");
url.setUserinfo("root", "root");
WebdavResource resource = new WebdavResource(url);
String usersInGroup //the String I am getting and adding my user
to.
usersInGroup = "<D:href
xmlns:D="DAV:">/slide/users/john</D:href>"+
+"<D:href xmlns:D="DAV:">/slide/users/john2</D:href>"+
+"<D:href xmlns:D="DAV:">/slide/users/root</D:href>"+
+"<D:href xmlns:D="DAV:">/slide/users/projector</D:href>"+
+"<D:href xmlns:D="DAV:">/slide/users/sep</D:href>";
resource.proppatchMethod(new PropertyName("DAV:",
"group-member-set"), "<![CDATA[" + usersInGroup +
"]]>",
true);
But the resource.proppatchMethod just never finishes the work.
Can you share your code, so I can see what the difference is, that you
are doing.
Thanks in advance.
SVen
>-----Original Message-----
>From: Lance Leverich [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, February 01, 2005 3:27 PM
>To: Slide Users Mailing List
>Subject: RE: howto-create-users.html
>
>
>I have gotten this to work. My admin module reads the group-member-set
>attribute for the role I want to update, putting each current member
>into an ArrayList. I then add the new user to that list (making sure
>that the /users portion is prefixed to the user name). Then I create
>the XML formatted string by hand and do a PropPatchMethod with that new
>string.
>
>Lance
>
>-----Original Message-----
>From: Derek Lac [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 31, 2005 4:10 PM
>To: [email protected]
>Subject: howto-create-users.html
>
> Have anyone read the how-create-users.html and actually gotten it to
>work? I am stuck with the part 4: assigning a role. It asks to add
><D:href xmlns:D='DAV:'>/users/test</D:href>' to Name :
group-member-set,
>
>but I couldn't get it to work.
>
>-Derek
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]