當前位置: 首頁>>代碼示例>>Java>>正文


Java CacheControl.isPublicScope方法代碼示例

本文整理匯總了Java中javax.portlet.CacheControl.isPublicScope方法的典型用法代碼示例。如果您正苦於以下問題:Java CacheControl.isPublicScope方法的具體用法?Java CacheControl.isPublicScope怎麽用?Java CacheControl.isPublicScope使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.portlet.CacheControl的用法示例。


在下文中一共展示了CacheControl.isPublicScope方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMimeRequestProperty

import javax.portlet.CacheControl; //導入方法依賴的package包/類
protected String getMimeRequestProperty(String name, CacheControl cacheControl) {
   if (MimeResponse.ETAG.equals(name)) {
      return cacheControl.getETag();
   } else if (MimeResponse.CACHE_SCOPE.equals(name)) {
      return cacheControl.isPublicScope() ? MimeResponse.PUBLIC_SCOPE : MimeResponse.PRIVATE_SCOPE;
   } else if (MimeResponse.USE_CACHED_CONTENT.equals(name)) {
      return cacheControl.useCachedContent() ? "true" : null;
   } else if (MimeResponse.EXPIRATION_CACHE.equals(name)) {
      return Integer.toString(cacheControl.getExpirationTime());
   }
   return null;
}
 
開發者ID:apache,項目名稱:portals-pluto,代碼行數:13,代碼來源:PortletRequestImpl.java

示例2: render

import javax.portlet.CacheControl; //導入方法依賴的package包/類
@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

  CacheControl chc = portletResp.getCacheControl();

  /* TestCase: V2EnvironmentTests_CacheControl_ApiResource_getExpirationTime3 */
  /* Details: "Method getExpirationTime(): Returns 0 if the expiration */
  /* time has not been set and no default is set in the deployment */
  /* descriptor" */
  TestResult tr2 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_CACHECONTROL_APIRESOURCE_GETEXPIRATIONTIME3);
  int getExpTime = chc.getExpirationTime();
  if (getExpTime == 0) {
    tr2.setTcSuccess(true);
  } else {
    tr2.appendTcDetail("The getExpirationTime did not match the Specified Time :" + getExpTime);
  }
  tr2.writeTo(writer);

  /* TestCase: V2EnvironmentTests_CacheControl_ApiResource_isPublicScope5 */
  /* Details: "Method isPublicScope(): Returns false if the caching */
  /* scope has not been set with the setPublicScope method and has not */
  /* been set in the deployment descriptor" */
  TestResult tr9 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_CACHECONTROL_APIRESOURCE_ISPUBLICSCOPE5);
  if (!chc.isPublicScope()) {
    tr9.setTcSuccess(true);
  } else {
    tr9.appendTcDetail("Failed because isPublicScope() returned true");
  }
  tr9.writeTo(writer);

  /* TestCase: V2EnvironmentTests_CacheControl_ApiResource_useCachedContent3 */
  /* Details: "Method useCachedContent(): Returns false if the use */
  /* cached content indicator has not been set" */
  TestResult tr19 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_CACHECONTROL_APIRESOURCE_USECACHEDCONTENT3);
  if (!chc.useCachedContent()) {
    tr19.setTcSuccess(true);
  }
  tr19.writeTo(writer);

}
 
開發者ID:apache,項目名稱:portals-pluto,代碼行數:54,代碼來源:EnvironmentTests_CacheControl_ApiResource2.java

示例3: render

import javax.portlet.CacheControl; //導入方法依賴的package包/類
@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

  CacheControl chc = portletResp.getCacheControl();

  /* TestCase: V2EnvironmentTests_CacheControl_ApiRender_getExpirationTime3 */
  /* Details: "Method getExpirationTime(): Returns 0 if the expiration */
  /* time has not been set and no default is set in the deployment */
  /* descriptor" */
  TestResult tr2 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_CACHECONTROL_APIRENDER_GETEXPIRATIONTIME3);
  int getExpTime = chc.getExpirationTime();
  if (getExpTime == 0) {
    tr2.setTcSuccess(true);
  } else {
    tr2.appendTcDetail("The getExpirationTime did not match the Specified Time :" + getExpTime);
  }
  tr2.writeTo(writer);

  /* TestCase: V2EnvironmentTests_CacheControl_ApiRender_isPublicScope5 */
  /* Details: "Method isPublicScope(): Returns false if the caching */
  /* scope has not been set with the setPublicScope method and has not */
  /* been set in the deployment descriptor" */
  TestResult tr9 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_CACHECONTROL_APIRENDER_ISPUBLICSCOPE5);
  if (!chc.isPublicScope()) {
    tr9.setTcSuccess(true);
  } else {
    tr9.appendTcDetail("Failed because isPublicScope() returned true");
  }
  tr9.writeTo(writer);

  /* TestCase: V2EnvironmentTests_CacheControl_ApiRender_useCachedContent3 */
  /* Details: "Method useCachedContent(): Returns false if the use */
  /* cached content indicator has not been set" */
  TestResult tr19 =
      tcd.getTestResultFailed(V2ENVIRONMENTTESTS_CACHECONTROL_APIRENDER_USECACHEDCONTENT3);
  if (!chc.useCachedContent()) {
    tr19.setTcSuccess(true);
  }
  tr19.writeTo(writer);

}
 
開發者ID:apache,項目名稱:portals-pluto,代碼行數:54,代碼來源:EnvironmentTests_CacheControl_ApiRender2.java


注:本文中的javax.portlet.CacheControl.isPublicScope方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。