1 16 17 package org.springframework.web.portlet.context; 18 19 import java.io.File ; 20 21 import javax.portlet.PortletContext; 22 23 import org.springframework.context.support.ApplicationObjectSupport; 24 import org.springframework.web.portlet.util.PortletUtils; 25 26 33 public abstract class PortletApplicationObjectSupport extends ApplicationObjectSupport 34 implements PortletContextAware { 35 36 private PortletContext portletContext; 37 38 39 public void setPortletContext(PortletContext portletContext) { 40 this.portletContext = portletContext; 41 } 42 43 44 52 protected boolean isContextRequired() { 53 return true; 54 } 55 56 60 protected final PortletContext getPortletContext() throws IllegalStateException { 61 if (this.portletContext == null) { 62 throw new IllegalStateException ( 63 "PortletApplicationObjectSupport instance [" + this + "] does not run within a PortletContext"); 64 } 65 return this.portletContext; 66 } 67 68 75 protected final File getTempDir() throws IllegalStateException { 76 return PortletUtils.getTempDir(getPortletContext()); 77 } 78 79 } 80 | Popular Tags |