Tabnine Logo
MockPageContext.getAttribute
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-framework

@Override
public int getAttributesScope(String name) {
  if (getAttribute(name) != null) {
    return PAGE_SCOPE;
  }
  else if (getAttribute(name, REQUEST_SCOPE) != null) {
    return REQUEST_SCOPE;
  }
  else if (getAttribute(name, SESSION_SCOPE) != null) {
    return SESSION_SCOPE;
  }
  else if (getAttribute(name, APPLICATION_SCOPE) != null) {
    return APPLICATION_SCOPE;
  }
  else {
    return 0;
  }
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Object findAttribute(String name) {
  Object value = getAttribute(name);
  if (value == null) {
    value = getAttribute(name, REQUEST_SCOPE);
    if (value == null) {
      value = getAttribute(name, SESSION_SCOPE);
      if (value == null) {
        value = getAttribute(name, APPLICATION_SCOPE);
      }
    }
  }
  return value;
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Object getAttribute(String name, int scope) {
  Assert.notNull(name, "Attribute name must not be null");
  switch (scope) {
    case PAGE_SCOPE:
      return getAttribute(name);
    case REQUEST_SCOPE:
      return this.request.getAttribute(name);
    case SESSION_SCOPE:
      HttpSession session = this.request.getSession(false);
      return (session != null ? session.getAttribute(name) : null);
    case APPLICATION_SCOPE:
      return this.servletContext.getAttribute(name);
    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 Object findAttribute(String name) {
  Object value = getAttribute(name);
  if (value == null) {
    value = getAttribute(name, REQUEST_SCOPE);
    if (value == null) {
      value = getAttribute(name, SESSION_SCOPE);
      if (value == null) {
        value = getAttribute(name, APPLICATION_SCOPE);
      }
    }
  }
  return value;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

@Override
public int getAttributesScope(String name) {
  if (getAttribute(name) != null) {
    return PAGE_SCOPE;
  }
  else if (getAttribute(name, REQUEST_SCOPE) != null) {
    return REQUEST_SCOPE;
  }
  else if (getAttribute(name, SESSION_SCOPE) != null) {
    return SESSION_SCOPE;
  }
  else if (getAttribute(name, APPLICATION_SCOPE) != null) {
    return APPLICATION_SCOPE;
  }
  else {
    return 0;
  }
}
origin: apache/servicemix-bundles

@Override
public int getAttributesScope(String name) {
  if (getAttribute(name) != null) {
    return PAGE_SCOPE;
  }
  else if (getAttribute(name, REQUEST_SCOPE) != null) {
    return REQUEST_SCOPE;
  }
  else if (getAttribute(name, SESSION_SCOPE) != null) {
    return SESSION_SCOPE;
  }
  else if (getAttribute(name, APPLICATION_SCOPE) != null) {
    return APPLICATION_SCOPE;
  }
  else {
    return 0;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

@Override
@Nullable
public Object findAttribute(String name) {
  Object value = getAttribute(name);
  if (value == null) {
    value = getAttribute(name, REQUEST_SCOPE);
    if (value == null) {
      value = getAttribute(name, SESSION_SCOPE);
      if (value == null) {
        value = getAttribute(name, APPLICATION_SCOPE);
      }
    }
  }
  return value;
}
origin: apache/servicemix-bundles

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

@Override
@Nullable
public Object getAttribute(String name, int scope) {
  Assert.notNull(name, "Attribute name must not be null");
  switch (scope) {
    case PAGE_SCOPE:
      return getAttribute(name);
    case REQUEST_SCOPE:
      return this.request.getAttribute(name);
    case SESSION_SCOPE:
      HttpSession session = this.request.getSession(false);
      return (session != null ? session.getAttribute(name) : null);
    case APPLICATION_SCOPE:
      return this.servletContext.getAttribute(name);
    default:
      throw new IllegalArgumentException("Invalid scope: " + scope);
  }
}
org.springframework.mock.webMockPageContextgetAttribute

Popular methods of MockPageContext

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

Popular in Java

  • Finding current android device location
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Menu (java.awt)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Top plugins for Android Studio
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