public final boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException, IllegalAccessException, InvocationTargetException { if(!req.tokens.hasMore() || !req.tokens.peek().equals(name)) return false; if(req.tokens.countRemainingTokens()<=argCount) return false; req.tokens.next(); return doDispatch(req,rsp,node); }
public final boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException, IllegalAccessException, InvocationTargetException { if(!req.tokens.hasMore() || !req.tokens.peek().equals(name)) return false; if(req.tokens.countRemainingTokens()<=argCount) return false; req.tokens.next(); boolean b = doDispatch(req, rsp, node); if (!b) req.tokens.prev(); // cancel the next effect return b; }
public final boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException, IllegalAccessException, InvocationTargetException { if(!req.tokens.hasMore() || !req.tokens.peek().equals(name)) return false; if(req.tokens.countRemainingTokens()<=argCount) return false; req.tokens.next(); boolean b = doDispatch(req, rsp, node); if (!b) req.tokens.prev(); // cancel the next effect return b; }
@Override public boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException { String next = req.tokens.peek(); if(next==null) return false; // only match the end of the URL if (req.tokens.countRemainingTokens()>1) return false; // and avoid serving both "foo" and "foo/" as relative URL semantics are drastically different if (req.getRequestURI().endsWith("/")) return false; if (!isBasename(next)) { // potentially an attempt to make a folder traversal return false; } Script script = tearOff.findScript(next); if (script == null) { // no script found return false; } return invokeScript(req, rsp, node, next, script); } });
public boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException { String next = req.tokens.peek(); if(next==null) return false; // only match the end of the URL if (req.tokens.countRemainingTokens()>1) return false; // and avoid serving both "foo" and "foo/" as relative URL semantics are drastically different if (req.getRequestURI().endsWith("/")) return false; Stapler stapler = req.getStapler(); if (!isBasename(next)) { // potentially an attempt to make a folder traversal return false; } // check static resources RequestDispatcher disp = createRequestDispatcher(req,node.getClass(),node,next); if(disp==null) { // check JSP views disp = createRequestDispatcher(req,node.getClass(),node,next+".jsp"); if(disp==null) return false; } req.tokens.next(); if(traceable()) trace(req,rsp,"Invoking "+next+".jsp"+" on "+node+" for "+req.tokens); stapler.forward(disp,req,rsp); return true; } public String toString() {
public boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException { // check Jelly view String next = req.tokens.peek(); if(next==null) return false; // only match the end of the URL if (req.tokens.countRemainingTokens()>1) return false; // and avoid serving both "foo" and "foo/" as relative URL semantics are drastically different if (req.getRequestURI().endsWith("/")) return false; URL res = findResource(owner.klass,next); if(res==null) return false; // no Jelly script found req.tokens.next(); Dispatcher.anonymizedTraceEval(req, rsp, node, "%s: Static view: %s", next); if (traceable()) { // Null not expected here trace(req,rsp,"-> %s on <%s>", next, node); } rsp.serveFile(req, res); return true; }
public boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException { // check Jelly view String next = req.tokens.peek(); if(next==null) return false; // only match the end of the URL if (req.tokens.countRemainingTokens()>1) return false; // and avoid serving both "foo" and "foo/" as relative URL semantics are drastically different if (req.getRequestURI().endsWith("/")) return false; URL res = findResource(owner.klass,next); if(res==null) return false; // no Jelly script found req.tokens.next(); Dispatcher.anonymizedTraceEval(req, rsp, node, "%s: Static view: %s", next); if (traceable()) { // Null not expected here trace(req,rsp,"-> %s on <%s>", next, node); } rsp.serveFile(req, res); return true; }
public boolean dispatch(RequestImpl req, ResponseImpl rsp, Object node) throws IOException, ServletException { // check Jelly view String next = req.tokens.peek(); if(next==null) return false; // only match the end of the URL if (req.tokens.countRemainingTokens()>1) return false; try { Script script = tearOff.findScript(next+".jelly"); if(script==null) return false; // no Jelly script found req.tokens.next(); if (traceable()) { // Null not expected here String src = next+".jelly"; if (script instanceof JellyViewScript) { JellyViewScript jvs = (JellyViewScript) script; src = jvs.getName(); } trace(req,rsp,"-> %s on <%s>", src, node); } scriptInvoker.invokeScript(req, rsp, script, node); return true; } catch (RuntimeException e) { throw e; } catch (IOException e) { throw e; } catch (Exception e) { throw new ServletException(e); } }
if (req.tokens.countRemainingTokens()>1) return false;
if (req.tokens.countRemainingTokens()>1) return false;