JETTY-1295 Contexts mixed up when hot-deploying on virtual hosts

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2427 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Jan Bartel 2010-10-28 03:18:21 +00:00
parent cf7f8b27f8
commit 9d901da82e
4 changed files with 37 additions and 19 deletions

View File

@ -1,4 +1,5 @@
+ JETTY-1295 Contexts mixed up when hot-deploying on virtual hosts
+ 328199 Ensure blocking connectors always close socket + 328199 Ensure blocking connectors always close socket
+ 328205 Improved SelectManager stopping + 328205 Improved SelectManager stopping
+ 328306 Serialization of FormAuthentication + 328306 Serialization of FormAuthentication
@ -9,6 +10,7 @@
+ 328782 allow per connection max idle time to be set + 328782 allow per connection max idle time to be set
+ 328885 web overrides do not override + 328885 web overrides do not override
jetty-7.2.0.v20101020 20 October 2010 jetty-7.2.0.v20101020 20 October 2010
+ 289540 added javadoc into distribution + 289540 added javadoc into distribution
+ 297154 add source distribution artifact + 297154 add source distribution artifact

View File

@ -36,7 +36,7 @@ public class App
* the origin ID (The ID that the {@link AppProvider} knows * the origin ID (The ID that the {@link AppProvider} knows
* about) * about)
* @see App#getOriginId() * @see App#getOriginId()
* @see App#getContextId() * @see App#getContextPath()
*/ */
public App(DeploymentManager manager, AppProvider provider, String originId) public App(DeploymentManager manager, AppProvider provider, String originId)
{ {
@ -52,7 +52,7 @@ public class App
* the origin ID (The ID that the {@link AppProvider} knows * the origin ID (The ID that the {@link AppProvider} knows
* about) * about)
* @see App#getOriginId() * @see App#getOriginId()
* @see App#getContextId() * @see App#getContextPath()
* @param context * @param context
* Some implementations of AppProvider might have to use an * Some implementations of AppProvider might have to use an
* already created ContextHandler. * already created ContextHandler.
@ -109,13 +109,31 @@ public class App
return _context; return _context;
} }
/** /**
* The unique id of the {@link App} relating to how it is installed on the * The context path {@link App} relating to how it is installed on the
* jetty server side. * jetty server side.
* *
* @return the generated Id for the App. * NOTE that although the method name indicates that this is a unique
* identifier, it is not, as many contexts may have the same contextPath,
* yet different virtual hosts.
*
* @deprecated Use getContextPath instead.
* @return the context path for the App
*/ */
public String getContextId() public String getContextId()
{
return getContextPath();
}
/**
* The context path {@link App} relating to how it is installed on the
* jetty server side.
*
* @return the contextPath for the App
*/
public String getContextPath()
{ {
if (this._context == null) if (this._context == null)
{ {
@ -124,6 +142,7 @@ public class App
return this._context.getContextPath(); return this._context.getContextPath();
} }
/** /**
* The origin of this {@link App} as specified by the {@link AppProvider} * The origin of this {@link App} as specified by the {@link AppProvider}
* *

View File

@ -232,6 +232,7 @@ public class DeploymentManager extends AbstractLifeCycle
super.doStop(); super.doStop();
} }
/*
private AppEntry findAppByContextId(String contextId) private AppEntry findAppByContextId(String contextId)
{ {
if (contextId == null) if (contextId == null)
@ -248,6 +249,7 @@ public class DeploymentManager extends AbstractLifeCycle
} }
return null; return null;
} }
*/
private AppEntry findAppByOriginId(String originId) private AppEntry findAppByOriginId(String originId)
{ {
@ -266,6 +268,7 @@ public class DeploymentManager extends AbstractLifeCycle
return null; return null;
} }
/*
public App getAppByContextId(String contextId) public App getAppByContextId(String contextId)
{ {
AppEntry entry = findAppByContextId(contextId); AppEntry entry = findAppByContextId(contextId);
@ -275,7 +278,8 @@ public class DeploymentManager extends AbstractLifeCycle
} }
return entry.app; return entry.app;
} }
*/
public App getAppByOriginId(String originId) public App getAppByOriginId(String originId)
{ {
AppEntry entry = findAppByOriginId(originId); AppEntry entry = findAppByOriginId(originId);
@ -329,7 +333,7 @@ public class DeploymentManager extends AbstractLifeCycle
return ret; return ret;
} }
String contextId = app.getContextId(); String contextId = app.getContextPath();
if (contextId == null) if (contextId == null)
{ {
// No context? Likely not deployed or started yet. // No context? Likely not deployed or started yet.
@ -345,7 +349,7 @@ public class DeploymentManager extends AbstractLifeCycle
continue; continue;
} }
if (contextId.equals(entry.app.getContextId())) if (contextId.equals(entry.app.getContextPath()))
{ {
ret.add(entry.app); ret.add(entry.app);
} }
@ -449,15 +453,12 @@ public class DeploymentManager extends AbstractLifeCycle
*/ */
public void requestAppGoal(App app, String nodeName) public void requestAppGoal(App app, String nodeName)
{ {
AppEntry appentry = findAppByContextId(app.getContextId()); AppEntry appentry = findAppByOriginId(app.getOriginId());
if (appentry == null)
{
appentry = findAppByOriginId(app.getOriginId());
if (appentry == null) if (appentry == null)
{ {
throw new IllegalStateException("App not being tracked by Deployment Manager: " + app); throw new IllegalStateException("App not being tracked by Deployment Manager: " + app);
} }
}
requestAppGoal(appentry,nodeName); requestAppGoal(appentry,nodeName);
} }
@ -516,14 +517,10 @@ public class DeploymentManager extends AbstractLifeCycle
*/ */
public void requestAppGoal(String appId, String nodeName) public void requestAppGoal(String appId, String nodeName)
{ {
AppEntry appentry = findAppByContextId(appId); AppEntry appentry = findAppByOriginId(appId);
if (appentry == null) if (appentry == null)
{ {
appentry = findAppByOriginId(appId); throw new IllegalStateException("App not being tracked by Deployment Manager: " + appId);
if (appentry == null)
{
throw new IllegalStateException("App not being tracked by Deployment Manager: " + appId);
}
} }
requestAppGoal(appentry,nodeName); requestAppGoal(appentry,nodeName);
} }

View File

@ -120,7 +120,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
public ContextHandler createContextHandler(App app) throws Exception public ContextHandler createContextHandler(App app) throws Exception
{ {
// return pre-created Context // return pre-created Context
if (app.getContextId() != null) if (app.getContextHandler() != null)
{ {
return app.getContextHandler(); return app.getContextHandler();
} }