/** * Sets the description of this <CODE>SOAPMessage</CODE> object's content with the given * description. * * @param description a <CODE>String</CODE> describing the content of this message * @see #getContentDescription() getContentDescription() */ public void setContentDescription(String description) { mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_DESCRIPTION, description); }
/** * Sets the description of this <CODE>SOAPMessage</CODE> object's content with the given * description. * * @param description a <CODE>String</CODE> describing the content of this message * @see #getContentDescription() getContentDescription() */ public void setContentDescription(String description) { mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_DESCRIPTION, description); }
public void setContentDescription(String description) { mimeHeaders.setHeader(MimeConstants.CONTENT_DESCRIPTION, description); }
/** * Changes the first header entry that matches the given name to the given value, adding a new * header if no existing header matches. This method also removes all matching headers but the * first. * <p/> * <P>Note that RFC822 headers can only contain US-ASCII characters.</P> * * @param name a <CODE>String</CODE> giving the name of the header for which to search * @param value a <CODE>String</CODE> giving the value to be set for the header whose name * matches the given name * @throws IllegalArgumentException if there was a problem with the specified mime header name * or value */ public void setMimeHeader(String name, String value) { mimeHeaders.setHeader(name, value); }
@Test public void testDoNotOverriderSoapAction() throws Exception { MimeHeaders mimeHeaders = new MimeHeaders(); String testSoapAction = "fooAction"; mimeHeaders.setHeader(TransportConstants.HEADER_SOAP_ACTION, testSoapAction); String soap = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"></soapenv:Envelope>"; SOAPMessage message = MessageFactory.newInstance() .createMessage(mimeHeaders, new ByteArrayInputStream(soap.getBytes())); SaajSoapMessage soapMessage = new SaajSoapMessage(message); DefaultSoapHeaderMapper headerMapper = new DefaultSoapHeaderMapper(); headerMapper.fromHeadersToRequest(new MessageHeaders(null), soapMessage); assertEquals(testSoapAction, soapMessage.getSoapAction()); }
/** * Adds the given <CODE>AttachmentPart</CODE> object to this <CODE>SOAPMessage</CODE> object. An * <CODE> AttachmentPart</CODE> object must be created before it can be added to a message. * * @param attachmentPart an <CODE> AttachmentPart</CODE> object that is to become part of this * <CODE>SOAPMessage</CODE> object * @throws IllegalArgumentException * */ public void addAttachmentPart(AttachmentPart attachmentPart) { if (attachmentPart != null) { attachmentParts.add(attachmentPart); mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, "multipart/related"); saveRequired = true; } }
public void setMimeHeader(String name, String value) { clearHeaderCache(); mimeHeaders.setHeader(name, value); }
@Override public void setContentDescription(String description) { headers.setHeader("Content-Description", description); needsSave(); }
public void setMimeHeader(String name, String value) { MimeHeaders mimeHeaders = soapMessage.getMimeHeaders(); mimeHeaders.setHeader(name, value); }
public void setBaseType(String type) { ContentType ct = contentType(); ct.setParameter("type", type); headers.setHeader("Content-Type", ct.toString()); needsSave(); }
private void convertMessageToXop() { MimeHeaders mimeHeaders = saajMessage.getMimeHeaders(); String[] oldContentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE); String oldContentType = !ObjectUtils.isEmpty(oldContentTypes) ? oldContentTypes[0] : getVersion().getContentType(); StringBuilder builder = new StringBuilder(CONTENT_TYPE_XOP); builder.append(";type="); builder.append('"'); builder.append(oldContentType); builder.append('"'); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_TYPE, builder.toString()); }
@Override @SuppressWarnings("unchecked") public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
@Override @SuppressWarnings("unchecked") public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
@Override @SuppressWarnings("unchecked") public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getSaajMessage().getAttachments(mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
public Attachment getAttachment(String contentId) { Assert.hasLength(contentId, "contentId must not be empty"); MimeHeaders mimeHeaders = new MimeHeaders(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_ID, contentId); Iterator<AttachmentPart> iterator = getImplementation().getAttachment(getSaajMessage(), mimeHeaders); if (!iterator.hasNext()) { return null; } AttachmentPart saajAttachment = iterator.next(); return new SaajAttachment(saajAttachment); }
private void convertMessageToXop() { MimeHeaders mimeHeaders = saajMessage.getMimeHeaders(); String[] oldContentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE); String oldContentType = !ObjectUtils.isEmpty(oldContentTypes) ? oldContentTypes[0] : getVersion().getContentType(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_TYPE, CONTENT_TYPE_XOP + ";type=" + '"' + oldContentType + '"'); }
private void convertMessageToXop() { MimeHeaders mimeHeaders = saajMessage.getMimeHeaders(); String[] oldContentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE); String oldContentType = !ObjectUtils.isEmpty(oldContentTypes) ? oldContentTypes[0] : getVersion().getContentType(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_TYPE, CONTENT_TYPE_XOP + ";type=" + '"' + oldContentType + '"'); }
private void convertMessageToXop() { MimeHeaders mimeHeaders = saajMessage.getMimeHeaders(); String[] oldContentTypes = mimeHeaders.getHeader(TransportConstants.HEADER_CONTENT_TYPE); String oldContentType = !ObjectUtils.isEmpty(oldContentTypes) ? oldContentTypes[0] : getVersion().getContentType(); mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_TYPE, CONTENT_TYPE_XOP + ";type=" + '"' + oldContentType + '"'); }
public void setCharset(String charset) { ContentType ct = contentType(); ct.setParameter("charset", charset); headers.setHeader("Content-Type", ct.toString()); needsSave(); }
public void writeTo(OutputStream outputStream) throws IOException { MimeHeaders mimeHeaders = getImplementation().getMimeHeaders(getSaajMessage()); if (ObjectUtils.isEmpty(mimeHeaders.getHeader(TransportConstants.HEADER_ACCEPT))) { mimeHeaders.setHeader(TransportConstants.HEADER_ACCEPT, getVersion().getContentType()); } try { getImplementation().writeTo(getSaajMessage(), outputStream); outputStream.flush(); } catch (SOAPException ex) { throw new SaajSoapMessageException("Could not write message to OutputStream: " + ex.getMessage(), ex); } }