use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class BaseHASession method sync.
public void sync() {
HttpSessionBindingEvent event = null;
event = new HttpSessionBindingEvent((HttpSession) this, null, null);
// Notify special event listeners on sync()
Manager manager = this.getManager();
StandardContext stdContext = (StandardContext) manager.getContainer();
// fire container event
stdContext.fireContainerEvent("sessionSync", event);
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class LoggerBase method createObjectName.
public ObjectName createObjectName() {
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "createObjectName with {0}", container);
}
// register
try {
StandardEngine engine = null;
String suffix = "";
if (container instanceof StandardEngine) {
engine = (StandardEngine) container;
} else if (container instanceof StandardHost) {
engine = (StandardEngine) container.getParent();
suffix = ",host=" + container.getName();
} else if (container instanceof StandardContext) {
String path = ((StandardContext) container).getPath();
// add "/" to avoid MalformedObjectName Exception
if (path.equals("")) {
path = "/";
}
engine = (StandardEngine) container.getParent().getParent();
suffix = ",path=" + path + ",host=" + container.getParent().getName();
} else {
log.log(Level.SEVERE, LogFacade.UNKNOWN_CONTAINER_EXCEPTION);
}
if (engine != null) {
oname = new ObjectName(engine.getDomain() + ":type=Logger" + suffix);
} else {
log.log(Level.SEVERE, LogFacade.NULL_ENGINE_EXCEPTION, container);
}
} catch (Throwable e) {
log.log(Level.WARNING, LogFacade.UNABLE_CREATE_OBJECT_NAME_FOR_LOGGER_EXCEPTION, e);
}
return oname;
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class ManagerBase method init.
public void init() {
if (initialized)
return;
initialized = true;
if (oname == null) {
try {
StandardContext ctx = (StandardContext) this.getContainer();
domain = ctx.getEngineName();
distributable = ctx.getDistributable();
StandardHost hst = (StandardHost) ctx.getParent();
String path = ctx.getEncodedPath();
if (path.equals("")) {
path = "/";
}
oname = new ObjectName(domain + ":type=Manager,path=" + path + ",host=" + hst.getName());
} catch (Exception e) {
log.log(Level.SEVERE, LogFacade.ERROR_REGISTERING_EXCEPTION_SEVERE, e);
}
}
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Registering {0}", oname);
}
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class HASessionStoreValve method invoke.
/**
* invoke call-back; nothing to do on the way in
* @param request
* @param response
*/
public int invoke(org.apache.catalina.Request request, org.apache.catalina.Response response) throws java.io.IOException, javax.servlet.ServletException {
// FIXME this is for 7.0PE style valves
// left here if the same optimization is done to the valve architecture
String sessionId = null;
ReplicationWebEventPersistentManager manager;
StandardContext context;
HttpServletRequest httpServletrequest = (HttpServletRequest) request.getRequest();
HttpSession session = httpServletrequest.getSession(false);
if (session != null) {
sessionId = session.getId();
if (sessionId != null) {
context = (StandardContext) request.getContext();
manager = (ReplicationWebEventPersistentManager) context.getManager();
String oldJreplicaValue = null;
Cookie[] cookies = httpServletrequest.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equalsIgnoreCase(Globals.JREPLICA_COOKIE_NAME)) {
oldJreplicaValue = cookie.getValue();
}
}
String replica = manager.getReplicaFromPredictor(sessionId, oldJreplicaValue);
if (replica != null) {
Session sess = request.getSessionInternal(false);
if (sess != null) {
sess.setNote(Globals.JREPLICA_SESSION_NOTE, replica);
}
}
}
}
}
return INVOKE_NEXT;
// return 0;
}
use of org.apache.catalina.core.StandardContext in project Payara by payara.
the class HASessionStoreValve method doPostInvoke.
/**
* A post-request processing implementation that does the valveSave.
* @param request
* @param response
*/
private void doPostInvoke(Request request, Response response) throws IOException, ServletException {
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("IN HASessionStoreValve>>postInvoke()");
}
String sessionId = null;
Session session;
StandardContext context;
Manager manager;
HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
HttpSession hsess = hreq.getSession(false);
if (hsess != null) {
sessionId = hsess.getId();
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("IN HASessionStoreValve:postInvoke:sessionId=" + sessionId);
}
}
if (sessionId != null) {
context = (StandardContext) request.getContext();
manager = context.getManager();
session = manager.findSession(sessionId);
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("IN HASessionStoreValve:postInvoke:session=" + session);
}
if (session != null) {
WebEventPersistentManager pMgr = (WebEventPersistentManager) manager;
pMgr.doValveSave(session);
}
}
HACookieManager.reset();
}
Aggregations