org.apache.xmlrpc.client.XmlRpcClientException.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.xmlrpc.client.XmlRpcClientException.<init>()方法的一些代码示例,展示了XmlRpcClientException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlRpcClientException.<init>()方法的具体详情如下:
包路径:org.apache.xmlrpc.client.XmlRpcClientException
类名称:XmlRpcClientException
方法名:<init>

XmlRpcClientException.<init>介绍

[英]Create an XmlRpcClientException with the given message and underlying cause exception.
[中]使用给定的消息和潜在原因异常创建XmlRpcClientException。

代码示例

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. protected InputStream getInputStream() throws XmlRpcException {
  2. try {
  3. return method.getResponseBodyAsStream();
  4. } catch (HttpException e) {
  5. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e);
  6. } catch (IOException e) {
  7. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e);
  8. }
  9. }

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. throw new XmlRpcClientException("Failed to close connection: " + e.getMessage(), e);

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. throw new XmlRpcClientException("Failed to close connection: " + e.getMessage(), e);

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. protected InputStream getInputStream() throws XmlRpcException {
  2. try {
  3. checkStatus(method);
  4. return method.getResponseBodyAsStream();
  5. } catch (HttpException e) {
  6. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e);
  7. } catch (IOException e) {
  8. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e);
  9. }
  10. }

代码示例来源:origin: rosjava/rosjava_core

  1. protected InputStream getInputStream() throws XmlRpcException {
  2. try {
  3. checkStatus(method);
  4. return method.getResponseBodyAsStream();
  5. } catch (HttpException e) {
  6. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e);
  7. } catch (IOException e) {
  8. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e);
  9. }
  10. }

代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-client

  1. @Override
  2. protected InputStream getInputStream()
  3. throws XmlRpcException
  4. {
  5. try
  6. {
  7. client = builder.setHeaders( headers ).build();
  8. // Check the status of the return
  9. Response response = client.post( new ByteArrayBodyGenerator( byteOs.toByteArray() ) ).get();
  10. return response.getResponseBodyAsStream();
  11. }
  12. catch ( InterruptedException e )
  13. {
  14. throw new XmlRpcClientException( "Interruption during communication: " + e.getMessage(), e );
  15. }
  16. catch ( ExecutionException e )
  17. {
  18. throw new XmlRpcClientException( "Execution error during communication: " + e.getMessage(), e );
  19. }
  20. catch ( IOException e )
  21. {
  22. throw new XmlRpcClientException( "I/O error in server communication: " + e.getMessage(), e );
  23. }
  24. finally
  25. {
  26. byteOs.reset();
  27. }
  28. }

代码示例来源:origin: stackoverflow.com

  1. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  2. } catch (IOException e) {
  3. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse servers response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read servers response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. } else {
  17. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  18. }
  19. }
  20. }

代码示例来源:origin: org.eclipse.mylyn.commons/xmlrpc

  1. @Override
  2. protected InputStream getInputStream() throws XmlRpcException {
  3. int responseCode = method.getStatusCode();
  4. if (responseCode != HttpURLConnection.HTTP_OK) {
  5. XmlRpcHttpException e = new XmlRpcHttpException(responseCode);
  6. if (responseCode == HttpStatus.SC_UNAUTHORIZED) {
  7. e.setAuthScheme(method.getHostAuthState().getAuthScheme());
  8. }
  9. throw e;
  10. }
  11. try {
  12. return method.getResponseBodyAsStream();
  13. } catch (HttpException e) {
  14. throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); //$NON-NLS-1$
  15. } catch (IOException e) {
  16. throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); //$NON-NLS-1$
  17. }
  18. }

代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-client

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. }
  17. Throwable t = xp.getErrorCause();
  18. if (t == null) {
  19. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  20. }
  21. if (t instanceof XmlRpcException) {
  22. throw (XmlRpcException) t;
  23. }
  24. if (t instanceof RuntimeException) {
  25. throw (RuntimeException) t;
  26. }
  27. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  28. }
  29. }

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. }
  17. Throwable t = xp.getErrorCause();
  18. if (t == null) {
  19. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  20. }
  21. if (t instanceof XmlRpcException) {
  22. throw (XmlRpcException) t;
  23. }
  24. if (t instanceof RuntimeException) {
  25. throw (RuntimeException) t;
  26. }
  27. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  28. }
  29. }

代码示例来源:origin: org.ogema.drivers/homematic-xmlrpc-ll

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. isource.setEncoding(pConfig.getEncoding()); //jl
  4. XMLReader xr = newXMLReader();
  5. XmlRpcResponseParser xp;
  6. try {
  7. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  8. xr.setContentHandler(xp);
  9. xr.parse(isource);
  10. } catch (SAXException e) {
  11. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  12. } catch (IOException e) {
  13. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  14. }
  15. if (xp.isSuccess()) {
  16. return xp.getResult();
  17. }
  18. Throwable t = xp.getErrorCause();
  19. if (t == null) {
  20. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  21. }
  22. if (t instanceof XmlRpcException) {
  23. throw (XmlRpcException) t;
  24. }
  25. if (t instanceof RuntimeException) {
  26. throw (RuntimeException) t;
  27. }
  28. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  29. }
  30. }

代码示例来源:origin: rosjava/rosjava_core

  1. protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException {
  2. InputSource isource = new InputSource(pStream);
  3. XMLReader xr = newXMLReader();
  4. XmlRpcResponseParser xp;
  5. try {
  6. xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory());
  7. xr.setContentHandler(xp);
  8. xr.parse(isource);
  9. } catch (SAXException e) {
  10. throw new XmlRpcClientException("Failed to parse server's response: " + e.getMessage(), e);
  11. } catch (IOException e) {
  12. throw new XmlRpcClientException("Failed to read server's response: " + e.getMessage(), e);
  13. }
  14. if (xp.isSuccess()) {
  15. return xp.getResult();
  16. }
  17. Throwable t = xp.getErrorCause();
  18. if (t == null) {
  19. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage());
  20. }
  21. if (t instanceof XmlRpcException) {
  22. throw (XmlRpcException) t;
  23. }
  24. if (t instanceof RuntimeException) {
  25. throw (RuntimeException) t;
  26. }
  27. throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage(), t);
  28. }
  29. }

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. protected void setCredentials(XmlRpcHttpClientConfig pConfig)
  2. throws XmlRpcClientException {
  3. String auth;
  4. try {
  5. auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(),
  6. pConfig.getBasicPassword(),
  7. pConfig.getBasicEncoding());
  8. } catch (UnsupportedEncodingException e) {
  9. throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e);
  10. }
  11. if (auth != null) {
  12. setRequestHeader("Authorization", "Basic " + auth);
  13. }
  14. }

代码示例来源:origin: rosjava/rosjava_core

  1. protected void setCredentials(XmlRpcHttpClientConfig pConfig)
  2. throws XmlRpcClientException {
  3. String auth;
  4. try {
  5. auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(),
  6. pConfig.getBasicPassword(),
  7. pConfig.getBasicEncoding());
  8. } catch (UnsupportedEncodingException e) {
  9. throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e);
  10. }
  11. if (auth != null) {
  12. setRequestHeader("Authorization", "Basic " + auth);
  13. }
  14. }

代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-client

  1. protected void setCredentials(XmlRpcHttpClientConfig pConfig)
  2. throws XmlRpcClientException {
  3. String auth;
  4. try {
  5. auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(),
  6. pConfig.getBasicPassword(),
  7. pConfig.getBasicEncoding());
  8. } catch (UnsupportedEncodingException e) {
  9. throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e);
  10. }
  11. if (auth != null) {
  12. setRequestHeader("Authorization", "Basic " + auth);
  13. }
  14. }

代码示例来源:origin: xmlrpc/xmlrpc-client

  1. protected void setCredentials(XmlRpcHttpClientConfig pConfig)
  2. throws XmlRpcClientException {
  3. String auth;
  4. try {
  5. auth = HttpUtil.encodeBasicAuthentication(pConfig.getBasicUserName(),
  6. pConfig.getBasicPassword(),
  7. pConfig.getBasicEncoding());
  8. } catch (UnsupportedEncodingException e) {
  9. throw new XmlRpcClientException("Unsupported encoding: " + pConfig.getBasicEncoding(), e);
  10. }
  11. if (auth != null) {
  12. setRequestHeader("Authorization", "Basic " + auth);
  13. }
  14. }

代码示例来源:origin: org.sonatype.sisu/sisu-xmlrpc-client

  1. @Override
  2. protected void initHttpHeaders( XmlRpcRequest xmlRpcRequest )
  3. throws XmlRpcClientException
  4. {
  5. if ( !XmlRpcClientConfigImpl.class.isAssignableFrom( xmlRpcRequest.getConfig().getClass() ) )
  6. {
  7. throw new XmlRpcClientException( "Invalid XmlRpcRequest", null );
  8. }
  9. XmlRpcClientConfigImpl config = XmlRpcClientConfigImpl.class.cast( xmlRpcRequest.getConfig() );
  10. super.initHttpHeaders( xmlRpcRequest );
  11. configureProxy( config );
  12. configureTimeout( config );
  13. if ( config.getSslContext() != null )
  14. {
  15. builder.setSSLContext( config.getSslContext() );
  16. }
  17. if (config.isGzipRequesting())
  18. {
  19. builder.setRequestCompressionLevel(6);
  20. }
  21. builder.setUrl( config.getServerURL().toString() ).setFollowRedirects( config.isFollowRedirect() );
  22. }

代码示例来源:origin: rosjava/rosjava_core

  1. throw t;
  2. } catch (Throwable t) {
  3. throw new XmlRpcClientException("Failed to invoke method " + pRequest.getMethodName()
  4. + ": " + t.getMessage(), t);

代码示例来源:origin: org.apache.xmlrpc/xmlrpc-client

  1. throw t;
  2. } catch (Throwable t) {
  3. throw new XmlRpcClientException("Failed to invoke method " + pRequest.getMethodName()
  4. + ": " + t.getMessage(), t);

相关文章

XmlRpcClientException类方法