@SlingFilter(scope = SlingFilterScope.REQUEST, order = Integer.MAX_VALUE,
generateComponent = false)
@Component(metatype = true, immediate = false, enabled = false)
public class BlockAllButFelixFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (request instanceof HttpServletRequest && response instanceof
HttpServletResponse) {
final HttpServletRequest httpRequest = (HttpServletRequest)
request;
final HttpServletResponse httpResponse = (HttpServletResponse)
response;
if (!httpRequest.getPathInfo().startsWith("/system/console/")) {
httpResponse.sendError(503, "deployment on going...");
return;
}
}
chain.doFilter(request, response);
}
then you can control this in deployment script:
curl -s -v -u admin:admin -d "action=enable"
http://localhost:8080/system/console/components/saml.BlockAllButFelixFilter>
/dev/null
curl -s -v -u admin:admin -d "action=disable"
http://localhost:8080/system/console/components/saml.BlockAllButFelixFilter>
/dev/null
On Tue, Aug 21, 2012 at 11:56 AM, Sam Lee <[email protected]> wrote:
> Thanks.
> Do you have an example of such servlet filter?
>
>
>
> On Tue, Aug 21, 2012 at 11:53 AM, Bertrand Delacretaz <
> [email protected]> wrote:
>
>> Hi,
>>
>> On Tue, Aug 21, 2012 at 5:46 PM, Sam Lee <[email protected]> wrote:
>> > When deploying OSGi bundles through Felix Web Console, I want to block
>> all
>> > traffic to the sling instance. But, still able to deploy OSGi
>> bundles....
>>
>> I've been doing that with a Servlet Filter that you activate before
>> doing your upgrades, which returns a 503 status code with an
>> explanation, and you disable it when done.
>>
>> -Bertrand
>>
>
>