本文整理汇总了Java中javax.portlet.Portlet类的典型用法代码示例。如果您正苦于以下问题:Java Portlet类的具体用法?Java Portlet怎么用?Java Portlet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Portlet类属于javax.portlet包,在下文中一共展示了Portlet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import javax.portlet.Portlet; //导入依赖的package包/类
@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);
}
示例2: postProcessAfterInitialization
import javax.portlet.Portlet; //导入依赖的package包/类
@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;
}
示例3: afterPropertiesSet
import javax.portlet.Portlet; //导入依赖的package包/类
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);
}
示例4: beanMgrTest
import javax.portlet.Portlet; //导入依赖的package包/类
@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);
}
示例5: appScopedTest
import javax.portlet.Portlet; //导入依赖的package包/类
@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);
}
示例6: handleRender
import javax.portlet.Portlet; //导入依赖的package包/类
@Override
public ModelAndView handleRender(RenderRequest request, RenderResponse response, Object handler)
throws Exception {
((Portlet) handler).render(request, response);
return null;
}
示例7: init
import javax.portlet.Portlet; //导入依赖的package包/类
@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());
}
示例8: start
import javax.portlet.Portlet; //导入依赖的package包/类
@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);
}
示例9: postProcessAfterInitialization
import javax.portlet.Portlet; //导入依赖的package包/类
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;
}
示例10: start
import javax.portlet.Portlet; //导入依赖的package包/类
@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");
}
}
}
示例11: appScopedTest2Coco
import javax.portlet.Portlet; //导入依赖的package包/类
@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);
}
示例12: appScopedTest2Coco2Bean
import javax.portlet.Portlet; //导入依赖的package包/类
@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);
}
示例13: processFilter
import javax.portlet.Portlet; //导入依赖的package包/类
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);
}
示例14: invokePostInit
import javax.portlet.Portlet; //导入依赖的package包/类
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();
}
}
示例15: getPortletForModule
import javax.portlet.Portlet; //导入依赖的package包/类
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;
}