@Override public String serialize(int numberOfSpacesToIndent, Header header) { StringBuilder output = new StringBuilder(); output.append(NEW_LINE).append(Strings.padStart("", numberOfSpacesToIndent * INDENT_SIZE, ' ')); output.append("new Header(").append(NottableStringToJavaSerializer.serializeNottableString(header.getName())); for (NottableString value : header.getValues()) { output.append(", ").append(NottableStringToJavaSerializer.serializeNottableString(value)); } output.append(")"); return output.toString(); }
for (NottableString headerValue : header.getValues()) { curlString.append(" -H '").append(header.getName().getValue()).append(": ").append(headerValue.getValue()).append("'"); if (header.getName().getValue().toLowerCase().contains("Accept-Encoding".toLowerCase())) {
private void setHeaders(HttpResponse httpResponse, HttpServletResponse httpServletResponse) { if (httpResponse.getHeaderList() != null) { for (Header header : httpResponse.getHeaderList()) { String headerName = header.getName().getValue(); if (!headerName.equalsIgnoreCase(CONTENT_LENGTH.toString()) && !headerName.equalsIgnoreCase(TRANSFER_ENCODING.toString()) && !headerName.equalsIgnoreCase(HOST.toString()) && !headerName.equalsIgnoreCase(ACCEPT_ENCODING.toString()) && !headerName.equalsIgnoreCase(CONNECTION.toString())) { for (NottableString value : header.getValues()) { httpServletResponse.addHeader(headerName, value.getValue()); } } } } addContentTypeHeader(httpResponse, httpServletResponse); }
private void setCookies(HttpResponse httpResponse) { Cookies cookies = new Cookies(); for (Header header : httpResponse.getHeaderList()) { if (header.getName().getValue().equalsIgnoreCase("Set-Cookie")) { for (NottableString cookieHeader : header.getValues()) { io.netty.handler.codec.http.cookie.Cookie httpCookie = ClientCookieDecoder.LAX.decode(cookieHeader.getValue()); String name = httpCookie.name().trim(); String value = httpCookie.value().trim(); cookies.withEntry(new Cookie(name, value)); } } if (header.getName().getValue().equalsIgnoreCase("Cookie")) { for (NottableString cookieHeader : header.getValues()) { for (io.netty.handler.codec.http.cookie.Cookie httpCookie : ServerCookieDecoder.LAX.decode(cookieHeader.getValue())) { String name = httpCookie.name().trim(); String value = httpCookie.value().trim(); cookies.withEntry(new Cookie(name, value)); } } } } if (!cookies.isEmpty()) { httpResponse.withCookies(cookies); } }
public HttpRequestTemplateObject(HttpRequest httpRequest) { if (httpRequest != null) { method = httpRequest.getMethod().getValue(); path = httpRequest.getPath().getValue(); for (Header header : httpRequest.getHeaderList()) { headers.put(header.getName().getValue(), Lists.transform(header.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } for (Cookie cookie : httpRequest.getCookieList()) { cookies.put(cookie.getName().getValue(), cookie.getValue().getValue()); } for (Parameter parameter : httpRequest.getQueryStringParameterList()) { queryStringParameters.put(parameter.getName().getValue(), Lists.transform(parameter.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } body = BodyDTO.createDTO(httpRequest.getBody()); keepAlive = httpRequest.isKeepAlive(); secure = httpRequest.isSecure(); } }
private void setHeaders(HttpResponse response, DefaultFullHttpResponse fullHttpResponse) { if (response.getHeaderList() != null) { for (Header header : response.getHeaderList()) { for (NottableString value : header.getValues()) { fullHttpResponse.headers().add(header.getName().getValue(), value.getValue());
@Override public String serialize(int numberOfSpacesToIndent, Header header) { StringBuilder output = new StringBuilder(); output.append(NEW_LINE).append(Strings.padStart("", numberOfSpacesToIndent * INDENT_SIZE, ' ')); output.append("new Header(").append(NottableStringToJavaSerializer.serializeNottableString(header.getName())); for (NottableString value : header.getValues()) { output.append(", ").append(NottableStringToJavaSerializer.serializeNottableString(value)); } output.append(")"); return output.toString(); }
for (NottableString headerValue : header.getValues()) { curlString.append(" -H '").append(header.getName().getValue()).append(": ").append(headerValue.getValue()).append("'"); if (header.getName().getValue().toLowerCase().contains("Accept-Encoding".toLowerCase())) {
private void setHeaders(HttpResponse httpResponse, HttpServletResponse httpServletResponse) { if (httpResponse.getHeaderList() != null) { for (Header header : httpResponse.getHeaderList()) { String headerName = header.getName().getValue(); if (!headerName.equalsIgnoreCase(CONTENT_LENGTH.toString()) && !headerName.equalsIgnoreCase(TRANSFER_ENCODING.toString()) && !headerName.equalsIgnoreCase(HOST.toString()) && !headerName.equalsIgnoreCase(ACCEPT_ENCODING.toString()) && !headerName.equalsIgnoreCase(CONNECTION.toString())) { for (NottableString value : header.getValues()) { httpServletResponse.addHeader(headerName, value.getValue()); } } } } addContentTypeHeader(httpResponse, httpServletResponse); }
private void setCookies(HttpResponse httpResponse) { Cookies cookies = new Cookies(); for (Header header : httpResponse.getHeaderList()) { if (header.getName().getValue().equalsIgnoreCase("Set-Cookie")) { for (NottableString cookieHeader : header.getValues()) { io.netty.handler.codec.http.cookie.Cookie httpCookie = ClientCookieDecoder.LAX.decode(cookieHeader.getValue()); String name = httpCookie.name().trim(); String value = httpCookie.value().trim(); cookies.withEntry(new Cookie(name, value)); } } if (header.getName().getValue().equalsIgnoreCase("Cookie")) { for (NottableString cookieHeader : header.getValues()) { for (io.netty.handler.codec.http.cookie.Cookie httpCookie : ServerCookieDecoder.LAX.decode(cookieHeader.getValue())) { String name = httpCookie.name().trim(); String value = httpCookie.value().trim(); cookies.withEntry(new Cookie(name, value)); } } } } if (!cookies.isEmpty()) { httpResponse.withCookies(cookies); } }
public HttpRequestTemplateObject(HttpRequest httpRequest) { if (httpRequest != null) { method = httpRequest.getMethod().getValue(); path = httpRequest.getPath().getValue(); for (Header header : httpRequest.getHeaderList()) { headers.put(header.getName().getValue(), Lists.transform(header.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } for (Cookie cookie : httpRequest.getCookieList()) { cookies.put(cookie.getName().getValue(), cookie.getValue().getValue()); } for (Parameter parameter : httpRequest.getQueryStringParameterList()) { queryStringParameters.put(parameter.getName().getValue(), Lists.transform(parameter.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } body = BodyDTO.createDTO(httpRequest.getBody()); keepAlive = httpRequest.isKeepAlive(); secure = httpRequest.isSecure(); } }
private void setHeaders(HttpResponse response, DefaultFullHttpResponse fullHttpResponse) { if (response.getHeaderList() != null) { for (Header header : response.getHeaderList()) { for (NottableString value : header.getValues()) { fullHttpResponse.headers().add(header.getName().getValue(), value.getValue());