Hi Brijan,
The loadRulesFromClassPath paragraph isn’t worded very will now that I reread
it. Currently that would need to be implemented in your deployment
contributor. Here is an example from a different deployment contributor.
private static final String RULES_RESOURCE =
ResourceManagerDeploymentContributor.class
.getName().replace( '.', '/' ) + "/rewrite.xml”;
private UrlRewriteRulesDescriptor loadRulesFromClassPath() throws IOException
{
InputStream stream = this.getClass().getClassLoader()
.getResourceAsStream( RULES_RESOURCE );
Reader reader = new InputStreamReader( stream );
UrlRewriteRulesDescriptor rules = UrlRewriteRulesDescriptorFactory.load(
"xml", reader );
reader.close();
stream.close();
return rules;
}
Note that since we moved to a mostly configuration based model in v0.6.0 all of
the examples of this have been removed from the source. I actually had to
checkout a v0.5.0 version to grab this example. You may want to take a look a
one of my recent blogs that talks a bit more about using the configuration
based model.
http://kminder.github.io/knox/2015/11/16/adding-a-service-to-knox.html
I’ll be copying this over to the Apache Knox wiki soon.
Along with that blog you might want to take a look at WebHCat as an example.
gateway-service-definitions/src/main/resources/services/webhcat
From: Brijan Elwadhi
<[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Date: Friday, January 22, 2016 at 5:36 AM
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Cc: Payal Mittal <[email protected]<mailto:[email protected]>>,
Ritesh Sonar <[email protected]<mailto:[email protected]>>
Subject: Issues with knox gateway-spi API
Hello sir,
I am trying to build a rest-api which will run behind the Knox
,in that I am trying to extend ServiceDeploymentContributorBase class
As mentioned in link
http://knox.apache.org/books/knox-0-7-0/dev-guide.html#Service+Definition+Files
but I am facing some issues with
UrlRewriteRulesDescriptor newRules = loadRulesFromClassPath();
but there is no Function definition named loadRulesFromClassPath and there is
no doc for how to use the rewrite descriptor API. One more
issue is there below function requires few more arguments but in the example it
is not mentioned.
addRewriteFilter( context, service, resource );
addDispatchFilter( context, service, resource);
Can you please help me with the further instructions on how to overcome the
above mentioned issue?
Thanks & Regards,
Brijan Elwadhi
Software Engineer
M: +91-7587130309
[cid:[email protected]]<http://www.resilinc.com/>
[facebook]<https://www.facebook.com/pages/Resilinc/152374944798272> [twitter]
<http://www.twitter.com/resilinc> [linkedin]
<http://www.linkedin.com/company/resilinc-corporation> [youtube]
<https://www.youtube.com/channel/UCbo4dHglF3tdc-h7Db8YaGw>
[cid:A961F978-0020-464D-A5C1-1AD0E6195E54]<https://www.eventbrite.com/e/2016-global-supply-chain-resiliency-council-conference-awards-registration-18740042973>