public ResponseContext filter( RequestContext request, FilterChain chain) { RequestContextWrapper rcw = new RequestContextWrapper(request); rcw.setAttribute("offset", 10); rcw.setAttribute("count", 10); return chain.next(rcw); }
public InputStream getInputStream() { try { return new DigestCaptureStream(super.getInputStream(), MessageDigest .getInstance(digestAlgorithm)); } catch (Exception e) { throw new RuntimeException("Could not calculate digest", e); } }
public MethodOverrideRequestContext(RequestContext request) { super(request); String method = super.getMethod(); String xheader = getHeader("X-HTTP-Method-Override"); if (xheader == null) xheader = getHeader("X-Method-Override"); if (xheader != null) xheader = xheader.toUpperCase().trim(); if (method.equals("POST") && xheader != null && Arrays.binarySearch(methods, xheader) > -1) { method = xheader; } this.method = method; }
public String urlFor(Object key, Object param) { return getProvider().urlFor(this, key, param); }
public String absoluteUrlFor(Object key, Object param) { return request.getResolvedUri().resolve(urlFor(key, param)).toString(); }
@SuppressWarnings("unchecked") public <T extends Element> Document<T> getDocument(Parser parser, ParserOptions options) throws ParseException, IOException { Document<Element> doc = super.getDocument(); try { if (doc != null) { AbderaSecurity security = new AbderaSecurity(getAbdera()); Encryption enc = security.getEncryption(); if (enc.isEncrypted(doc)) { Object arg = initArg(request); EncryptionOptions encoptions = initEncryptionOptions(request, enc, arg); doc = enc.decrypt(doc, encoptions); } } } catch (Exception e) { } return (Document<T>)doc; } }