Java 类javax.portlet.Portlet 实例源码

项目:spring4-understanding    文件:PortletWrappingController.java   
@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);
}
项目:spring4-understanding    文件:SimplePortletPostProcessor.java   
@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;
}
项目:class-guard    文件:PortletWrappingController.java   
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);
}
项目: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    文件:SimplePortletHandlerAdapter.java   
@Override
public ModelAndView handleRender(RenderRequest request, RenderResponse response, Object handler)
        throws Exception {

    ((Portlet) handler).render(request, response);
    return null;
}
项目:liferay-blade-samples    文件:ControlPanelPortlet.java   
@Override
public void init(PortletConfig portletConfig) throws PortletException {
    super.init(portletConfig);

    LiferayPortletConfig liferayPortletConfig =
        (LiferayPortletConfig)portletConfig;

    com.liferay.portal.kernel.model.Portlet portlet =
        liferayPortletConfig.getPortlet();

    PortletApp portletApp = portlet.getPortletApp();

    ServletContextPool.put(
        portletApp.getServletContextName(), portletApp.getServletContext());
}
项目:liferay-blade-samples    文件:Activator.java   
@Override
public void start(BundleContext bundleContext) throws Exception {
    Dictionary<String, Object> properties = new Hashtable<>();

    properties.put(
        "com.liferay.portlet.display-category", "category.sample");
    properties.put("com.liferay.portlet.instanceable", "true");
    properties.put("javax.portlet.display-name", "OSGi API Portlet");
    properties.put(
        "javax.portlet.security-role-ref",
        new String[] {"power-user", "user"});

    _serviceRegistration = bundleContext.registerService(
        Portlet.class, new OSGiAPIPortlet(), properties);
}
项目:liferay-blade-samples    文件:ControlPanelPortlet.java   
@Override
public void init(PortletConfig portletConfig) throws PortletException {
    super.init(portletConfig);

    LiferayPortletConfig liferayPortletConfig =
        (LiferayPortletConfig)portletConfig;

    com.liferay.portal.kernel.model.Portlet portlet =
        liferayPortletConfig.getPortlet();

    PortletApp portletApp = portlet.getPortletApp();

    ServletContextPool.put(
        portletApp.getServletContextName(), portletApp.getServletContext());
}
项目:liferay-blade-samples    文件:Activator.java   
@Override
public void start(BundleContext bundleContext) throws Exception {
    Dictionary<String, Object> properties = new Hashtable<>();

    properties.put(
        "com.liferay.portlet.display-category", "category.sample");
    properties.put("com.liferay.portlet.instanceable", "true");
    properties.put("javax.portlet.display-name", "OSGi API Portlet");
    properties.put(
        "javax.portlet.security-role-ref",
        new String[] {"power-user", "user"});

    _serviceRegistration = bundleContext.registerService(
        Portlet.class, new OSGiAPIPortlet(), properties);
}
项目:liferay-blade-samples    文件:ControlPanelPortlet.java   
@Override
public void init(PortletConfig portletConfig) throws PortletException {
    super.init(portletConfig);

    LiferayPortletConfig liferayPortletConfig =
        (LiferayPortletConfig)portletConfig;

    com.liferay.portal.kernel.model.Portlet portlet =
        liferayPortletConfig.getPortlet();

    PortletApp portletApp = portlet.getPortletApp();

    ServletContextPool.put(
        portletApp.getServletContextName(), portletApp.getServletContext());
}
项目:liferay-blade-samples    文件:Activator.java   
@Override
public void start(BundleContext bundleContext) throws Exception {
    Dictionary<String, Object> properties = new Hashtable<>();

    properties.put(
        "com.liferay.portlet.display-category", "category.sample");
    properties.put("com.liferay.portlet.instanceable", "true");
    properties.put("javax.portlet.display-name", "OSGi API Portlet");
    properties.put(
        "javax.portlet.security-role-ref",
        new String[] {"power-user", "user"});

    _serviceRegistration = bundleContext.registerService(
        Portlet.class, new OSGiAPIPortlet(), properties);
}
项目:class-guard    文件:SimplePortletPostProcessor.java   
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;
}
项目:vertx-maven-service-factory    文件:MyVerticle.java   
@Override
public void start() throws Exception {
  if (Vertx.currentContext().config().getBoolean("loaded_globally")) {
    if (Portlet.class.getClassLoader() == MyVerticle.class.getClassLoader()) {
      throw new Exception("System dependency not loaded by the correct loader");
    }
  } else {
    if (Portlet.class.getClassLoader() != MyVerticle.class.getClassLoader()) {
      throw new Exception("System dependency not loaded by the correct loader");
    }
  }
}
项目: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(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);
}
项目:portals-pluto    文件:FilterChainImpl.java   
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);
}
项目:GridSphere    文件:PortletsSetupModuleServiceImpl.java   
public void invokePostInit(HttpServletRequest request) throws IllegalArgumentException, IllegalStateException {
    PortletsSetupModule portletsSetupModule = getProcessedPortletsSetupModule();
    Portlet portlet = getPortletForModule(portletsSetupModule);
    try {
        portletsSetupModule.invokePostInit(request, portlet);
    } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException(portletsSetupModule.getModuleError(e.getMessage(),request.getLocale()));
    }
    if(portletsSetupModule.isPostInitPhaseProcessed() && postInitPortletsSetupModules.isEmpty()){
        setPostInitSetupDone();
    }
}
项目:GridSphere    文件:PortletsSetupModuleServiceImpl.java   
private Portlet getPortletForModule(PortletsSetupModule portletsSetupModule){
    Portlet portlet = null;
    String contextName = portletsSetupModule.getContextName();
    String portletName = portletsSetupModule.getPortletName();
    if(null != portletName && !"".equals(portletName))
        portlet = portlets.get(contextName).get(portletName);
    return portlet;
}
项目:spring4-understanding    文件:SimplePortletHandlerAdapter.java   
@Override
public boolean supports(Object handler) {
    return (handler instanceof Portlet);
}
项目:spring4-understanding    文件:SimplePortletHandlerAdapter.java   
@Override
public void handleAction(ActionRequest request, ActionResponse response, Object handler)
        throws Exception {

    ((Portlet) handler).processAction(request, response);
}
项目:spring4-understanding    文件:SimplePortletPostProcessor.java   
@Override
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
    if (bean instanceof Portlet) {
        ((Portlet) bean).destroy();
    }
}
项目:class-guard    文件:SimplePortletHandlerAdapter.java   
public boolean supports(Object handler) {
    return (handler instanceof Portlet);
}
项目:class-guard    文件:SimplePortletHandlerAdapter.java   
public void handleAction(ActionRequest request, ActionResponse response, Object handler)
        throws Exception {

    ((Portlet) handler).processAction(request, response);
}
项目:class-guard    文件:SimplePortletHandlerAdapter.java   
public ModelAndView handleRender(RenderRequest request, RenderResponse response, Object handler)
        throws Exception {

    ((Portlet) handler).render(request, response);
    return null;
}
项目:class-guard    文件:SimplePortletPostProcessor.java   
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
    if (bean instanceof Portlet) {
        ((Portlet) bean).destroy();
    }
}
项目:portals-pluto    文件:FilterManagerImpl.java   
/**
 * @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);
}
项目:portals-pluto    文件:FilterManagerImpl.java   
/**
 * @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);
}
项目:GridSphere    文件:ApplicationPortletImpl.java   
public Portlet getPortletInstance() {
    return portletInstance;
}
项目:GridSphere    文件:BasePortletsSetupModule.java   
public void invokePostInit(HttpServletRequest request, Portlet portlet) throws IllegalArgumentException {
    if(moduleDef.getPostInitModule())
        throw new IllegalArgumentException("Not implemented !!!");
    throw new IllegalArgumentException("Not supported");
}
项目:portals-pluto    文件:FilterManager.java   
void processFilter(ActionRequest req, ActionResponse res, Portlet portlet, PortletContext portletContext) throws PortletException, IOException;
项目:portals-pluto    文件:FilterManager.java   
void processFilter(RenderRequest req, RenderResponse res, Portlet portlet, PortletContext portletContext) throws PortletException, IOException;
项目:GridSphere    文件:ApplicationPortlet.java   
public Portlet getPortletInstance();
项目:GridSphere    文件:PortletsSetupModule.java   
public void invokePostInit(HttpServletRequest request, Portlet portlet) throws IllegalArgumentException;
项目:GridSphere    文件:PortletsSetupModuleService.java   
public void loadPortletsSetupModules(String setupModsPath, PortletWebApplication portletWebApplication, Map<String, Portlet> portlets, ClassLoader classloader);