Java 类javax.portlet.ResourceServingPortlet 实例源码

项目:portals-pluto    文件:CDIPrototyping.java   
@Test
public void beanMgrTest() throws Exception {
   assertNotNull(bm);

   Set<Bean<?>> beans = bm.getBeans(TestPortlet1.class);
   Bean<?> bean = bm.resolve(beans);
   assertNotNull(bean);

   CreationalContext<?> coco = bm.createCreationalContext(bean);
   assertNotNull(coco);

   Object obj = bm.getReference(bean, TestPortlet1.class, coco);
   assertNotNull(obj);
   assertTrue(obj instanceof GenericPortlet);
   assertTrue(obj instanceof Portlet);
   assertTrue(obj instanceof HeaderPortlet);
   assertTrue(obj instanceof EventPortlet);
   assertTrue(obj instanceof ResourceServingPortlet);

   Object obj2 = bm.getReference(bean, TestPortlet1.class, coco);
   assertNotNull(obj2);
   assertFalse(obj.equals(obj2));
   assertFalse(obj == obj2);
}
项目:portals-pluto    文件:CDIPrototyping.java   
@Test
public void appScopedTest() throws Exception {
   assertNotNull(bm);

   Set<Bean<?>> beans = bm.getBeans(TestPortlet1AppScoped.class);
   Bean<?> bean = bm.resolve(beans);
   assertNotNull(bean);

   CreationalContext<?> coco = bm.createCreationalContext(bean);
   assertNotNull(coco);

   Object obj = bm.getReference(bean, TestPortlet1AppScoped.class, coco);
   assertNotNull(obj);
   assertTrue(obj instanceof GenericPortlet);
   assertTrue(obj instanceof Portlet);
   assertTrue(obj instanceof HeaderPortlet);
   assertTrue(obj instanceof EventPortlet);
   assertTrue(obj instanceof ResourceServingPortlet);

   Object obj2 = bm.getReference(bean, TestPortlet1AppScoped.class, coco);
   assertNotNull(obj2);
   assertTrue(obj.equals(obj2));
   assertTrue(obj == obj2);
}
项目:spring4-understanding    文件:PortletWrappingController.java   
@Override
public ModelAndView handleResourceRequest(
        ResourceRequest request, ResourceResponse response) throws Exception {

    if (!(this.portletInstance instanceof ResourceServingPortlet)) {
        throw new NoHandlerFoundException("Cannot handle resource request - target portlet [" +
                this.portletInstance.getClass() + " does not implement ResourceServingPortlet");
    }
    ResourceServingPortlet resourcePortlet = (ResourceServingPortlet) this.portletInstance;

    // Delegate to PortletContentGenerator for checking and preparing.
    checkAndPrepare(request, response);

    // Execute in synchronized block if required.
    if (isSynchronizeOnSession()) {
        PortletSession session = request.getPortletSession(false);
        if (session != null) {
            Object mutex = PortletUtils.getSessionMutex(session);
            synchronized (mutex) {
                resourcePortlet.serveResource(request, response);
                return null;
            }
        }
    }

    resourcePortlet.serveResource(request, response);
    return null;
}
项目:spring4-understanding    文件:SimplePortletHandlerAdapter.java   
@Override
public ModelAndView handleResource(ResourceRequest request, ResourceResponse response, Object handler)
        throws Exception {

    if (handler instanceof ResourceServingPortlet) {
        ((ResourceServingPortlet) handler).serveResource(request, response);
    }
    else {
        // roughly equivalent to Portlet 2.0 GenericPortlet
        PortletUtils.serveResource(request, response, this.portletContext);
    }
    return null;
}
项目:class-guard    文件:PortletWrappingController.java   
public ModelAndView handleResourceRequest(
        ResourceRequest request, ResourceResponse response) throws Exception {

    if (!(this.portletInstance instanceof ResourceServingPortlet)) {
        throw new NoHandlerFoundException("Cannot handle resource request - target portlet [" +
                this.portletInstance.getClass() + " does not implement ResourceServingPortlet");
    }
    ResourceServingPortlet resourcePortlet = (ResourceServingPortlet) this.portletInstance;

    // Delegate to PortletContentGenerator for checking and preparing.
    checkAndPrepare(request, response);

    // Execute in synchronized block if required.
    if (isSynchronizeOnSession()) {
        PortletSession session = request.getPortletSession(false);
        if (session != null) {
            Object mutex = PortletUtils.getSessionMutex(session);
            synchronized (mutex) {
                resourcePortlet.serveResource(request, response);
                return null;
            }
        }
    }

    resourcePortlet.serveResource(request, response);
    return null;
}
项目:class-guard    文件:SimplePortletHandlerAdapter.java   
public ModelAndView handleResource(ResourceRequest request, ResourceResponse response, Object handler)
        throws Exception {

    if (handler instanceof ResourceServingPortlet) {
        ((ResourceServingPortlet) handler).serveResource(request, response);
    }
    else {
        // roughly equivalent to Portlet 2.0 GenericPortlet
        PortletUtils.serveResource(request, response, this.portletContext);
    }
    return null;
}
项目:portals-pluto    文件:CDIPrototyping.java   
@Test
public void appScopedTest2Coco() throws Exception {
   assertNotNull(bm);

   Set<Bean<?>> beans = bm.getBeans(TestPortlet1AppScoped.class);
   Bean<?> bean = bm.resolve(beans);
   assertNotNull(bean);

   CreationalContext<?> coco1 = bm.createCreationalContext(bean);
   assertNotNull(coco1);

   Object obj = bm.getReference(bean, TestPortlet1AppScoped.class, coco1);
   assertNotNull(obj);
   assertTrue(obj instanceof GenericPortlet);
   assertTrue(obj instanceof Portlet);
   assertTrue(obj instanceof HeaderPortlet);
   assertTrue(obj instanceof EventPortlet);
   assertTrue(obj instanceof ResourceServingPortlet);

   CreationalContext<?> coco2 = bm.createCreationalContext(bean);
   assertNotNull(coco2);

   Object obj2 = bm.getReference(bean, TestPortlet1AppScoped.class, coco2);
   assertNotNull(obj2);
   assertTrue(obj.equals(obj2));
   assertTrue(obj == obj2);
}
项目:portals-pluto    文件:CDIPrototyping.java   
@Test
public void appScopedTest2Coco2Bean() throws Exception {
   assertNotNull(bm);

   Set<Bean<?>> beans1 = bm.getBeans(TestPortlet1AppScoped.class);
   Bean<?> bean1 = bm.resolve(beans1);
   assertNotNull(bean1);

   CreationalContext<?> coco1 = bm.createCreationalContext(bean1);
   assertNotNull(coco1);

   Object obj = bm.getReference(bean1, TestPortlet1AppScoped.class, coco1);
   assertNotNull(obj);
   assertTrue(obj instanceof GenericPortlet);
   assertTrue(obj instanceof Portlet);
   assertTrue(obj instanceof HeaderPortlet);
   assertTrue(obj instanceof EventPortlet);
   assertTrue(obj instanceof ResourceServingPortlet);

   Set<Bean<?>> beans2 = bm.getBeans(TestPortlet1AppScoped.class);
   Bean<?> bean2 = bm.resolve(beans2);
   assertNotNull(bean2);

   CreationalContext<?> coco2 = bm.createCreationalContext(bean2);
   assertNotNull(coco2);

   Object obj2 = bm.getReference(bean2, TestPortlet1AppScoped.class, coco2);
   assertNotNull(obj2);
   assertTrue(obj.equals(obj2));
   assertTrue(obj == obj2);

   assertEquals(bean1, bean2);
   assertNotEquals(coco1, coco2);
}
项目:portals-pluto    文件:FilterChainImpl.java   
public void processFilter(ResourceRequest req, ResourceResponse res, ResourceServingPortlet resourceServingPortlet,
      PortletContext portletContext) throws IOException, PortletException {
   this.resourceServingPortlet = resourceServingPortlet;
   this.loader = Thread.currentThread().getContextClassLoader();
   this.portletContext = portletContext;
   doFilter(req, res);
}
项目:portals-pluto    文件:FilterManagerImpl.java   
/**
 * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.ResourceRequest, javax.portlet.ResourceResponse, javax.portlet.ResourceServingPortlet, javax.portlet.PortletContext)
 */
@Override
public void processFilter(ResourceRequest req, ResourceResponse res, ResourceServingPortlet resourceServingPortlet,PortletContext portletContext)throws PortletException, IOException{
    filterchain.reset();     // for async processing
    filterchain.processFilter(req, res, resourceServingPortlet, portletContext);
}
项目:portals-pluto    文件:FilterManager.java   
void processFilter(ResourceRequest req, ResourceResponse res, ResourceServingPortlet resourceServingPortlet, PortletContext portletContext)throws PortletException, IOException;