use of java.util.Enumeration in project gitblit by gitblit.
the class GitServlet method init.
@Override
public void init(final ServletConfig config) throws ServletException {
gitFilter.init(new FilterConfig() {
@Override
public String getFilterName() {
return gitFilter.getClass().getName();
}
@Override
public String getInitParameter(String name) {
return config.getInitParameter(name);
}
@Override
public Enumeration<String> getInitParameterNames() {
return config.getInitParameterNames();
}
@Override
public ServletContext getServletContext() {
return config.getServletContext();
}
});
init();
}
use of java.util.Enumeration in project gocd by gocd.
the class PluginController method addRequestHeaders.
private void addRequestHeaders(HttpServletRequest request, DefaultGoPluginApiRequest apiRequest) {
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String header = (String) headerNames.nextElement();
String value = request.getHeader(header);
apiRequest.addRequestHeader(header, value);
}
}
use of java.util.Enumeration in project camel by apache.
the class RestSwaggerServlet method init.
@Override
public void init(final ServletConfig config) throws ServletException {
super.init(config);
Map<String, Object> parameters = new HashMap<String, Object>();
Enumeration en = config.getInitParameterNames();
while (en.hasMoreElements()) {
String name = (String) en.nextElement();
Object value = config.getInitParameter(name);
parameters.put(name, value);
}
// when using servlet then use the cors filter to enable cors
if (parameters.get("cors") != null) {
LOG.warn("Use RestSwaggerCorsFilter when uisng this Servlet to enable CORS");
parameters.remove("cors");
}
support.initSwagger(swaggerConfig, parameters);
// allow to configure these options from the servlet config as well
Object pattern = parameters.remove("apiContextIdPattern");
if (pattern != null) {
apiContextIdPattern = pattern.toString();
}
Object listing = parameters.remove("apiContextIdListing");
if (listing != null) {
apiContextIdListing = Boolean.valueOf(listing.toString());
}
}
use of java.util.Enumeration in project jaggery by wso2.
the class JaggeryAppListener method isJaggeryApp.
/**
* check whether webapp is jaggery app or not
*
* @param context Context of the jaggery app
* @return boolean
*/
private boolean isJaggeryApp(Context context) {
Path appBase = getAppBase(context);
String path;
if (context.getDocBase().contains(WAR_EXTENSION)) {
try {
if (!appBase.endsWith("/")) {
path = appBase + File.separator + context.getDocBase();
} else {
path = appBase + context.getDocBase();
}
ZipFile zip = new ZipFile(path);
for (Enumeration e = zip.entries(); e.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry) e.nextElement();
if (entry.getName().toLowerCase().contains(JAGGERY_CONF)) {
return true;
}
}
} catch (IOException e) {
log.error("Error in processing the zip file", e);
}
} else {
Path filepath = Paths.get(appBase + context.getPath() + File.separator + JAGGERY_CONF);
return Files.exists(filepath);
}
return false;
}
use of java.util.Enumeration in project XobotOS by xamarin.
the class LogFactory method getResources.
/**
* Given a filename, return an enumeration of URLs pointing to
* all the occurrences of that filename in the classpath.
* <p>
* This is just like ClassLoader.getResources except that the
* operation is done under an AccessController so that this method will
* succeed when this jarfile is privileged but the caller is not.
* This method must therefore remain private to avoid security issues.
* <p>
* If no instances are found, an Enumeration is returned whose
* hasMoreElements method returns false (ie an "empty" enumeration).
* If resources could not be listed for some reason, null is returned.
*/
private static Enumeration getResources(final ClassLoader loader, final String name) {
PrivilegedAction action = new PrivilegedAction() {
public Object run() {
try {
if (loader != null) {
return loader.getResources(name);
} else {
return ClassLoader.getSystemResources(name);
}
} catch (IOException e) {
if (isDiagnosticsEnabled()) {
logDiagnostic("Exception while trying to find configuration file " + name + ":" + e.getMessage());
}
return null;
} catch (NoSuchMethodError e) {
// this case.
return null;
}
}
};
Object result = AccessController.doPrivileged(action);
return (Enumeration) result;
}
Aggregations