Codota Logo
DeferredResultMethodReturnValueHandler
Code IndexAdd Codota to your IDE (free)

How to use
DeferredResultMethodReturnValueHandler
in
org.springframework.web.servlet.mvc.method.annotation

Best Java code snippets using org.springframework.web.servlet.mvc.method.annotation.DeferredResultMethodReturnValueHandler (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

handlers.add(new HttpHeadersReturnValueHandler());
handlers.add(new CallableMethodReturnValueHandler());
handlers.add(new DeferredResultMethodReturnValueHandler());
handlers.add(new AsyncTaskMethodReturnValueHandler(this.beanFactory));
origin: spring-projects/spring-framework

@Override
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
    ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
  if (returnValue == null) {
    mavContainer.setRequestHandled(true);
    return;
  }
  DeferredResult<?> result;
  if (returnValue instanceof DeferredResult) {
    result = (DeferredResult<?>) returnValue;
  }
  else if (returnValue instanceof ListenableFuture) {
    result = adaptListenableFuture((ListenableFuture<?>) returnValue);
  }
  else if (returnValue instanceof CompletionStage) {
    result = adaptCompletionStage((CompletionStage<?>) returnValue);
  }
  else {
    // Should not happen...
    throw new IllegalStateException("Unexpected return value type: " + returnValue);
  }
  WebAsyncUtils.getAsyncManager(webRequest).startDeferredResultProcessing(result, mavContainer);
}
origin: spring-projects/spring-framework

@Test
public void supportsReturnType() throws Exception {
  assertTrue(this.handler.supportsReturnType(
      on(TestController.class).resolveReturnType(DeferredResult.class, String.class)));
  assertTrue(this.handler.supportsReturnType(
      on(TestController.class).resolveReturnType(ListenableFuture.class, String.class)));
  assertTrue(this.handler.supportsReturnType(
      on(TestController.class).resolveReturnType(CompletableFuture.class, String.class)));
}
origin: spring-projects/spring-framework

private void testHandle(Object returnValue, Class<?> asyncType,
    Runnable setResultTask, Object expectedValue) throws Exception {
  ModelAndViewContainer mavContainer = new ModelAndViewContainer();
  MethodParameter returnType = on(TestController.class).resolveReturnType(asyncType, String.class);
  this.handler.handleReturnValue(returnValue, returnType, mavContainer, this.webRequest);
  assertTrue(this.request.isAsyncStarted());
  assertFalse(WebAsyncUtils.getAsyncManager(this.webRequest).hasConcurrentResult());
  setResultTask.run();
  assertTrue(WebAsyncUtils.getAsyncManager(this.webRequest).hasConcurrentResult());
  assertEquals(expectedValue, WebAsyncUtils.getAsyncManager(this.webRequest).getConcurrentResult());
}
origin: org.springframework/spring-webmvc

handlers.add(new HttpHeadersReturnValueHandler());
handlers.add(new CallableMethodReturnValueHandler());
handlers.add(new DeferredResultMethodReturnValueHandler());
handlers.add(new AsyncTaskMethodReturnValueHandler(this.beanFactory));
origin: org.springframework/spring-webmvc

@Override
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
    ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception {
  if (returnValue == null) {
    mavContainer.setRequestHandled(true);
    return;
  }
  DeferredResult<?> result;
  if (returnValue instanceof DeferredResult) {
    result = (DeferredResult<?>) returnValue;
  }
  else if (returnValue instanceof ListenableFuture) {
    result = adaptListenableFuture((ListenableFuture<?>) returnValue);
  }
  else if (returnValue instanceof CompletionStage) {
    result = adaptCompletionStage((CompletionStage<?>) returnValue);
  }
  else {
    // Should not happen...
    throw new IllegalStateException("Unexpected return value type: " + returnValue);
  }
  WebAsyncUtils.getAsyncManager(webRequest).startDeferredResultProcessing(result, mavContainer);
}
origin: spring-projects/spring-framework

@Test
public void doesNotSupportReturnType() throws Exception {
  assertFalse(this.handler.supportsReturnType(on(TestController.class).resolveReturnType(String.class)));
}
origin: spring-projects/spring-framework

@Before
public void setup() throws Exception {
  this.handler = new DeferredResultMethodReturnValueHandler();
  this.request = new MockHttpServletRequest();
  MockHttpServletResponse response = new MockHttpServletResponse();
  this.webRequest = new ServletWebRequest(this.request, response);
  AsyncWebRequest asyncWebRequest = new StandardServletAsyncWebRequest(this.request, response);
  WebAsyncUtils.getAsyncManager(this.webRequest).setAsyncWebRequest(asyncWebRequest);
  this.request.setAsyncSupported(true);
}
origin: apache/servicemix-bundles

handlers.add(new HttpHeadersReturnValueHandler());
handlers.add(new CallableMethodReturnValueHandler());
handlers.add(new DeferredResultMethodReturnValueHandler());
handlers.add(new AsyncTaskMethodReturnValueHandler(this.beanFactory));
origin: stackoverflow.com

handlers.add(new HttpEntityMethodProcessor(getMessageConverters(), this.contentNegotiationManager));
handlers.add(new CallableMethodReturnValueHandler());
handlers.add(new DeferredResultMethodReturnValueHandler());
handlers.add(new AsyncTaskMethodReturnValueHandler(this.beanFactory));
origin: cn.bestwu.simpleframework/simpleframework-web

handlers.add(new HttpHeadersReturnValueHandler());
handlers.add(new CallableMethodReturnValueHandler());
handlers.add(new DeferredResultMethodReturnValueHandler());
handlers.add(new AsyncTaskMethodReturnValueHandler(this.beanFactory));
org.springframework.web.servlet.mvc.method.annotationDeferredResultMethodReturnValueHandler

Javadoc

Handler for return values of type DeferredResult, ListenableFuture, CompletionStage and any other async type with a #getAdapterMap().

Most used methods

  • <init>
  • adaptCompletionStage
  • adaptListenableFuture
  • handleReturnValue
  • supportsReturnType

Popular in Java

  • Making http requests using okhttp
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Collectors (java.util.stream)
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JOptionPane (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now