You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by Håkon Sagehaug <Ha...@bccs.uib.no> on 2009/03/05 17:49:15 UTC
Enabling rampart in servlet
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)
Re: Enabling rampart in servlet
Posted by Håkon Sagehaug <Ha...@bccs.uib.no>.
Hi
Thanks for the replay, but not sure I understood it. Since my problem is
with engaging rampart and not with loading policies. But I could be wrong
cheers, Håkon
2009/3/5 m4rkuz <m4...@gmail.com>
> 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 <
> Hakon.Sagehaug@bccs.uib.no> 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)
>>
>
>
--
Håkon Sagehaug, Scientific Programmer
Parallab, Bergen Center for Computational Science (BCCS)
UNIFOB AS (University of Bergen Research Company)
Re: Enabling rampart in servlet
Posted by m4rkuz <m4...@gmail.com>.
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
<Ha...@bccs.uib.no>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)
>