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


Java CacheControl类代码示例

本文整理汇总了Java中javax.portlet.CacheControl的典型用法代码示例。如果您正苦于以下问题:Java CacheControl类的具体用法?Java CacheControl怎么用?Java CacheControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setUp

import javax.portlet.CacheControl; //导入依赖的package包/类
protected void setUp( ) throws Exception
    {
        super.setUp();

        // Create mocks
        mockServices = mock( ContainerServices.class );
        mockCCPPProfileService = mock( CCPPProfileService.class );
        mockPortalContext = mock( PortalContext.class );
        mockPortletContext = mock( PortletContext.class );
        mockPortletURLProvider = mock(PortletURLProvider.class);
        mockContainer = mock( PortletContainerImpl.class,
                new Class[] { String.class, ContainerServices.class },
                new Object[] { "Mock Pluto Container", (ContainerServices) mockServices.proxy() } );
        window = (PortletWindow) mock( PortletWindow.class ).proxy();
        mockHttpServletRequest = mock( HttpServletRequest.class );
        mockPortletRequestContext = mock ( PortletRequestContext.class );
        mockPortletResponseContext = mock ( PortletRenderResponseContext.class );
        mock ( CacheControl.class );

        // Constructor expectations for RenderRequestImpl
//        mockContainer.expects( atLeastOnce() ).method( "getOptionalContainerServices" ).will( returnValue( mockOptionalServices.proxy() ) );
//        mockServices.expects( once() ).method( "getPortalContext" ).will( returnValue( mockPortalContext.proxy() ) );
    }
 
开发者ID:apache,项目名称:portals-pluto,代码行数:24,代码来源:PortletRequestImplTest.java

示例2: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
@Override
public CacheControl getCacheControl() {
   String meth = "getCacheControl";
   Object[] args = {};
   CacheControl ret = ((MimeResponse) resp).getCacheControl();
   retVal = ret;
   checkArgs(meth, args);
   return ret;
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:10,代码来源:RenderResponseWrapperChecker.java

示例3: 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

示例4: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
@Override
public CacheControl getCacheControl() {
   if (isClosed()) {
      return null;
   }
   if (cacheControl == null) {
      cacheControl = new CacheControlImpl();
   }
   return cacheControl;
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:11,代码来源:PortletMimeResponseContextImpl.java

示例5: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
@Override
public CacheControl getCacheControl() {
	return this.cacheControl;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:MockMimeResponse.java

示例6: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
public CacheControl getCacheControl() {
	return this.cacheControl;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:4,代码来源:MockMimeResponse.java

示例7: 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

示例8: 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

示例9: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
public CacheControl getCacheControl() {
   return responseContext.getCacheControl();
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:4,代码来源:MimeResponseImpl.java

示例10: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
@Override
public CacheControl getCacheControl() {
   return null;
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:5,代码来源:MockMimeResponse.java

示例11: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
/**
 * The default behavior of this method is to call
 * <code>getCacheControl()</code> on the wrapped response object.
 */
public CacheControl getCacheControl() {
   return ((MimeResponse)response).getCacheControl();
}
 
开发者ID:apache,项目名称:portals-pluto,代码行数:8,代码来源:MimeResponseWrapper.java

示例12: getCacheControl

import javax.portlet.CacheControl; //导入依赖的package包/类
CacheControl getCacheControl(); 
开发者ID:apache,项目名称:portals-pluto,代码行数:2,代码来源:PortletMimeResponseContext.java


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