/* */ public Source getContent() throws SOAPException { /* 193 */ if (this.source != null) { /* 194 */ InputStream bis = null; /* 195 */ if ((this.source instanceof JAXMStreamSource)) { /* 196 */ StreamSource streamSource = (StreamSource) this.source; /* 197 */ bis = streamSource.getInputStream(); /* 198 */ } else if (FastInfosetReflection.isFastInfosetSource(this.source)) /* */ { /* 200 */ SAXSource saxSource = (SAXSource) this.source; /* 201 */ bis = saxSource.getInputSource().getByteStream(); /* */ } /* */ /* 204 */ if (bis != null) { /* */ try { /* 206 */ bis.reset(); /* */ } /* */ catch (IOException e) /* */ { /* */ } /* */ /* */ } /* */ /* 217 */ return this.source; /* */ } /* */ /* 220 */ return ((Envelope) getEnvelope()).getContent(); /* */ }
/* */ public InputStream getContentAsStream() throws IOException /* */ { /* 272 */ if (this.source != null) { /* 273 */ InputStream is = null; /* */ /* 276 */ if (((this.source instanceof StreamSource)) && (!isFastInfoset())) { /* 277 */ is = ((StreamSource) this.source).getInputStream(); /* */ } /* 279 */ else if ((FastInfosetReflection.isFastInfosetSource(this.source)) && (isFastInfoset())) /* */ { /* */ try /* */ { /* 284 */ is = FastInfosetReflection.FastInfosetSource_getInputStream(this.source); /* */ } /* */ catch (Exception e) { /* 287 */ throw new IOException(e.toString()); /* */ } /* */ } /* */ /* 291 */ if (is != null) { /* 292 */ if (lazyContentLength) { /* 293 */ return is; /* */ } /* 295 */ if (!(is instanceof ByteInputStream)) { /* 296 */ log.severe("SAAJ0546.soap.stream.incorrect.type"); /* 297 */ throw new IOException("Internal error: stream not of the right type"); /* */ } /* 299 */ return (ByteInputStream) is; /* */ } /* */ /* */ } /* */ /* 305 */ ByteOutputStream b = new ByteOutputStream(); /* */ /* 307 */ Envelope env = null; /* */ try /* */ { /* 310 */ env = (Envelope) getEnvelope(); /* 311 */ env.output(b, isFastInfoset()); /* */ } /* */ catch (SOAPException soapException) { /* 314 */ log.severe("SAAJ0547.soap.cannot.externalize"); /* 315 */ throw new SOAPIOException( "SOAP exception while trying to externalize: ", soapException); /* */ } /* */ /* 320 */ return b.newInputStream(); /* */ }
/* */ public void setContent(Source source) throws SOAPException { /* */ try { /* 225 */ if ((source instanceof StreamSource)) { /* 226 */ InputStream is = ((StreamSource) source).getInputStream(); /* 227 */ Reader rdr = ((StreamSource) source).getReader(); /* */ /* 229 */ if (is != null) { /* 230 */ this.source = new JAXMStreamSource(is); /* 231 */ } else if (rdr != null) { /* 232 */ this.source = new JAXMStreamSource(rdr); /* */ } else { /* 234 */ log.severe("SAAJ0544.soap.no.valid.reader.for.src"); /* 235 */ throw new SOAPExceptionImpl( "Source does not have a valid Reader or InputStream"); /* */ } /* */ } /* 238 */ else if (FastInfosetReflection.isFastInfosetSource(source)) /* */ { /* 240 */ InputStream is = FastInfosetReflection.FastInfosetSource_getInputStream(source); /* */ /* 247 */ if (!(is instanceof ByteInputStream)) { /* 248 */ ByteOutputStream bout = new ByteOutputStream(); /* 249 */ bout.write(is); /* */ /* 252 */ FastInfosetReflection.FastInfosetSource_setInputStream( source, bout.newInputStream()); /* */ } /* */ /* 255 */ this.source = source; /* */ } /* */ else { /* 258 */ this.source = source; /* */ } /* 260 */ this.sourceWasSet = true; /* */ } /* */ catch (Exception ex) { /* 263 */ ex.printStackTrace(); /* */ /* 265 */ log.severe("SAAJ0545.soap.cannot.set.src.for.part"); /* 266 */ throw new SOAPExceptionImpl( "Error setting the source for SOAPPart: " + ex.getMessage()); /* */ } /* */ }