private void addHeader(HttpServletResponse pResp, TransferAttribute pAttribute) { if (pAttribute == null) { return; } pResp.addHeader(pAttribute.getName(), (String) pAttribute.getValue()); }
public Object getAttributeValue(final String pName) { TransferAttribute lRes = getAttribute(pName.toLowerCase()); return lRes != null ? lRes.getValue() : null; }
/** * Responsible for adding http username and password to the http client as http basic authentication. * * @param httpRequest the http request. * @param pRequest the current request. */ protected void addHttpAuthentication(final HTTPRequest httpRequest, final Transferable pRequest) { TransferAttribute userattr = pRequest.getAttribute(TransferAttribute.HTTP_AUTH_BASIC_USERNAME); TransferAttribute pw = pRequest.getAttribute(TransferAttribute.HTTP_AUTH_BASIC_PASSWORD); if (userattr != null && userattr.getValue() != null) { String clearpw = pw != null ? (String) pw.getValue() : null; if (clearpw != null) { // password is hold in memory as base64 clearpw = StringUtils.decodeBase64(clearpw); } httpRequest.basicAuth((String) userattr.getValue(), clearpw.toCharArray()); } }
public void handleFacadeResponseHeaders(final Transferable wssResponse) { Collection<TransferAttribute> wssResponseHeaders = wssResponse.getAttributes(); for (TransferAttribute tAttr : wssResponseHeaders) { if (tAttr.getName().equalsIgnoreCase("Transfer-Encoding")) { // do nothing // TODO problem with "Transfer-Encoding: chunked" if (LOG.isDebugEnabled()) { LOG.debug("Ignoring header 'Transfer-Encoding': " + tAttr.getValue()); } } else { if (tAttr instanceof HttpHeaderAttribute) { HttpHeaderAttribute httpHeaderAttribute = (HttpHeaderAttribute) tAttr; m_headerHandler.handle(httpHeaderAttribute); } else { continue; } } } }
private Map<String, String> getHttpHeaderAttributes(Transferable requestTransferable) throws IOException { Map<String, String> httpHeaderAttributes = new HashMap<>(); Iterator<TransferAttribute> attributeIterator = requestTransferable.getAttributes().iterator(); while (attributeIterator.hasNext()) { TransferAttribute attribute = attributeIterator.next(); String attributeName = attribute.getName(); Object attributeValue = attribute.getValue(); if (attribute instanceof HttpHeaderAttribute) { if (attributeName.equals(HttpHeaderAttribute.HEADER_NAME_CONTENTTYPE)) { if (((String) attributeValue).startsWith("application/octe")) { setPayloadAsStreamPayload(requestTransferable); } else { attributeValue = modifyContentTypeAttributeValue(requestTransferable, (String) attributeValue); } } else if (attributeName.equals(HttpHeaderAttribute.HEADER_NAME_CONTENTCHARSET)) { // don't set the 'wrong' charset content encoding continue; } addToHeaderAttributes(attributeName, (String) attributeValue, httpHeaderAttributes); } else if (attribute instanceof SimpleTransferAttribute) { if (attributeName.toLowerCase().startsWith("accept")) { String stringAttributeValue = String.valueOf(attributeValue); if (!attributeName.toLowerCase().equals("accept-encoding") || "gzip".equalsIgnoreCase(stringAttributeValue)) { addToHeaderAttributes(attributeName, stringAttributeValue, httpHeaderAttributes); } } } } return httpHeaderAttributes; }
String lActualMimeType = (String) lContentType.getValue();
LicenseReference licref = (LicenseReference) licrefAttr.getValue(); LicensePrincipal principal = new LicensePrincipal(licref); if (LOG.isDebugEnabled()) {
TransferAttribute contentEncoding = getTransferable().getAttribute(HttpHeaderAttribute.HEADER_NAME_CONTENT_ENCODING); boolean gzip = contentEncoding != null && "gzip".equalsIgnoreCase((String) contentEncoding.getValue()); if (gzip) {