當前位置: 首頁>>代碼示例>>Java>>正文


Java Response.get方法代碼示例

本文整理匯總了Java中javax.xml.ws.Response.get方法的典型用法代碼示例。如果您正苦於以下問題:Java Response.get方法的具體用法?Java Response.get怎麽用?Java Response.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.ws.Response的用法示例。


在下文中一共展示了Response.get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleResponse

import javax.xml.ws.Response; //導入方法依賴的package包/類
@Override
public void handleResponse(Response<String> response) {
   try {
      res = response.get();
   } catch (Exception e) {
      e.printStackTrace();
      res = e.getMessage();
   }
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:10,代碼來源:ContinuationsTestCase.java

示例2: testInvokeAsync

import javax.xml.ws.Response; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testInvokeAsync() throws Exception
{
   Endpoint port = createProxy();
   Response<String> response = port.echoAsync("Async");

   // access future
   String retStr = response.get();
   assertEquals("Async", retStr);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:12,代碼來源:AsynchronousTestCase.java

示例3: testInvokeAsyncHandler

import javax.xml.ws.Response; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testInvokeAsyncHandler() throws Exception
{
   AsyncHandler<String> handler = new AsyncHandler<String>()
   {
      @Override
      public void handleResponse(Response<String> response)
      {
         try
         {
            System.out.println("AsyncHandler.handleResponse() method called");
            String retStr = response.get(5000, TimeUnit.MILLISECONDS);
            assertEquals("Hello", retStr);
            asyncHandlerProxyCalled = true;
         }
         catch (Exception ex)
         {
            handlerProxyException = ex;
         }
      }
   };

   Endpoint port = createProxy();
   Future<?> future = port.echoAsync("Hello", handler);
   long start = System.currentTimeMillis();
   future.get(5000, TimeUnit.MILLISECONDS);
   long end = System.currentTimeMillis();
   System.out.println("Time spent in future.get() was " + (end - start) + "milliseconds");

   if (handlerProxyException != null)
      throw handlerProxyException;

   assertTrue("Async handler called", asyncHandlerProxyCalled);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:36,代碼來源:AsynchronousTestCase.java

示例4: handleResponse

import javax.xml.ws.Response; //導入方法依賴的package包/類
@Override
public void handleResponse(Response<T> response) {
    if (response.isCancelled()) {
        if (logger.isErrorEnabled()) {
            logger.error(MESSAGES.WEB_RESPONSE_CANCELED);
        }
        Exception exception = new MovilizerWebServiceException(
                MESSAGES.REQUEST_CANCELLED_ERROR);
        futureCallback.onFailure(exception);
        futureCallback.onComplete(null, exception);
        return;
    }
    if (response.isDone()) {
        try {
            if (logger.isTraceEnabled()) {
                logger.trace(MESSAGES.HANDLING_WEB_RESPONSE);
            }
            T resInstance = response.get();
            if (logger.isDebugEnabled()) {
                logger.debug(String.format(MESSAGES.SUCCESSFUL_WEB_RESPONSE,
                        resInstance.getClass().toString()));
            }
            futureCallback.onSuccess(resInstance);
            futureCallback.onComplete(resInstance, null);
        } catch (ExecutionException | InterruptedException e) {
            futureCallback.onFailure(e);
            futureCallback.onComplete(null, e);
        }
    } else {
        if (logger.isErrorEnabled()) {
            logger.error(MESSAGES.WEB_RESPONSE_NOT_DONE);
        }
    }
}
 
開發者ID:Movilizer,項目名稱:movilizer-webservice,代碼行數:35,代碼來源:AsyncHandlerAdapter.java


注:本文中的javax.xml.ws.Response.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。