private void addGzipHeaderIfAccepted(FacadeResponse facadeResponse, Transferable serverResponse) { if (facadeResponse.isGzipAccepted()) { serverResponse.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute(HttpHeaderAttribute.HEADER_NAME_CONTENT_ENCODING, "gzip")); } }
private void addPathinfoAttribute(Transferable secRequest) { String proxyRequestPathInfo = m_wssRequestUrl.getEffectivePathInfo(); if (proxyRequestPathInfo != null) { secRequest .addAttribute(new SimpleTransferAttribute(TransferAttribute.PATHINFO_ATTR, proxyRequestPathInfo)); } }
private Transferable addCommonAttributes(Transferable request) { String pathInfo = getPathInfo(); String additionalPath = FacadeTools.extractAdditionalPathInfo(pathInfo); request.addAttribute(new SimpleTransferAttribute(TransferAttribute.PATHINFO_ATTR, additionalPath)); request.addAttribute(new SimpleTransferAttribute(TransferAttribute.REQUEST_IP_ATTR, getRemoteAddress())); // Is the "X-Forwarded-For" header already set? String headerXForwardedFor = getXForwardedForHeader(); // If not set, set caller's ip, otherwise append caller's ip headerXForwardedFor = (headerXForwardedFor == null) ? getRemoteAddress() : headerXForwardedFor .concat(" ," + getRemoteAddress()); // Create according TransferAttribute request.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute( HttpHeaderAttribute.HEADER_NAME_XFORWARDEDFOR, headerXForwardedFor)); String referrerHeader = getHttpReferrerHeader(); if (referrerHeader != null) { request.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute(HttpHeaderAttribute.HEADER_NAME_REFERER, referrerHeader)); } return request; }
public Transferable createStreamTransferable(final String pContentType, final InputStream pPayLoad, final String pCharset) throws IOException { Transferable lTransferable = new TransferableImpl(); lTransferable.setPayload(new StreamPayload(pPayLoad, pCharset)); if (pContentType != null) { String contentType = addCharset(pContentType, pCharset); lTransferable.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute( HttpHeaderAttribute.HEADER_NAME_CONTENTTYPE, contentType)); } if (pCharset != null) { lTransferable.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute( HttpHeaderAttribute.HEADER_NAME_CONTENTCHARSET, pCharset)); } return lTransferable; }
public Transferable createTextualTransferable(final String pContentType, final String pPayLoad, final String pTargetCharset) { Transferable lTransferable = new TransferableImpl(); lTransferable.setPayload(new TextualPayload(pPayLoad, pTargetCharset)); if (pContentType != null) { String contentType = addCharset(pContentType, pTargetCharset); lTransferable.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute( HttpHeaderAttribute.HEADER_NAME_CONTENTTYPE, contentType)); } if (pTargetCharset != null) { lTransferable.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute( HttpHeaderAttribute.HEADER_NAME_CONTENTCHARSET, pTargetCharset)); } return lTransferable; }
requestTransferable.addAttribute(new SimpleTransferAttribute(TransferAttribute.QUERY_STRING_ATTR, lQueryString.toString()));
responseTransferable.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute(header.getKey(), headerValues.toString())); LOG.debug("Adding response header -> {}: {}", header.getKey(), header.getValue()); responseTransferable.addAttribute(new SimpleTransferAttribute(TransferAttribute.RESPONSE_STATUS_CODE, String.valueOf(statusCode.getCode()))); if (acceptEncoding != null && acceptEncoding.contains("gzip")) { responseTransferable.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute( HttpHeaderAttribute.HEADER_NAME_CONTENT_ENCODING, "gzip")); } else {
lRes.addAttribute(HttpHeaderAttribute.createHttpHeaderAttribute(key, headerValue)); if (LOG.isDebugEnabled()) { LOG.debug("Add Response HeaderAttribute -> " + key + " = " + headerValue); lRes.addAttribute(new SimpleTransferAttribute(TransferAttribute.RESPONSE_STATUS_CODE, String.valueOf(httpResponse.getStatus().getCode())));
private Transferable createPostTransferable() throws FacadeRequestBuilderException { String requestEncoding = getCharacterEncoding(); String requestContentType = getContentType(); String requestQueryString = reencodeQueryString(); Transferable transferable; try { transferable = TransferableFactory.getInstance().createStreamTransferable(requestContentType, getInputStream(), requestEncoding); } catch (IOException e) { throw new FacadeRequestBuilderException("Could not create request transferable", e); } if (requestQueryString != null && requestQueryString.length() > 0) { transferable.addAttribute(new SimpleTransferAttribute(TransferAttribute.QUERY_STRING_ATTR, requestQueryString)); } return transferable; }
pRequest.addAttribute(new SimpleTransferAttribute(TransferAttribute.QUERY_STRING_ATTR, lQueryString.toString()));