Tabnine Logo
org.springframework.web.context.request
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.web.context.request

Best Java code snippets using org.springframework.web.context.request (Showing top 20 results out of 2,979)

origin: spring-projects/spring-framework

@Override
public void registerDestructionCallback(String name, Runnable callback) {
  RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
  attributes.registerDestructionCallback(name, callback, getScope());
}
origin: spring-projects/spring-framework

@Override
public Object get(String name, ObjectFactory<?> objectFactory) {
  Object mutex = RequestContextHolder.currentRequestAttributes().getSessionMutex();
  synchronized (mutex) {
    return super.get(name, objectFactory);
  }
}
origin: spring-projects/spring-framework

@Override
public WebRequest getObject() {
  ServletRequestAttributes requestAttr = currentRequestAttributes();
  return new ServletWebRequest(requestAttr.getRequest(), requestAttr.getResponse());
}
origin: spring-projects/spring-framework

  @Override
  protected NativeWebRequest getWebRequest() {
    RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
    Assert.state(requestAttributes instanceof ServletRequestAttributes, "No ServletRequestAttributes");
    ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
    return new ServletWebRequest(servletRequestAttributes.getRequest());
  }
}
origin: spring-projects/spring-framework

/**
 * Obtain current request through {@link RequestContextHolder}.
 */
protected static HttpServletRequest getCurrentRequest() {
  RequestAttributes attrs = RequestContextHolder.getRequestAttributes();
  Assert.state(attrs instanceof ServletRequestAttributes, "No current ServletRequestAttributes");
  return ((ServletRequestAttributes) attrs).getRequest();
}
origin: spring-projects/spring-framework

@Override
public ServletRequest getObject() {
  return currentRequestAttributes().getRequest();
}
origin: spring-projects/spring-framework

  @Override
  public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    RequestContextHolder.getRequestAttributes().setAttribute(FROM_REQUEST_ATTRIBUTES_FILTER, FROM_REQUEST_ATTRIBUTES_FILTER, RequestAttributes.SCOPE_REQUEST);
    chain.doFilter(request, response);
  }
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Object remove(String name) {
  RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
  Object scopedObject = attributes.getAttribute(name, getScope());
  if (scopedObject != null) {
    attributes.removeAttribute(name, getScope());
    return scopedObject;
  }
  else {
    return null;
  }
}
origin: spring-projects/spring-framework

@Override
public String getConversationId() {
  return RequestContextHolder.currentRequestAttributes().getSessionId();
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Object remove(String name) {
  Object mutex = RequestContextHolder.currentRequestAttributes().getSessionMutex();
  synchronized (mutex) {
    return super.remove(name);
  }
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Object resolveContextualObject(String key) {
  RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
  return attributes.resolveReference(key);
}
origin: spring-projects/spring-framework

  @Override
  public <T> void postProcess(NativeWebRequest webRequest, Callable<T> task, Object concurrentResult) {
    HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
    if (request != null) {
      resetContextHolders(request, null, null);
    }
  }
}
origin: spring-projects/spring-framework

@Override
public Object getNativeRequest() {
  return getRequest();
}
origin: spring-projects/spring-framework

@Override
public boolean checkNotModified(String etag) {
  return checkNotModified(etag, -1);
}
origin: spring-projects/spring-framework

/**
 * Register the given callback as to be executed after session termination.
 * <p>Note: The callback object should be serializable in order to survive
 * web app restarts.
 * @param name the name of the attribute to register the callback for
 * @param callback the callback to be executed for destruction
 */
protected void registerSessionDestructionCallback(String name, Runnable callback) {
  HttpSession session = obtainSession();
  session.setAttribute(DESTRUCTION_CALLBACK_NAME_PREFIX + name,
      new DestructionCallbackBindingListener(callback));
}
origin: spring-projects/spring-framework

@Override
public void registerDestructionCallback(String name, Runnable callback, int scope) {
  if (scope == SCOPE_REQUEST) {
    registerRequestDestructionCallback(name, callback);
  }
  else {
    registerSessionDestructionCallback(name, callback);
  }
}
origin: spring-projects/spring-framework

/**
 * Signal that the request has been completed.
 * <p>Executes all request destruction callbacks and updates the
 * session attributes that have been accessed during request processing.
 */
public void requestCompleted() {
  executeRequestDestructionCallbacks();
  updateAccessedSessionAttributes();
  this.requestActive = false;
}
origin: spring-projects/spring-framework

/**
 * Does the given request qualify as "not modified"?
 * @see ServletWebRequest#checkNotModified(long)
 * @see ServletWebRequest#checkNotModified(String)
 */
private boolean isRequestNotModified(ServletWebRequest webRequest) {
  return webRequest.isNotModified();
}
origin: spring-projects/spring-framework

private boolean validateIfUnmodifiedSince(long lastModifiedTimestamp) {
  if (lastModifiedTimestamp < 0) {
    return false;
  }
  long ifUnmodifiedSince = parseDateHeader(IF_UNMODIFIED_SINCE);
  if (ifUnmodifiedSince == -1) {
    return false;
  }
  // We will perform this validation...
  this.notModified = (ifUnmodifiedSince < (lastModifiedTimestamp / 1000 * 1000));
  return true;
}
origin: spring-projects/spring-framework

private boolean validateIfModifiedSince(long lastModifiedTimestamp) {
  if (lastModifiedTimestamp < 0) {
    return false;
  }
  long ifModifiedSince = parseDateHeader(IF_MODIFIED_SINCE);
  if (ifModifiedSince == -1) {
    return false;
  }
  // We will perform this validation...
  this.notModified = ifModifiedSince >= (lastModifiedTimestamp / 1000 * 1000);
  return true;
}
org.springframework.web.context.request

Most used classes

  • RequestContextHolder
    Holder class to expose the web request in the form of a thread-bound RequestAttributes object. The r
  • ServletRequestAttributes
    Servlet-based implementation of the RequestAttributes interface.Accesses objects from servlet reques
  • NativeWebRequest
    Extension of the WebRequest interface, exposing the native request and response objects in a generic
  • ServletWebRequest
    WebRequest adapter for an javax.servlet.http.HttpServletRequest.
  • WebRequest
    Generic interface for a web request. Mainly intended for generic web request interceptors, giving th
  • DeferredResult,
  • WebAsyncManager,
  • WebAsyncUtils,
  • RequestContextListener,
  • WebAsyncTask,
  • RequestScope,
  • AsyncWebRequest,
  • SessionScope,
  • StandardServletAsyncWebRequest,
  • DestructionCallbackBindingListener,
  • FacesRequestAttributes,
  • WebRequestInterceptor,
  • CallableProcessingInterceptor,
  • AbstractRequestAttributes
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now