|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.core.io.support.PropertiesLoaderSupport
org.springframework.beans.factory.config.PropertyResourceConfigurer
org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
org.springframework.richclient.jnlp.JnlpPropertyPlaceholderConfigurer
public class JnlpPropertyPlaceholderConfigurer
Subclass of PropertyPlaceholderConfigurer that resolves the following properties as placeholders:
jnlp.webAppContextUrl
the webAppContextUrl, for example
http://domain.com/petclinic/
Can be combined with "locations" and/or "properties" values.
If a placeholder could not be resolved against the provided local properties within the application, this configurer will fall back to the JNLP properties. Can also be configured to let jnlp properties override local properties (contextOverride=true).
If not running within a JNLP context (or any other context that is able to satisfy the BasicService.lookup call), this class will use the fallBackWebAppContextUrl. This allows for keeping JnlpPropertyPlaceholderConfigurer definitions in test suites.
A typical usage would be:
<bean id="jnlpPropertyPlaceholderConfigurer" class="be.kahosl.thot.swingui.util.JnlpPropertyPlaceholderConfigurer"> <property name="fallBackWebAppContextUrl" value="http://localhost:8080/mywebapp/"/> <property name="jnlpRelativeDirectoryPathFromWebAppContext" value="/jnlp/"/> </bean>
Use this in combination with Sun's JnlpDownloadServlet to not have to hardcode your server URL: http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/downloadservletguide.html
PropertiesLoaderSupport.setLocations(org.springframework.core.io.Resource[])
,
PropertiesLoaderSupport.setProperties(java.util.Properties)
,
PropertyPlaceholderConfigurer.setSystemPropertiesModeName(java.lang.String)
,
setContextOverride(boolean)
,
BasicService.getCodeBase()
Field Summary | |
---|---|
static String |
WEB_APP_CONTEXT_URL_PLACEHOLDER
The placeholder for getWebAppContextUrl() |
Fields inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer |
---|
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, SYSTEM_PROPERTIES_MODE_FALLBACK, SYSTEM_PROPERTIES_MODE_NEVER, SYSTEM_PROPERTIES_MODE_OVERRIDE |
Fields inherited from class org.springframework.core.io.support.PropertiesLoaderSupport |
---|
logger, XML_FILE_EXTENSION |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
JnlpPropertyPlaceholderConfigurer()
|
Method Summary | |
---|---|
String |
getWebAppContextUrl()
Uses the jnlp API to determine the webapp context. |
protected String |
resolvePlaceholder(String placeholder)
Resolves the given placeholder using the jnlp properties. |
protected String |
resolvePlaceholder(String placeholder,
Properties props)
|
void |
setContextOverride(boolean contextOverride)
Set whether the JNLP properties should override local properties within the application. |
void |
setFallBackWebAppContextUrl(String fallBackWebAppContextUrl)
Set the webAppContextUrl to use when no javax.jnlp.BasicService is available. |
void |
setJnlpRelativeDirectoryPathFromWebAppContext(String jnlpRelativeDirectoryPathFromWebAppContext)
Sets the relative directory path of the JNLP file relative to the WebAppContext. |
Methods inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer |
---|
parseStringValue, processProperties, resolvePlaceholder, resolveSystemProperty, setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setSearchSystemEnvironment, setSystemPropertiesMode, setSystemPropertiesModeName |
Methods inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer |
---|
convertProperties, convertPropertyValue, getOrder, postProcessBeanFactory, setOrder |
Methods inherited from class org.springframework.core.io.support.PropertiesLoaderSupport |
---|
loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String WEB_APP_CONTEXT_URL_PLACEHOLDER
Constructor Detail |
---|
public JnlpPropertyPlaceholderConfigurer()
Method Detail |
---|
public void setContextOverride(boolean contextOverride)
Note that system properties will still override JNLP properties, if the system properties mode is set to "SYSTEM_PROPERTIES_MODE_OVERRIDE".
PropertyPlaceholderConfigurer.setSystemPropertiesModeName(java.lang.String)
,
PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE
public void setFallBackWebAppContextUrl(String fallBackWebAppContextUrl)
http://localhost:8080/
.
Ussually you 'll want to set this to http://localhost:8080/mywebapp/
.
fallBackWebAppContextUrl
- the webAppContextUrl to fall back on ending with a slashpublic void setJnlpRelativeDirectoryPathFromWebAppContext(String jnlpRelativeDirectoryPathFromWebAppContext)
/
, which means that the JNLP file is in the root of your webapp.
If your JNLP file isn't in the root of you webapp, change it.
For example for http://localhost:8080/mywebapp/dist/jnlp/myswingapp.jnlp
you would set this to /dist/jnlp/
.
jnlpRelativeDirectoryPathFromWebAppContext
- the relative directory path starting and ending with a slashprotected String resolvePlaceholder(String placeholder, Properties props)
resolvePlaceholder
in class PropertyPlaceholderConfigurer
protected String resolvePlaceholder(String placeholder)
placeholder
- the placeholder to resolve
public String getWebAppContextUrl()
fallBackWebAppContextUrl
is returned.
For example this could return http://localhost:8080/mywebapp/
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |