public ServletBinder through(Filter filter) { if (filter == null) throw new NullPointerException(HttpServerText.get().filterMustNotBeNull); filters.add(filter); return this; }
/** * @param groupIdx * capture group number, 1 through the number of groups. */ public RegexGroupFilter(final int groupIdx) { if (groupIdx < 1) throw new IllegalArgumentException(MessageFormat.format( HttpServerText.get().invalidIndex, valueOf(groupIdx))); this.groupIdx = groupIdx - 1; }
public ServletBinder through(Filter filter) { if (filter == null) throw new NullPointerException(HttpServerText.get().filterMustNotBeNull); filters.add(filter); return this; }
/** * @param groupIdx * capture group number, 1 through the number of groups. */ public RegexGroupFilter(final int groupIdx) { if (groupIdx < 1) throw new IllegalArgumentException(MessageFormat.format( HttpServerText.get().invalidIndex, valueOf(groupIdx))); this.groupIdx = groupIdx - 1; }
private static File getFile(FilterConfig cfg, String param) throws ServletException { String n = cfg.getInitParameter(param); if (n == null || "".equals(n)) throw new ServletException(MessageFormat.format(HttpServerText.get().parameterNotSet, param)); File path = new File(n); if (!path.exists()) throw new ServletException(MessageFormat.format(HttpServerText.get().pathForParamNotFound, path, param)); return path; }
private static File getFile(FilterConfig cfg, String param) throws ServletException { String n = cfg.getInitParameter(param); if (n == null || "".equals(n)) throw new ServletException(MessageFormat.format(HttpServerText.get().parameterNotSet, param)); File path = new File(n); if (!path.exists()) throw new ServletException(MessageFormat.format(HttpServerText.get().pathForParamNotFound, path, param)); return path; }
private static boolean getBoolean(FilterConfig cfg, String param) throws ServletException { String n = cfg.getInitParameter(param); if (n == null) return false; try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new ServletException(MessageFormat.format(HttpServerText.get().invalidBoolean, param, n)); } }
private ServletBinder register(ServletBinderImpl b) { synchronized (bindings) { if (pipelines != null) throw new IllegalStateException( HttpServerText.get().servletAlreadyInitialized); bindings.add(b); } return register((ServletBinder) b); }
public void doFilter(final ServletRequest request, final ServletResponse rsp, final FilterChain chain) throws IOException, ServletException { final WrappedRequest[] g = groupsFor(request); if (groupIdx < g.length) chain.doFilter(g[groupIdx], rsp); else throw new ServletException(MessageFormat.format( HttpServerText.get().invalidRegexGroup, valueOf(groupIdx + 1))); }
private ServletBinder register(ServletBinderImpl b) { synchronized (bindings) { if (pipelines != null) throw new IllegalStateException( HttpServerText.get().servletAlreadyInitialized); bindings.add(b); } return register((ServletBinder) b); }
private static boolean getBoolean(FilterConfig cfg, String param) throws ServletException { String n = cfg.getInitParameter(param); if (n == null) return false; try { return StringUtils.toBoolean(n); } catch (IllegalArgumentException err) { throw new ServletException(MessageFormat.format(HttpServerText.get().invalidBoolean, param, n)); } }
public void doFilter(final ServletRequest request, final ServletResponse rsp, final FilterChain chain) throws IOException, ServletException { final WrappedRequest[] g = groupsFor(request); if (groupIdx < g.length) chain.doFilter(g[groupIdx], rsp); else throw new ServletException(MessageFormat.format( HttpServerText.get().invalidRegexGroup, valueOf(groupIdx + 1))); }
private void log(Repository git, Throwable e) { getServletContext().log(MessageFormat.format( HttpServerText.get().internalErrorDuringUploadPack, ServletUtils.identify(git)), e); } }
/** * Construct a binding for a specific path. * * @param path * pattern to match. * @return binder for the passed path. */ public ServletBinder serve(String path) { if (path.startsWith("*")) return register(new SuffixPipeline.Binder(path.substring(1))); throw new IllegalArgumentException(MessageFormat.format(HttpServerText .get().pathNotSupported, path)); }
/** * Construct a binding for a specific path. * * @param path * pattern to match. * @return binder for the passed path. */ public ServletBinder serve(String path) { if (path.startsWith("*")) return register(new SuffixPipeline.Binder(path.substring(1))); throw new IllegalArgumentException(MessageFormat.format(HttpServerText .get().pathNotSupported, path)); }
private void log(Repository git, Throwable e) { getServletContext().log(MessageFormat.format( HttpServerText.get().internalErrorDuringReceivePack, ServletUtils.identify(git)), e); } }
@Override protected ServletBinder register(ServletBinder binder) { if (resolver == null) throw new IllegalStateException(HttpServerText.get().noResolverAvailable); binder = binder.through(new NoCacheFilter()); binder = binder.through(new RepositoryFilter(resolver)); return binder; } }
@Override protected ServletBinder register(ServletBinder binder) { if (resolver == null) throw new IllegalStateException(HttpServerText.get().noResolverAvailable); binder = binder.through(new NoCacheFilter()); binder = binder.through(new RepositoryFilter(resolver)); return binder; } }