private class MimeMatchingIterator implements Iterator<AttachmentPart> { public MimeMatchingIterator(MimeHeaders headers) { this.headers = headers; this.iter = attachments.iterator(); } private Iterator<AttachmentPart> iter; private MimeHeaders headers; private AttachmentPart nextAttachment; @Override public boolean hasNext() { if (nextAttachment == null) nextAttachment = nextMatch(); return nextAttachment != null; } @Override public AttachmentPart next() { if (nextAttachment != null) { AttachmentPart ret = nextAttachment; nextAttachment = null; return ret; } if (hasNext()) return nextAttachment; return null; }
public String getCharset() { return contentType().getParameter("charset"); }
@Override public AttachmentPart getAttachment(SOAPElement element) throws SOAPException { try { initializeAllAttachments(); } catch (Exception e) { throw new RuntimeException(e); } String uri; String hrefAttr = element.getAttribute("href"); if ("".equals(hrefAttr)) { Node node = getValueNodeStrict(element); String swaRef = null; if (node != null) { swaRef = node.getValue(); } if (swaRef == null || "".equals(swaRef)) { return null; } else { uri = swaRef; } } else { uri = hrefAttr; } return getAttachmentPart(uri); }
private String initCharset() { String charset = null; String[] cts = getMimeHeaders().getHeader("Content-Type"); if ((cts != null) && (cts[0] != null)) { charset = getCharsetString(cts[0]); } if (charset == null) { charset = (String) getProperty(CHARACTER_SET_ENCODING); } if (charset != null) { return charset; } return "utf-8"; }
in = getHeaderBytes(); setFinalContentType(charset); mmp = getXOPMessage(); else mmp = getMimeMessage();
@Override public SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws SOAPException, IOException { String contentTypeString = MessageImpl.getContentType(headers); if (listener != null) { in = new TeeInputStream(in, listener); } try { ContentType contentType = new ContentType(contentTypeString); int stat = MessageImpl.identifyContentType(contentType); if (MessageImpl.isSoap1_1Content(stat)) { return new Message1_1Impl(headers,contentType,stat,in); } else if (MessageImpl.isSoap1_2Content(stat)) { return new Message1_2Impl(headers,contentType,stat,in); } else { log.severe("SAAJ0530.soap.unknown.Content-Type"); throw new SOAPExceptionImpl("Unrecognized Content-Type"); } } catch (ParseException e) { log.severe("SAAJ0531.soap.cannot.parse.Content-Type"); throw new SOAPExceptionImpl( "Unable to parse content type: " + e.getMessage()); } }
headers.setHeader("Accept", getExpectedAcceptHeader()); contentType = new ContentType(); contentType = parseContentType(headers); init(headers,identifyContentType(contentType),contentType,in); public Iterator<AttachmentPart> getAttachments() { try { initializeAllAttachments(); } catch (Exception e) { throw new RuntimeException(e);
public void setCharset(String charset) { ContentType ct = contentType(); ct.setParameter("charset", charset); headers.setHeader("Content-Type", ct.toString()); needsSave(); }
String action = getAction(); if(action != null) l.set("action", action);