H.Request request = context.req(); final String encoding = request.characterEncoding(); InputStream is = request.inputStream(); try { Map<String, String[]> params = new LinkedHashMap<String, String[]>();
} else { resp.contentType(preloadedContentType); if (req.etagMatches(etag)) { H.Format contentType = cachedContentType.get(path); if (null == contentType) { contentType = req.contentType(); final String reqEtag = req.etag(); if (null != reqEtag && req.etagMatches(etags.get(path))) { H.Format contentType = cachedContentType.get(path); if (null == contentType) { contentType = req.contentType();
} else { resp.contentType(preloadedContentType); if (req.etagMatches(etag)) { H.Format contentType = cachedContentType.get(path); if (null == contentType) { contentType = req.contentType(); final String reqEtag = req.etag(); if (null != reqEtag && req.etagMatches(etags.get(path))) { H.Format contentType = cachedContentType.get(path); if (null == contentType) { contentType = req.contentType();
H.Request request = context.req(); final String encoding = request.characterEncoding(); InputStream is = request.inputStream(); try { Map<String, String[]> params = new LinkedHashMap<String, String[]>();
H.Method method = context.req().method(); boolean supportCache = this.supportCache && method == GET || (cacheSupport.supportPost && method == POST); String cacheKey = null; if (null != cached && cached.isValid()) { String etag = cached.etag(); if (null != etag && context.req().etagMatches(etag)) { NotModified.of(etag).apply(context.req(), context.resp()); } else {
H.Method method = context.req().method(); boolean supportCache = this.supportCache && method == GET || (cacheSupport.supportPost && method == POST); String cacheKey = null; if (null != cached && cached.isValid()) { String etag = cached.etag(); if (null != etag && context.req().etagMatches(etag)) { NotModified.of(etag).apply(context.req(), context.resp()); } else {
H.Format fmt = req.accept(); if (H.Format.UNKNOWN == fmt) { fmt = req.contentType();
H.Format fmt = req.accept(); if (H.Format.UNKNOWN == fmt) { fmt = req.contentType();
when(request.method()).thenReturn(H.Method.GET); actionContext = spy(ActionContext.create(app, request, response)); doReturn(session).when(actionContext).session();
@Override public Map<String, String[]> parse(ActionContext context) { H.Request request = context.req(); InputStream body = request.inputStream(); Map<String, String[]> result = new HashMap<>(); try { FileItemIteratorImpl iter = new FileItemIteratorImpl(body, request.header("content-type"), request.characterEncoding()); while (iter.hasNext()) { FileItemStream item = iter.next(); if (item.isFormField()) { String _encoding = request.characterEncoding(); // this is our default String _contentType = item.getContentType(); if (_contentType != null) {
@Override public Map<String, String[]> parse(ActionContext context) { H.Request request = context.req(); InputStream body = request.inputStream(); Map<String, String[]> result = new HashMap<>(); try { FileItemIteratorImpl iter = new FileItemIteratorImpl(body, request.header("content-type"), request.characterEncoding()); while (iter.hasNext()) { FileItemStream item = iter.next(); if (item.isFormField()) { String _encoding = request.characterEncoding(); // this is our default String _contentType = item.getContentType(); if (_contentType != null) {
private void onResult(Result result, ActionContext context) { context.dissolve(); boolean isRenderAny = false; try { context.applyResultHashToEtag(); if (result instanceof RenderAny) { RenderAny any = (RenderAny) result; isRenderAny = true; any.apply(context); } else { H.Request req = context.req(); ActResponse<?> resp = context.prepareRespForResultEvaluation(); if (result instanceof ErrorResult) { // see https://github.com/actframework/actframework/issues/1034 H.Format fmt = contentTypeForErrorResult(req); req.accept(fmt); resp.contentType(fmt); } result.apply(req, resp); } } catch (RuntimeException e) { context.cacheTemplate(null); throw e; } finally { if (isRenderAny) { RenderAny.clearThreadLocals(); } } }
/** * Implement Java Servlet's `RequestDispatcher.forward(String)` semantic. * * This method has the following restrictions: * * 1. the URL must be started with single `/`. i.e. it must be absolute PATH of current service. * 2. the request method must be `GET`. * * @param url * the url template * @param args * the url argument */ public void forward(String url, Object... args) { E.illegalArgumentIfNot(url.startsWith("/"), "forward URL must starts with single '/'"); E.illegalArgumentIf(url.startsWith("//"), "forward URL must starts with single `/`"); E.unexpectedIfNot(H.Method.GET == req().method(), "forward only support on HTTP GET request"); uploads.clear(); extraParams.clear(); bodyParams = null; String target = S.fmt(url, args); urlPath = UrlPath.of(target); UndertowRequest req = $.cast(req()); state = State.CREATED; req.forward(target); final RequestHandler requestHandler = router.getInvoker(H.Method.GET, url, this); requestHandler.handle(this); }
private void onResult(Result result, ActionContext context) { context.dissolve(); boolean isRenderAny = false; try { context.applyResultHashToEtag(); if (result instanceof RenderAny) { RenderAny any = (RenderAny) result; isRenderAny = true; any.apply(context); } else { H.Request req = context.req(); ActResponse<?> resp = context.prepareRespForResultEvaluation(); if (result instanceof ErrorResult) { // see https://github.com/actframework/actframework/issues/1034 H.Format fmt = contentTypeForErrorResult(req); req.accept(fmt); resp.contentType(fmt); } result.apply(req, resp); } } catch (RuntimeException e) { context.cacheTemplate(null); throw e; } finally { if (isRenderAny) { RenderAny.clearThreadLocals(); } } }