当前位置: 首页>>代码示例>>Java>>正文


Java PortletSession.APPLICATION_SCOPE属性代码示例

本文整理汇总了Java中javax.portlet.PortletSession.APPLICATION_SCOPE属性的典型用法代码示例。如果您正苦于以下问题:Java PortletSession.APPLICATION_SCOPE属性的具体用法?Java PortletSession.APPLICATION_SCOPE怎么用?Java PortletSession.APPLICATION_SCOPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.portlet.PortletSession的用法示例。


在下文中一共展示了PortletSession.APPLICATION_SCOPE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAttribute

@Override
public void setAttribute(String name, Object value, int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		if (value != null) {
			this.portletAttributes.put(name, value);
		}
		else {
			this.portletAttributes.remove(name);
		}
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		if (value != null) {
			this.applicationAttributes.put(name, value);
		}
		else {
			this.applicationAttributes.remove(name);
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:MockPortletSession.java

示例2: setAttribute

public void setAttribute(String name, Object value, int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		if (value != null) {
			this.portletAttributes.put(name, value);
		}
		else {
			this.portletAttributes.remove(name);
		}
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		if (value != null) {
			this.applicationAttributes.put(name, value);
		}
		else {
			this.applicationAttributes.remove(name);
		}
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:18,代码来源:MockPortletSession.java

示例3: getAttributeNames

public Enumeration<String> getAttributeNames(int scope) {
	// Return all attribute names in the nested HttpSession object.
    if (scope == PortletSession.APPLICATION_SCOPE) {
        return httpSession.getAttributeNames();
    }
    // Return attribute names with the portlet-scoped prefix.
    Vector<String> portletScopedNames = new Vector<String>();
    for (Enumeration<String> en = httpSession.getAttributeNames();
    en.hasMoreElements(); ) {
    	String name = en.nextElement();
    	if (isInCurrentPortletScope(name)) {
    		portletScopedNames.add(
    				PortletSessionUtil.decodeAttributeName(name));
    	}
    }
    return portletScopedNames.elements();
    
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:18,代码来源:PortletSessionImpl.java

示例4: getAttribute

@Override
public Object getAttribute(String name, int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		return this.portletAttributes.get(name);
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		return this.applicationAttributes.get(name);
	}
	return null;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:MockPortletSession.java

示例5: getAttributeNames

@Override
public Enumeration<String> getAttributeNames(int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		return Collections.enumeration(this.portletAttributes.keySet());
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		return Collections.enumeration(this.applicationAttributes.keySet());
	}
	return null;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:MockPortletSession.java

示例6: removeAttribute

@Override
public void removeAttribute(String name, int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		this.portletAttributes.remove(name);
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		this.applicationAttributes.remove(name);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:MockPortletSession.java

示例7: getAttributeMap

@Override
public Map<String, Object> getAttributeMap(int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		return Collections.unmodifiableMap(this.portletAttributes);
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		return Collections.unmodifiableMap(this.applicationAttributes);
	}
	else {
		return Collections.emptyMap();
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:MockPortletSession.java

示例8: getAttributeNames

@Override
public Enumeration<String> getAttributeNames(int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		return Collections.enumeration(new LinkedHashSet<String>(this.portletAttributes.keySet()));
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		return Collections.enumeration(new LinkedHashSet<String>(this.applicationAttributes.keySet()));
	}
	return null;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:MockPortletSession.java

示例9: getAttribute

public Object getAttribute(String name, int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		return this.portletAttributes.get(name);
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		return this.applicationAttributes.get(name);
	}
	return null;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:9,代码来源:MockPortletSession.java

示例10: getAttributeNames

public Enumeration<String> getAttributeNames(int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		return Collections.enumeration(new LinkedHashSet<String>(this.portletAttributes.keySet()));
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		return Collections.enumeration(new LinkedHashSet<String>(this.applicationAttributes.keySet()));
	}
	return null;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:9,代码来源:MockPortletSession.java

示例11: removeAttribute

public void removeAttribute(String name, int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		this.portletAttributes.remove(name);
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		this.applicationAttributes.remove(name);
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:8,代码来源:MockPortletSession.java

示例12: getAttributeMap

public Map<String, Object> getAttributeMap(int scope) {
	if (scope == PortletSession.PORTLET_SCOPE) {
		return Collections.unmodifiableMap(this.portletAttributes);
	}
	else if (scope == PortletSession.APPLICATION_SCOPE) {
		return Collections.unmodifiableMap(this.applicationAttributes);
	}
	else {
		return Collections.emptyMap();
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:11,代码来源:MockPortletSession.java

示例13: removeAttribute

public void removeAttribute(String name, int scope) {
	ArgumentUtility.validateNotNull("attributeName", name);
	if (scope == PortletSession.APPLICATION_SCOPE) {
		httpSession.removeAttribute(name);
	} else {
		httpSession.removeAttribute(createPortletScopedId(name));
	}
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:8,代码来源:PortletSessionImpl.java

示例14: setAttribute

public void setAttribute(String name, Object value, int scope) {
	ArgumentUtility.validateNotNull("attributeName", name);
	if (scope == PortletSession.APPLICATION_SCOPE) {
		httpSession.setAttribute(name, value);
	} else {
		httpSession.setAttribute(createPortletScopedId(name),  value);
	}
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:8,代码来源:PortletSessionImpl.java

示例15: render

@Override
public void render(RenderRequest portletReq, RenderResponse portletResp)
    throws PortletException, IOException {

  long tid = Thread.currentThread().getId();
  portletReq.setAttribute(THREADID_ATTR, tid);

  PrintWriter writer = portletResp.getWriter();

  JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();

  // Create result objects for the tests

  /* TestCase: V2EnvironmentTests_PortletSessionUtil_ApiRender_decodeAttributeName1 */
  /* Details: "Method decodeAttributeName(String): Returns a String */
  /* containing the decoded name of the attribute if the input name is */
  /* an encoded name in PORTLET_SCOPE" */
  TestResult tr0 = tcd
      .getTestResultFailed(V2ENVIRONMENTTESTS_PORTLETSESSIONUTIL_APIRENDER_DECODEATTRIBUTENAME1);
  portletReq.getPortletSession().setAttribute("javax.portlet.p.id?tr0", "true", PORTLET_SCOPE);
  if (PortletSessionUtil.decodeAttributeName("javax.portlet.p.id?tr0").equals("tr0")) {
    tr0.setTcSuccess(true);
  } else {
    tr0.appendTcDetail("Failed because decoded attribute name is not tr0 but "
        + PortletSessionUtil.decodeAttributeName("javax.portlet.p.id?tr0"));
  }
  tr0.writeTo(writer);

  /* TestCase: V2EnvironmentTests_PortletSessionUtil_ApiRender_decodeAttributeName2 */
  /* Details: "Method decodeAttributeName(String): Returns a String */
  /* containing the input name unchanged if the input name is in */
  /* APPLICATION_SCOPE " */
  TestResult tr1 = tcd
      .getTestResultFailed(V2ENVIRONMENTTESTS_PORTLETSESSIONUTIL_APIRENDER_DECODEATTRIBUTENAME2);
  portletReq.getPortletSession().setAttribute("javax.portlet.p.id?tr1", "true",
      APPLICATION_SCOPE);
  if (PortletSessionUtil.decodeAttributeName("javax.portlet.p.id?tr1").equals("tr1")) {
    tr1.setTcSuccess(true);
  } else {
    tr1.appendTcDetail("Failed because decoded attribute name is not tr1 but "
        + PortletSessionUtil.decodeAttributeName("javax.portlet.p.id?tr1"));
  }
  tr1.writeTo(writer);

  /* TestCase: V2EnvironmentTests_PortletSessionUtil_ApiRender_decodeScope1 */
  /* Details: "Method decodeScope(String): Returns the decoded */
  /* attribute scope for the input encoded attribute name" */
  TestResult tr2 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_PORTLETSESSIONUTIL_APIRENDER_DECODESCOPE1);
  if (PortletSessionUtil.decodeScope("javax.portlet.p.id?tr0") == PortletSession.PORTLET_SCOPE) {
    tr2.setTcSuccess(true);
  }
  tr2.writeTo(writer);

  /* TestCase: V2EnvironmentTests_PortletSessionUtil_ApiRender_decodeScope2 */
  /* Details: "Method decodeScope(String): Returns */
  /* PortletSession.APPLICATION_SCOPE if the attribute name is in */
  /* APPLICATION_SCOPE" */
  TestResult tr3 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_PORTLETSESSIONUTIL_APIRENDER_DECODESCOPE2);
  if (PortletSessionUtil.decodeScope("tr1") == PortletSession.APPLICATION_SCOPE) {
    tr3.setTcSuccess(true);
  }
  tr3.writeTo(writer);

  /* TestCase: V2EnvironmentTests_PortletSessionUtil_ApiRender_decodeScope3 */
  /* Details: "Method decodeScope(String): Returns */
  /* PortletSession.PORTLET_SCOPE if the attribute name is in */
  /* PORTLET_SCOPE" */
  TestResult tr4 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_PORTLETSESSIONUTIL_APIRENDER_DECODESCOPE3);
  if (PortletSessionUtil.decodeScope("javax.portlet.p.id?tr0") == PortletSession.PORTLET_SCOPE) {
    tr4.setTcSuccess(true);
  }
  tr4.writeTo(writer);

}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:77,代码来源:EnvironmentTests_PortletSessionUtil_ApiRender.java


注:本文中的javax.portlet.PortletSession.APPLICATION_SCOPE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。