congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
MockPageContext.setAttribute
Code IndexAdd Tabnine to your IDE (free)

How to use
setAttribute
method
in
org.springframework.mock.web.MockPageContext

Best Java code snippets using org.springframework.mock.web.MockPageContext.setAttribute (Showing top 5 results out of 315)

origin: spring-projects/spring-framework

@Override
public void setAttribute(String name, @Nullable Object value, int scope) {
  Assert.notNull(name, "Attribute name must not be null");
  switch (scope) {
    case PAGE_SCOPE:
      setAttribute(name, value);
      break;
    case REQUEST_SCOPE:
      this.request.setAttribute(name, value);
      break;
    case SESSION_SCOPE:
      this.request.getSession().setAttribute(name, value);
      break;
    case APPLICATION_SCOPE:
      this.servletContext.setAttribute(name, value);
      break;
    default:
      throw new IllegalArgumentException("Invalid scope: " + scope);
  }
}
origin: spring-projects/spring-framework

@Test
public void setAttributeWithNoScopeUsesPageScope() throws Exception {
  ctx.setAttribute(key, value);
  assertEquals(value, ctx.getAttribute(key, PageContext.PAGE_SCOPE));
  assertNull(ctx.getAttribute(key, PageContext.APPLICATION_SCOPE));
  assertNull(ctx.getAttribute(key, PageContext.REQUEST_SCOPE));
  assertNull(ctx.getAttribute(key, PageContext.SESSION_SCOPE));
}
origin: spring-projects/spring-framework

@Test
public void removeAttributeWithNoScopeSpecifiedRemovesValueFromAllScopes() throws Exception {
  ctx.setAttribute(key, value, PageContext.APPLICATION_SCOPE);
  ctx.removeAttribute(key);
  assertNull(ctx.getAttribute(key, PageContext.PAGE_SCOPE));
  assertNull(ctx.getAttribute(key, PageContext.APPLICATION_SCOPE));
  assertNull(ctx.getAttribute(key, PageContext.REQUEST_SCOPE));
  assertNull(ctx.getAttribute(key, PageContext.SESSION_SCOPE));
}
origin: apache/servicemix-bundles

@Override
public void setAttribute(String name, Object value, int scope) {
  Assert.notNull(name, "Attribute name must not be null");
  switch (scope) {
    case PAGE_SCOPE:
      setAttribute(name, value);
      break;
    case REQUEST_SCOPE:
      this.request.setAttribute(name, value);
      break;
    case SESSION_SCOPE:
      this.request.getSession().setAttribute(name, value);
      break;
    case APPLICATION_SCOPE:
      this.servletContext.setAttribute(name, value);
      break;
    default:
      throw new IllegalArgumentException("Invalid scope: " + scope);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

@Override
public void setAttribute(String name, @Nullable Object value, int scope) {
  Assert.notNull(name, "Attribute name must not be null");
  switch (scope) {
    case PAGE_SCOPE:
      setAttribute(name, value);
      break;
    case REQUEST_SCOPE:
      this.request.setAttribute(name, value);
      break;
    case SESSION_SCOPE:
      this.request.getSession().setAttribute(name, value);
      break;
    case APPLICATION_SCOPE:
      this.servletContext.setAttribute(name, value);
      break;
    default:
      throw new IllegalArgumentException("Invalid scope: " + scope);
  }
}
org.springframework.mock.webMockPageContextsetAttribute

Popular methods of MockPageContext

  • <init>
    Create new MockServletConfig.
  • getAttribute
  • removeAttribute
  • getAttributeNames

Popular in Java

  • Running tasks concurrently on multiple threads
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • ImageIO (javax.imageio)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JFileChooser (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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