use of org.apache.catalina.Container in project Payara by payara.
the class WebContainer method updateJvmRoute.
public void updateJvmRoute(HttpService httpService, String jvmOption) {
String jvmRoute = null;
if (jvmOption.contains("{") && jvmOption.contains("}")) {
// Look up system-property
jvmOption = jvmOption.substring(jvmOption.indexOf("{") + 1, jvmOption.indexOf("}"));
jvmRoute = server.getSystemPropertyValue(jvmOption);
if (jvmRoute == null) {
// Try to get it from System property if it exists
jvmRoute = System.getProperty(jvmOption);
}
} else if (jvmOption.contains("=")) {
jvmRoute = jvmOption.substring(jvmOption.indexOf("=") + 1);
}
engine.setJvmRoute(jvmRoute);
for (com.sun.enterprise.config.serverbeans.VirtualServer vsBean : httpService.getVirtualServer()) {
VirtualServer vs = (VirtualServer) engine.findChild(vsBean.getId());
for (Container context : vs.findChildren()) {
if (context instanceof StandardContext) {
((StandardContext) context).setJvmRoute(jvmRoute);
}
}
}
for (Connector connector : _embedded.getConnectors()) {
connector.setJvmRoute(jvmRoute);
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, LogFacade.JVM_ROUTE_UPDATED, jvmRoute);
}
}
use of org.apache.catalina.Container in project Payara by payara.
the class LoggerBase method setContainer.
/**
* Set the Container with which this Logger has been associated.
*
* @param container The associated Container
*/
public void setContainer(Container container) {
Container oldContainer = this.container;
this.container = container;
support.firePropertyChange("container", oldContainer, this.container);
}
use of org.apache.catalina.Container in project Payara by payara.
the class LoggerBase method setContainer.
/**
* Set the Container with which this Logger has been associated.
*
* @param container The associated Container
*/
public void setContainer(Container container) {
Container oldContainer = this.container;
this.container = container;
support.firePropertyChange("container", oldContainer, this.container);
}
use of org.apache.catalina.Container in project Payara by payara.
the class FileStore method save.
/**
* Save the specified Session into this Store. Any previously saved
* information for the associated session identifier is replaced.
*
* @param session Session to be saved
*
* @exception IOException if an input/output error occurs
*/
public void save(Session session) throws IOException {
// Open an output stream to the specified pathname, if any
File file = file(session.getIdInternal());
if (file == null) {
return;
}
if (debug >= 1) {
String msg = MessageFormat.format(rb.getString(LogFacade.SAVING_SESSION_TO_FILE), new Object[] { session.getIdInternal(), file.getAbsolutePath() });
log(msg);
}
ObjectOutputStream oos = null;
try (FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
BufferedOutputStream bos = new BufferedOutputStream(fos)) {
Container container = manager.getContainer();
if (container != null) {
oos = ((StandardContext) container).createObjectOutputStream(bos);
} else {
oos = new ObjectOutputStream(bos);
}
oos.writeObject(session);
} catch (IOException e) {
throw e;
} finally {
if (oos != null) {
try {
oos.close();
} catch (IOException ioe) {
// ignore
}
}
}
}
use of org.apache.catalina.Container in project Payara by payara.
the class FileStore method load.
/**
* Load and return the Session associated with the specified session
* identifier from this Store, without removing it. If there is no
* such stored Session, return <code>null</code>.
*
* @param id Session identifier of the session to load
*
* @exception ClassNotFoundException if a deserialization error occurs
* @exception IOException if an input/output error occurs
*/
public Session load(String id) throws ClassNotFoundException, IOException {
// HERCULES:addition
// Check to see if it's in our cache first
Session sess = sessions.get(id);
if (sess != null) {
return sess;
}
// HERCULES:addition
// Open an input stream to the specified pathname, if any
File file = file(id);
if (file == null) {
return (null);
}
if (!file.exists()) {
return (null);
}
if (debug >= 1) {
String msg = MessageFormat.format(rb.getString(LogFacade.LOADING_SESSION_FROM_FILE), new Object[] { id, file.getAbsolutePath() });
log(msg);
}
FileInputStream fis = null;
BufferedInputStream bis = null;
ObjectInputStream ois = null;
Loader loader = null;
ClassLoader classLoader = null;
try {
fis = new FileInputStream(file.getAbsolutePath());
bis = new BufferedInputStream(fis);
Container container = manager.getContainer();
if (container != null) {
ois = ((StandardContext) container).createObjectInputStream(bis);
} else {
ois = new ObjectInputStream(bis);
}
// end HERCULES:mod
} catch (FileNotFoundException e) {
if (debug >= 1)
log("No persisted data file found");
return (null);
} catch (IOException e) {
if (bis != null) {
try {
bis.close();
} catch (IOException f) {
// Ignore
}
}
if (fis != null) {
try {
fis.close();
} catch (IOException f) {
// Ignore
}
}
throw e;
}
try {
StandardSession session = StandardSession.deserialize(ois, manager);
session.setManager(manager);
// HERCULES: addition
// Put it in the cache
sessions.put(session.getIdInternal(), session);
// HERCULES: addition
return (session);
} finally {
// Close the input stream
if (ois != null) {
try {
ois.close();
} catch (IOException f) {
// Ignore
}
}
}
}
Aggregations