how to restrict the access to service in different modules
<p>My requirement is to call the services from two different modules.But, Some urls can allow both modules,some urls allow for specific to that module.
Below is my current configuration for achieving that</p>

<pre><code>&lt;servlet&gt;
        &lt;servlet-name&gt;animals&lt;/servlet-name&gt;
        &lt;servlet-class&gt;
            org.glassfish.jersey.servlet.ServletContainer
        &lt;/servlet-class&gt;
        &lt;init-param&gt;
            &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
            &lt;param-value&gt;com.lion,com.dog&lt;/param-value&gt;
        &lt;/init-param&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
&lt;/servlet&gt;

&lt;servlet-mapping&gt;
        &lt;servlet-name&gt;animals&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/lion/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
&lt;servlet-mapping&gt;
        &lt;servlet-name&gt;animals&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/dogs/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
</code></pre>

<p>For example if I have a service called as <code>'barking'</code> this service is located in <code>com.dog</code> package.Now i can call this service using two urls like below</p>

<pre><code>/lions/barking
/dogs/barking
</code></pre>

<p>As per my requirement <code>/lions/barking</code> should show <code>404</code> error.But it gives the response.</p>

<p>But some url both should work.Irrespective of where the service is located.</p>

<pre><code>/lions/eat
/dogs/eat
</code></pre>

<p>How to do the configuration to achieve that functionality</p>

<p>Any help will be greatly appreciated!!!!</p>