Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERXConfigurationManager isDeployedAsServlet relies now on the configu… #956

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.slf4j.LoggerFactory;

import com.webobjects.appserver.WOApplication;
import com.webobjects.appserver._private.WOProperties;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSBundle;
import com.webobjects.foundation.NSDictionary;
Expand Down Expand Up @@ -391,16 +392,31 @@ public String hostName() {
}

/**
* Checks if the application <del>is</del> may be deployed as a servlet.
* <p>
* The current implementation only checks if the application
* is linked against <code>JavaWOJSPServlet.framework</code>.
* Checks if the application is be deployed as a servlet.
*
* This heuristic to determine if an application is deployed as servlet relays on the fact,
* that contextClassName() is set WOServletContext or ERXWOServletContext
*
* @return true if the application is deployed as a servlet
*/
public boolean isDeployedAsServlet() {
NSArray frameworkNames = (NSArray)NSBundle.frameworkBundles().valueForKey("name");
return frameworkNames.containsObject("JavaWOJSPServlet");
return contextClassName()!= null && contextClassName().contains("Servlet"); // i.e one of WOServletContext or ERXWOServletContext
}


public void setContextClassName(String name) {
if (name != null) {
WOProperties.TheContextClassName = name;
}

}

public String contextClassName() {
if (WOProperties.TheContextClassName == null) {
String contextClassName = NSProperties.getProperty(WOProperties._ContextClassNameKey);
this.setContextClassName(contextClassName);
}

return WOProperties.TheContextClassName;
}

}