public class EmbeddedServerPortFileWriter extends Object implements ApplicationListener<EmbeddedServletContainerInitializedEvent>
ApplicationListener
that saves embedded server port and management port into
file. This application listener will be triggered whenever the servlet container
starts, and the file name can be overridden at runtime with a System property or
environment variable named "PORTFILE" or "portfile".Constructor and Description |
---|
EmbeddedServerPortFileWriter()
Create a new
ApplicationPidFileWriter instance using the filename
'application.pid'. |
EmbeddedServerPortFileWriter(File file)
Create a new
ApplicationPidFileWriter instance with a specified file. |
EmbeddedServerPortFileWriter(String filename)
Create a new
ApplicationPidFileWriter instance with a specified filename. |
Modifier and Type | Method and Description |
---|---|
protected File |
getPortFile(EmbeddedWebApplicationContext applicationContext)
Return the actual port file that should be written for the given application
context.
|
void |
onApplicationEvent(EmbeddedServletContainerInitializedEvent event) |
public EmbeddedServerPortFileWriter()
ApplicationPidFileWriter
instance using the filename
'application.pid'.public EmbeddedServerPortFileWriter(String filename)
ApplicationPidFileWriter
instance with a specified filename.filename
- the name of file containing pidpublic EmbeddedServerPortFileWriter(File file)
ApplicationPidFileWriter
instance with a specified file.file
- the file containing pidpublic void onApplicationEvent(EmbeddedServletContainerInitializedEvent event)
onApplicationEvent
in interface ApplicationListener<EmbeddedServletContainerInitializedEvent>
protected File getPortFile(EmbeddedWebApplicationContext applicationContext)
applicationContext
- the source application contextCopyright © 2014 Pivotal Software, Inc.. All rights reserved.