A.N Deepak wrote:
>The createRevisionDescriptor(..) method needs a Uri object. The Uri
>constructor needs a namspace object. How do I construct the namespace
>object. I am lost!!!!
>
>
You may find this useful. It's used in a servlet. Usually you would
declare nat and st
as membervars of the object and create them once using the code
below. I believe
it was taken from the slide-struts taglibs or the administration
webapp. Check there
for further samplecode.
// get the slide token
CredentialsToken credentials ;
Principal principal = request.getUserPrincipal() ;
if (principal != null) {
credentials = new CredentialsToken(principal) ;
} else {
credentials = new CredentialsToken("") ;
}
// create a SlideToken
SlideToken st = new SlideTokenImpl(credentials) ;
// get the namespace access token
// first check if an attribute is set for a namespacename
String namespaceName =
(String)getServlet().getServletContext().getAttribute("org.apache.slide.NamespaceName")
;
// if not, check if an initParam is set
if (namespaceName == null) {
namespaceName =
getServlet().getServletContext().getInitParameter("org.apache.slide.NamespaceName")
;
}
// okay... no custom namespace was found, stick with the default
namespace
if (namespaceName == null) {
// the default namespace
namespaceName = Domain.getDefaultNamespace() ;
}
// create a securitytoken
SecurityToken security = new
SecurityToken(getServlet().getServletContext()) ;
// get the NamespaceAccessToken from the Domain
NamespaceAccessToken nat = Domain.accessNamespace(security,
namespaceName) ;
// now use nat to access the namespace...
l8r...
Thomas
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>