javax.portlet.Portlet Java Examples

The following examples show how to use javax.portlet.Portlet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PortletWrappingController.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
	if (this.portletClass == null) {
		throw new IllegalArgumentException("portletClass is required");
	}
	if (!Portlet.class.isAssignableFrom(this.portletClass)) {
		throw new IllegalArgumentException("portletClass [" + this.portletClass.getName() +
			"] needs to implement interface [javax.portlet.Portlet]");
	}
	if (this.portletName == null) {
		this.portletName = this.beanName;
	}
	PortletConfig config = this.portletConfig;
	if (config == null || !this.useSharedPortletConfig) {
		config = new DelegatingPortletConfig();
	}
	this.portletInstance = (Portlet) this.portletClass.newInstance();
	this.portletInstance.init(config);
}
 
Example #2
Source File: SimplePortletPostProcessor.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
	if (bean instanceof Portlet) {
		PortletConfig config = this.portletConfig;
		if (config == null || !this.useSharedPortletConfig) {
			config = new DelegatingPortletConfig(beanName, this.portletContext, this.portletConfig);
		}
		try {
			((Portlet) bean).init(config);
		}
		catch (PortletException ex) {
			throw new BeanInitializationException("Portlet.init threw exception", ex);
		}
	}
	return bean;
}
 
Example #3
Source File: CDIPrototyping.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #4
Source File: CDIPrototyping.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #5
Source File: SimplePortletHandlerAdapter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public ModelAndView handleRender(RenderRequest request, RenderResponse response, Object handler)
		throws Exception {

	((Portlet) handler).render(request, response);
	return null;
}
 
Example #6
Source File: CDIPrototyping.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #7
Source File: CDIPrototyping.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #8
Source File: FilterChainImpl.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
public void processFilter(ActionRequest req, ActionResponse res, Portlet portlet, PortletContext portletContext)
      throws IOException, PortletException {
   this.portlet = portlet;
   this.loader = Thread.currentThread().getContextClassLoader();
   this.portletContext = portletContext;
   doFilter(req, res);
}
 
Example #9
Source File: FilterChainImpl.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
public void processFilter(RenderRequest req, RenderResponse res, Portlet portlet, PortletContext portletContext)
      throws IOException, PortletException {
   this.portlet = portlet;
   this.loader = Thread.currentThread().getContextClassLoader();
   this.portletContext = portletContext;
   doFilter(req, res);
}
 
Example #10
Source File: SimplePortletHandlerAdapter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public boolean supports(Object handler) {
	return (handler instanceof Portlet);
}
 
Example #11
Source File: SimplePortletHandlerAdapter.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void handleAction(ActionRequest request, ActionResponse response, Object handler)
		throws Exception {

	((Portlet) handler).processAction(request, response);
}
 
Example #12
Source File: SimplePortletPostProcessor.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
	if (bean instanceof Portlet) {
		((Portlet) bean).destroy();
	}
}
 
Example #13
Source File: FilterManagerImpl.java    From portals-pluto with Apache License 2.0 4 votes vote down vote up
/**
 * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.RenderRequest, javax.portlet.RenderResponse, javax.portlet.Portlet, javax.portlet.PortletContext)
 */
@Override
public void processFilter(RenderRequest req, RenderResponse res, Portlet portlet,PortletContext portletContext) throws PortletException, IOException{
    filterchain.processFilter(req, res, portlet, portletContext);
}
 
Example #14
Source File: FilterManagerImpl.java    From portals-pluto with Apache License 2.0 4 votes vote down vote up
/**
 * @see org.apache.pluto.container.FilterManager#processFilter(javax.portlet.ActionRequest, javax.portlet.ActionResponse, javax.portlet.Portlet, javax.portlet.PortletContext)
 */
@Override
public void processFilter(ActionRequest req, ActionResponse res, Portlet portlet,PortletContext portletContext) throws PortletException, IOException{
    filterchain.processFilter(req, res, portlet, portletContext);
}
 
Example #15
Source File: FilterManager.java    From portals-pluto with Apache License 2.0 votes vote down vote up
void processFilter(ActionRequest req, ActionResponse res, Portlet portlet, PortletContext portletContext) throws PortletException, IOException; 
Example #16
Source File: FilterManager.java    From portals-pluto with Apache License 2.0 votes vote down vote up
void processFilter(RenderRequest req, RenderResponse res, Portlet portlet, PortletContext portletContext) throws PortletException, IOException;