Hi Håkon,
You can build the policy reading an XML, like this...
try {
StAXOMBuilder builder = new
StAXOMBuilder(rampartPolicyFileLocation);
Policy rampartConfig = PolicyEngine.getPolicy(builder
.getDocumentElement());
sc.getAxisService().getPolicySubject().attachPolicy(rampartConfig);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (XMLStreamException e) {
e.printStackTrace();
}
or put the resource in a jar and use the method getResourceAsStream (or
so... )
and then:
StAXOMBuilder builder = new StAXOMBuilder(new
ByteArrayInputStream(configFileRawBytes));
Regards,
Marcus V. Sánchez D.
______________________
Enterprise Developer.
Sun Certified Java Programmer (SCJP)
On Thu, Mar 5, 2009 at 11:49 AM, Håkon Sagehaug
<[email protected]>wrote:
> Hi all
>
> I have a web application that contains some servlets, where I need to
> engage rampart, but I can only engage rampart if i specify the hole path for
> the repository in ConfigurationContext
>
> ConfigurationContextFactory
>
> .createConfigurationContextFromFileSystem("/home/user/folder/path/to/repository",
> null);
>
> I've tried placing the repository everywhere when building the war file
> under WEB-INF etc, but I always get the error
>
> Couldn't find repository location 'repository'
>
> if I don't specify the hole path, does anyone know where this should be
> placed inside my web app so I don't need to specify the hole path for web
> app to pick up the repository.
>
> I use maven to build my web application and tried to add rampart module as
> a dependency, but it did not change anything
>
> any hints on ow to solve it??
>
> cheers, Håkon
>
> --
> Håkon Sagehaug, Scientific Programmer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>