/** * Constructor. * * @param msg The message. Can be <jk>null</jk>. */ public Forbidden(String msg) { super(msg); setStatus(CODE); }
private void deleteFile(File f) { if (! allowDeletes) throw new MethodNotAllowed("DELETE not enabled"); if (f.isDirectory()) { File[] files = f.listFiles(); if (files != null) { for (File fc : files) deleteFile(fc); } } if (! f.delete()) throw new Forbidden("Could not delete file {0}", f.getAbsolutePath()) ; }
private void deleteFile(File f) { if (! allowDeletes) throw new MethodNotAllowed("DELETE not enabled"); if (f.isDirectory()) { File[] files = f.listFiles(); if (files != null) { for (File fc : files) deleteFile(fc); } } if (! f.delete()) throw new Forbidden("Could not delete file {0}", f.getAbsolutePath()) ; } }
private void deleteFile(File f) { if (! allowDeletes) throw new MethodNotAllowed("DELETE not enabled"); if (f.isDirectory()) { File[] files = f.listFiles(); if (files != null) { for (File fc : files) deleteFile(fc); } } if (! f.delete()) throw new Forbidden("Could not delete file {0}", f.getAbsolutePath()) ; }
/** * Constructor. * * @param msg The message. Can be <jk>null</jk>. */ public Forbidden(String msg) { super(msg); setStatus(CODE); }
private void deleteFile(File f) { if (! allowDeletes) throw new MethodNotAllowed("DELETE not enabled"); if (f.isDirectory()) { File[] files = f.listFiles(); if (files != null) { for (File fc : files) deleteFile(fc); } } if (! f.delete()) throw new Forbidden("Could not delete file {0}", f.getAbsolutePath()) ; } }
/** * Constructor. * * @param msg The message. Can be <jk>null</jk>. */ public Forbidden(String msg) { super(msg); setStatus(CODE); }
/** * Checks the current HTTP request and throws a {@link RestException} if the guard does not permit the request. * * <p> * By default, throws an <jsf>SC_FORBIDDEN</jsf> exception if {@link #isRequestAllowed(RestRequest)} returns * <jk>false</jk>. * * <p> * Subclasses are free to override this method to tailor the behavior of how to handle unauthorized requests. * * @param req The servlet request. * @param res The servlet response. * @throws RestException Thrown to abort processing on current request. * @return * <jk>true</jk> if request can proceed. * Specify <jk>false</jk> if you're doing something like a redirection to a login page. */ public boolean guard(RestRequest req, RestResponse res) throws RestException { if (! isRequestAllowed(req)) throw new Forbidden("Access denied by guard"); return true; }
/** * Checks the current HTTP request and throws a {@link RestException} if the guard does not permit the request. * * <p> * By default, throws an <jsf>SC_FORBIDDEN</jsf> exception if {@link #isRequestAllowed(RestRequest)} returns * <jk>false</jk>. * * <p> * Subclasses are free to override this method to tailor the behavior of how to handle unauthorized requests. * * @param req The servlet request. * @param res The servlet response. * @throws RestException Thrown to abort processing on current request. * @return * <jk>true</jk> if request can proceed. * Specify <jk>false</jk> if you're doing something like a redirection to a login page. */ public boolean guard(RestRequest req, RestResponse res) throws RestException { if (! isRequestAllowed(req)) throw new Forbidden("Access denied by guard"); return true; }
/** * Checks the current HTTP request and throws a {@link RestException} if the guard does not permit the request. * * <p> * By default, throws an <jsf>SC_FORBIDDEN</jsf> exception if {@link #isRequestAllowed(RestRequest)} returns * <jk>false</jk>. * * <p> * Subclasses are free to override this method to tailor the behavior of how to handle unauthorized requests. * * @param req The servlet request. * @param res The servlet response. * @throws RestException Thrown to abort processing on current request. * @return * <jk>true</jk> if request can proceed. * Specify <jk>false</jk> if you're doing something like a redirection to a login page. */ public boolean guard(RestRequest req, RestResponse res) throws RestException { if (! isRequestAllowed(req)) throw new Forbidden("Access denied by guard"); return true; }
@RestMethod public void forbidden() { throw new Forbidden("foo {0}", "bar"); } @RestMethod public void gone() { throw new Gone("foo {0}", "bar"); }
@RestMethod public void forbidden() { throw new Forbidden(t); } @RestMethod public void gone() { throw new Gone(t); }
@RestMethod public void forbidden() { throw new Forbidden(t, "foo {0}", "bar"); } @RestMethod public void gone() { throw new Gone(t, "foo {0}", "bar"); }
@RestMethod public void forbidden() { throw new Forbidden(); } @RestMethod public void gone() { throw new Gone(); }