IDEMPIERE-455 Discover and fix FindBugs problems / Eclipse warning.
This commit is contained in:
parent
944542b2d5
commit
f5b53b5678
|
@ -1,8 +0,0 @@
|
|||
#Wed Jun 01 10:21:31 MYT 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
|
||||
org.eclipse.jdt.core.compiler.compliance=1.3
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.3
|
|
@ -24,7 +24,7 @@ public interface ExtendedHttpService extends HttpService {
|
|||
* @throws java.lang.IllegalArgumentException if any of the arguments are
|
||||
* invalid
|
||||
*/
|
||||
public void registerFilter(String alias, Filter filter, Dictionary initparams, HttpContext context) throws ServletException, NamespaceException;
|
||||
public void registerFilter(String alias, Filter filter, Dictionary<String, String> initparams, HttpContext context) throws ServletException, NamespaceException;
|
||||
|
||||
/**
|
||||
* Unregisters a previous filter registration done by the
|
||||
|
|
|
@ -25,7 +25,7 @@ public class Activator implements BundleActivator {
|
|||
private static final String[] HTTP_SERVICES_CLASSES = new String[] {HttpService.class.getName(), ExtendedHttpService.class.getName()};
|
||||
|
||||
private static BundleContext context;
|
||||
private static Map serviceRegistrations = new HashMap();
|
||||
private static Map<Object, ServiceRegistration<?>> serviceRegistrations = new HashMap<Object, ServiceRegistration<?>>();
|
||||
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
startHttpServiceProxy(bundleContext);
|
||||
|
@ -39,7 +39,7 @@ public class Activator implements BundleActivator {
|
|||
context = bundleContext;
|
||||
Object[] proxyServlets = serviceRegistrations.keySet().toArray();
|
||||
for (int i = 0; i < proxyServlets.length; ++i) {
|
||||
ServiceRegistration registration = registerHttpService((ProxyServlet) proxyServlets[i]);
|
||||
ServiceRegistration<?> registration = registerHttpService((ProxyServlet) proxyServlets[i]);
|
||||
serviceRegistrations.put(proxyServlets[i], registration);
|
||||
}
|
||||
}
|
||||
|
@ -47,25 +47,25 @@ public class Activator implements BundleActivator {
|
|||
private static synchronized void stopHttpServiceProxy(BundleContext bundleContext) {
|
||||
Object[] proxyServlets = serviceRegistrations.keySet().toArray();
|
||||
for (int i = 0; i < proxyServlets.length; ++i) {
|
||||
ServiceRegistration registration = (ServiceRegistration) serviceRegistrations.put(proxyServlets[i], null);
|
||||
ServiceRegistration<?> registration = serviceRegistrations.put(proxyServlets[i], null);
|
||||
registration.unregister();
|
||||
}
|
||||
context = null;
|
||||
}
|
||||
|
||||
static synchronized void addProxyServlet(ProxyServlet proxyServlet) {
|
||||
ServiceRegistration registration = null;
|
||||
ServiceRegistration<?> registration = null;
|
||||
if (context != null)
|
||||
registration = registerHttpService(proxyServlet);
|
||||
|
||||
serviceRegistrations.put(proxyServlet, registration);
|
||||
}
|
||||
|
||||
private static ServiceRegistration registerHttpService(ProxyServlet proxyServlet) {
|
||||
private static ServiceRegistration<?> registerHttpService(ProxyServlet proxyServlet) {
|
||||
HttpServiceFactory factory = new HttpServiceFactory(proxyServlet);
|
||||
Dictionary serviceProperties = new Hashtable(2);
|
||||
Dictionary<String, String> serviceProperties = new Hashtable<String, String>(2);
|
||||
ServletConfig config = proxyServlet.getServletConfig();
|
||||
Enumeration initparameterNames = config.getInitParameterNames();
|
||||
Enumeration<String> initparameterNames = config.getInitParameterNames();
|
||||
while (initparameterNames.hasMoreElements()) {
|
||||
String name = (String) initparameterNames.nextElement();
|
||||
serviceProperties.put(name, config.getInitParameter(name));
|
||||
|
@ -81,7 +81,7 @@ public class Activator implements BundleActivator {
|
|||
}
|
||||
|
||||
static synchronized void removeProxyServlet(ProxyServlet proxyServlet) {
|
||||
ServiceRegistration registration = (ServiceRegistration) serviceRegistrations.remove(proxyServlet);
|
||||
ServiceRegistration<?> registration = serviceRegistrations.remove(proxyServlet);
|
||||
if (registration != null)
|
||||
registration.unregister();
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
public class FilterChainImpl implements FilterChain {
|
||||
|
||||
private List matchingFilterRegistrations;
|
||||
private List<FilterRegistration> matchingFilterRegistrations;
|
||||
private ServletRegistration registration;
|
||||
private int filterIndex = 0;
|
||||
private int filterCount;
|
||||
|
||||
public FilterChainImpl(List matchingFilterRegistrations, ServletRegistration registration) {
|
||||
public FilterChainImpl(List<FilterRegistration> matchingFilterRegistrations, ServletRegistration registration) {
|
||||
this.matchingFilterRegistrations = matchingFilterRegistrations;
|
||||
this.registration = registration;
|
||||
this.filterCount = matchingFilterRegistrations.size();
|
||||
|
|
|
@ -15,13 +15,13 @@ import javax.servlet.*;
|
|||
|
||||
public class FilterConfigImpl implements FilterConfig {
|
||||
|
||||
private static final Dictionary EMPTY_PARAMS = new Hashtable(0);
|
||||
private static final Dictionary<String, String> EMPTY_PARAMS = new Hashtable<String, String>(0);
|
||||
private static final String FILTER_NAME = "filter-name"; //$NON-NLS-1$
|
||||
private Filter filter;
|
||||
private Dictionary initparams;
|
||||
private Dictionary<String, String> initparams;
|
||||
private ServletContext servletContext;
|
||||
|
||||
public FilterConfigImpl(Filter filter, Dictionary initparams, ServletContext servletContext) {
|
||||
public FilterConfigImpl(Filter filter, Dictionary<String, String> initparams, ServletContext servletContext) {
|
||||
this.filter = filter;
|
||||
this.initparams = (initparams != null) ? initparams : EMPTY_PARAMS;
|
||||
this.servletContext = servletContext;
|
||||
|
@ -46,7 +46,7 @@ public class FilterConfigImpl implements FilterConfig {
|
|||
return (String) initparams.get(name);
|
||||
}
|
||||
|
||||
public Enumeration getInitParameterNames() {
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return initparams.keys();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.osgi.service.http.HttpContext;
|
||||
|
||||
//This class wraps the filter object registered in the HttpService.registerFilter call, to manage the context classloader when handleRequests are being asked.
|
||||
public class FilterRegistration extends Registration implements Comparable {
|
||||
public class FilterRegistration extends Registration implements Comparable<FilterRegistration> {
|
||||
|
||||
private static long nextSequenceNumber = 1L;
|
||||
|
||||
|
@ -101,8 +101,7 @@ public class FilterRegistration extends Registration implements Comparable {
|
|||
return dispatchPathInfo.endsWith(suffix) && dispatchPathInfo.length() > prefix.length() + suffix.length();
|
||||
}
|
||||
|
||||
public int compareTo(Object other) {
|
||||
FilterRegistration otherFilterRegistration = (FilterRegistration) other;
|
||||
public int compareTo(FilterRegistration otherFilterRegistration) {
|
||||
int priorityDifference = priority - otherFilterRegistration.priority;
|
||||
if (priorityDifference != 0)
|
||||
return -priorityDifference;
|
||||
|
|
|
@ -13,9 +13,10 @@
|
|||
package org.eclipse.equinox.http.servlet.internal;
|
||||
|
||||
import org.osgi.framework.*;
|
||||
import org.osgi.service.http.HttpService;
|
||||
|
||||
// Factory to create http services. This is because the service needs to be customized for each bundle in order to implement the default resource lookups.
|
||||
public class HttpServiceFactory implements ServiceFactory {
|
||||
public class HttpServiceFactory implements ServiceFactory<HttpService> {
|
||||
|
||||
private ProxyServlet proxy;
|
||||
|
||||
|
@ -23,11 +24,11 @@ public class HttpServiceFactory implements ServiceFactory {
|
|||
this.proxy = proxy;
|
||||
}
|
||||
|
||||
public Object getService(Bundle bundle, ServiceRegistration registration) {
|
||||
public HttpService getService(Bundle bundle, ServiceRegistration<HttpService> registration) {
|
||||
return new HttpServiceImpl(bundle, proxy);
|
||||
}
|
||||
|
||||
public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
|
||||
public void ungetService(Bundle bundle, ServiceRegistration<HttpService> registration, HttpService service) {
|
||||
((HttpServiceImpl) service).shutdown();
|
||||
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ public class HttpServiceImpl implements HttpService, ExtendedHttpService {
|
|||
|
||||
private ProxyServlet proxy; //The proxy that does the dispatching of the incoming requests
|
||||
|
||||
private Set aliases = new HashSet(); //Aliases registered against this particular instance of the service
|
||||
private Set filters = new HashSet(); //Filters registered against this particular instance of the service
|
||||
private Set<String> aliases = new HashSet<String>(); //Aliases registered against this particular instance of the service
|
||||
private Set<Filter> filters = new HashSet<Filter>(); //Filters registered against this particular instance of the service
|
||||
|
||||
private boolean shutdown = false; // We prevent use of this instance if HttpServiceFactory.ungetService has called unregisterAliases.
|
||||
|
||||
|
@ -36,14 +36,14 @@ public class HttpServiceImpl implements HttpService, ExtendedHttpService {
|
|||
|
||||
//Clean up method
|
||||
synchronized void shutdown() {
|
||||
for (Iterator it = aliases.iterator(); it.hasNext();) {
|
||||
String alias = (String) it.next();
|
||||
for (Iterator<String> it = aliases.iterator(); it.hasNext();) {
|
||||
String alias = it.next();
|
||||
proxy.unregister(alias, false);
|
||||
}
|
||||
aliases.clear();
|
||||
|
||||
for (Iterator it = filters.iterator(); it.hasNext();) {
|
||||
Filter filter = (Filter) it.next();
|
||||
for (Iterator<Filter> it = filters.iterator(); it.hasNext();) {
|
||||
Filter filter = it.next();
|
||||
proxy.unregisterFilter(filter, false);
|
||||
}
|
||||
filters.clear();
|
||||
|
@ -58,6 +58,8 @@ public class HttpServiceImpl implements HttpService, ExtendedHttpService {
|
|||
/**
|
||||
* @see HttpService#registerServlet(String, Servlet, Dictionary, HttpContext)
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public synchronized void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext context) throws ServletException, NamespaceException {
|
||||
checkShutdown();
|
||||
if (context == null) {
|
||||
|
@ -99,7 +101,8 @@ public class HttpServiceImpl implements HttpService, ExtendedHttpService {
|
|||
return new DefaultHttpContext(bundle);
|
||||
}
|
||||
|
||||
public void registerFilter(String alias, Filter filter, Dictionary initparams, HttpContext context) throws ServletException {
|
||||
@Override
|
||||
public void registerFilter(String alias, Filter filter, Dictionary<String, String> initparams, HttpContext context) throws ServletException {
|
||||
checkShutdown();
|
||||
if (context == null) {
|
||||
context = createDefaultHttpContext();
|
||||
|
|
|
@ -35,7 +35,7 @@ public class HttpSessionAdaptor implements HttpSession {
|
|||
return session.getAttribute(arg0);
|
||||
}
|
||||
|
||||
public Enumeration getAttributeNames() {
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return session.getAttributeNames();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ProxyContext {
|
|||
private static final String JAVAX_SERVLET_CONTEXT_TEMPDIR = "javax.servlet.context.tempdir"; //$NON-NLS-1$
|
||||
|
||||
private String servletPath;
|
||||
private HashMap attributesMap = new HashMap();
|
||||
private HashMap<HttpContext, ContextAttributes> attributesMap = new HashMap<HttpContext, ContextAttributes>();
|
||||
File proxyContextTempDir;
|
||||
|
||||
public ProxyContext(ServletContext servletContext) {
|
||||
|
@ -62,7 +62,7 @@ public class ProxyContext {
|
|||
}
|
||||
|
||||
synchronized void createContextAttributes(HttpContext httpContext) {
|
||||
ContextAttributes attributes = (ContextAttributes) attributesMap.get(httpContext);
|
||||
ContextAttributes attributes = attributesMap.get(httpContext);
|
||||
if (attributes == null) {
|
||||
attributes = new ContextAttributes(httpContext);
|
||||
attributesMap.put(httpContext, attributes);
|
||||
|
@ -71,7 +71,7 @@ public class ProxyContext {
|
|||
}
|
||||
|
||||
synchronized void destroyContextAttributes(HttpContext httpContext) {
|
||||
ContextAttributes attributes = (ContextAttributes) attributesMap.get(httpContext);
|
||||
ContextAttributes attributes = attributesMap.get(httpContext);
|
||||
attributes.removeReference();
|
||||
if (attributes.referenceCount() == 0) {
|
||||
attributesMap.remove(httpContext);
|
||||
|
@ -79,8 +79,8 @@ public class ProxyContext {
|
|||
}
|
||||
}
|
||||
|
||||
synchronized Dictionary getContextAttributes(HttpContext httpContext) {
|
||||
return (Dictionary) attributesMap.get(httpContext);
|
||||
synchronized Dictionary<String, Object> getContextAttributes(HttpContext httpContext) {
|
||||
return attributesMap.get(httpContext);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +102,7 @@ public class ProxyContext {
|
|||
return directory.delete();
|
||||
}
|
||||
|
||||
public class ContextAttributes extends Hashtable {
|
||||
public class ContextAttributes extends Hashtable<String, Object> {
|
||||
private static final long serialVersionUID = 1916670423277243587L;
|
||||
private int referenceCount;
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ import org.osgi.service.http.NamespaceException;
|
|||
public class ProxyServlet extends HttpServlet implements Filter {
|
||||
|
||||
private static final long serialVersionUID = 4117456123807468871L;
|
||||
private Map servletRegistrations = new HashMap(); //alias --> servlet registration
|
||||
private Set registeredServlets = new HashSet(); //All the servlets objects that have been registered
|
||||
private Map<String, ServletRegistration> servletRegistrations = new HashMap<String, ServletRegistration>(); //alias --> servlet registration
|
||||
private Set<Servlet> registeredServlets = new HashSet<Servlet>(); //All the servlets objects that have been registered
|
||||
|
||||
private Map filterRegistrations = new HashMap(); //filter --> filter registration;
|
||||
private Map<Filter, FilterRegistration> filterRegistrations = new HashMap<Filter, FilterRegistration>(); //filter --> filter registration;
|
||||
private ProxyContext proxyContext;
|
||||
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
|
@ -106,7 +106,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
|
||||
private boolean processAlias(HttpServletRequest req, HttpServletResponse resp, String alias, String extensionAlias, FilterChain filterChain) throws ServletException, IOException {
|
||||
ServletRegistration registration = null;
|
||||
List matchingFilterRegistrations = Collections.EMPTY_LIST;
|
||||
List<FilterRegistration> matchingFilterRegistrations = Collections.emptyList();
|
||||
String dispatchPathInfo = HttpServletRequestAdaptor.getDispatchPathInfo(req, filterChain);
|
||||
synchronized (this) {
|
||||
if (extensionAlias == null)
|
||||
|
@ -123,9 +123,9 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
if (registration != null) {
|
||||
registration.addReference();
|
||||
if (!filterRegistrations.isEmpty()) {
|
||||
matchingFilterRegistrations = new ArrayList();
|
||||
for (Iterator it = filterRegistrations.values().iterator(); it.hasNext();) {
|
||||
FilterRegistration filterRegistration = (FilterRegistration) it.next();
|
||||
matchingFilterRegistrations = new ArrayList<FilterRegistration>();
|
||||
for (Iterator<FilterRegistration> it = filterRegistrations.values().iterator(); it.hasNext();) {
|
||||
FilterRegistration filterRegistration = it.next();
|
||||
if (filterRegistration.matches(dispatchPathInfo)) {
|
||||
matchingFilterRegistrations.add(filterRegistration);
|
||||
filterRegistration.addReference();
|
||||
|
@ -146,7 +146,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
}
|
||||
} finally {
|
||||
registration.removeReference();
|
||||
for (Iterator it = matchingFilterRegistrations.iterator(); it.hasNext();) {
|
||||
for (Iterator<FilterRegistration> it = matchingFilterRegistrations.iterator(); it.hasNext();) {
|
||||
FilterRegistration filterRegistration = (FilterRegistration) it.next();
|
||||
filterRegistration.removeReference();
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
}
|
||||
|
||||
//Effective registration of the servlet as defined HttpService#registerServlet()
|
||||
synchronized void registerServlet(String alias, Servlet servlet, Dictionary initparams, HttpContext httpContext) throws ServletException, NamespaceException {
|
||||
synchronized void registerServlet(String alias, Servlet servlet, Dictionary<String, String> initparams, HttpContext httpContext) throws ServletException, NamespaceException {
|
||||
checkAlias(alias);
|
||||
if (servletRegistrations.containsKey(alias))
|
||||
throw new NamespaceException("The alias '" + alias + "' is already in use."); //$NON-NLS-1$//$NON-NLS-2$
|
||||
|
@ -238,7 +238,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void registerFilter(String alias, Filter filter, Dictionary initparams, HttpContext httpContext) throws ServletException {
|
||||
public synchronized void registerFilter(String alias, Filter filter, Dictionary<String, String> initparams, HttpContext httpContext) throws ServletException {
|
||||
checkAlias(alias);
|
||||
if (filter == null)
|
||||
throw new IllegalArgumentException("Filter cannot be null"); //$NON-NLS-1$
|
||||
|
@ -263,7 +263,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
filterRegistrations.put(filter, registration);
|
||||
}
|
||||
|
||||
private int findFilterPriority(Dictionary initparams) {
|
||||
private int findFilterPriority(Dictionary<String, String> initparams) {
|
||||
if (initparams == null)
|
||||
return 0;
|
||||
String filterPriority = (String) initparams.get("filter-priority"); //$NON-NLS-1$
|
||||
|
@ -303,7 +303,7 @@ public class ProxyServlet extends HttpServlet implements Filter {
|
|||
return filterConfig.getInitParameter(arg0);
|
||||
}
|
||||
|
||||
public Enumeration getInitParameterNames() {
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return filterConfig.getInitParameterNames();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ResourceServlet extends HttpServlet {
|
|||
|
||||
private void writeResource(final HttpServletRequest req, final HttpServletResponse resp, final String resourcePath, final URL resourceURL) throws IOException {
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction() {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
|
||||
public Object run() throws Exception {
|
||||
URLConnection connection = resourceURL.openConnection();
|
||||
|
|
|
@ -16,13 +16,13 @@ import javax.servlet.*;
|
|||
|
||||
public class ServletConfigImpl implements ServletConfig {
|
||||
|
||||
private static final Dictionary EMPTY_PARAMS = new Hashtable(0);
|
||||
private static final Dictionary<String, String> EMPTY_PARAMS = new Hashtable<String, String>(0);
|
||||
private static final String SERVLET_NAME = "servlet-name"; //$NON-NLS-1$
|
||||
private Servlet servlet;
|
||||
private Dictionary initparams;
|
||||
private Dictionary<String, String> initparams;
|
||||
private ServletContext servletContext;
|
||||
|
||||
public ServletConfigImpl(Servlet servlet, Dictionary initparams, ServletContext servletContext) {
|
||||
public ServletConfigImpl(Servlet servlet, Dictionary<String, String> initparams, ServletContext servletContext) {
|
||||
this.servlet = servlet;
|
||||
this.initparams = (initparams != null) ? initparams : EMPTY_PARAMS;
|
||||
this.servletContext = servletContext;
|
||||
|
@ -47,7 +47,7 @@ public class ServletConfigImpl implements ServletConfig {
|
|||
return (String) initparams.get(name);
|
||||
}
|
||||
|
||||
public Enumeration getInitParameterNames() {
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return initparams.keys();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,14 +47,15 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
* implementation uses reflection to check for and then call the associated HttpContext.getResourcePaths(...)
|
||||
* method opportunistically. Null is returned if the method is not present or fails.
|
||||
*/
|
||||
public Set getResourcePaths(String name) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<String> getResourcePaths(String name) {
|
||||
if (name == null || !name.startsWith("/")) //$NON-NLS-1$
|
||||
return null;
|
||||
try {
|
||||
Method getResourcePathsMethod = httpContext.getClass().getMethod("getResourcePaths", new Class[] {String.class}); //$NON-NLS-1$
|
||||
if (!getResourcePathsMethod.isAccessible())
|
||||
getResourcePathsMethod.setAccessible(true);
|
||||
return (Set) getResourcePathsMethod.invoke(httpContext, new Object[] {name});
|
||||
return (Set<String>) getResourcePathsMethod.invoke(httpContext, new Object[] {name});
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
@ -62,22 +63,22 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
}
|
||||
|
||||
public Object getAttribute(String attributeName) {
|
||||
Dictionary attributes = proxyContext.getContextAttributes(httpContext);
|
||||
Dictionary<String, Object> attributes = proxyContext.getContextAttributes(httpContext);
|
||||
return attributes.get(attributeName);
|
||||
}
|
||||
|
||||
public Enumeration getAttributeNames() {
|
||||
Dictionary attributes = proxyContext.getContextAttributes(httpContext);
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
Dictionary<String, Object> attributes = proxyContext.getContextAttributes(httpContext);
|
||||
return attributes.keys();
|
||||
}
|
||||
|
||||
public void setAttribute(String attributeName, Object attributeValue) {
|
||||
Dictionary attributes = proxyContext.getContextAttributes(httpContext);
|
||||
Dictionary<String, Object> attributes = proxyContext.getContextAttributes(httpContext);
|
||||
attributes.put(attributeName, attributeValue);
|
||||
}
|
||||
|
||||
public void removeAttribute(String attributeName) {
|
||||
Dictionary attributes = proxyContext.getContextAttributes(httpContext);
|
||||
Dictionary<String, Object> attributes = proxyContext.getContextAttributes(httpContext);
|
||||
attributes.remove(attributeName);
|
||||
}
|
||||
|
||||
|
@ -88,7 +89,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
|
||||
public URL getResource(final String name) {
|
||||
try {
|
||||
return (URL) AccessController.doPrivileged(new PrivilegedExceptionAction() {
|
||||
return (URL) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
public Object run() throws Exception {
|
||||
return httpContext.getResource(name);
|
||||
}
|
||||
|
@ -119,7 +120,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
return servletContext.getInitParameter(arg0);
|
||||
}
|
||||
|
||||
public Enumeration getInitParameterNames() {
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return servletContext.getInitParameterNames();
|
||||
}
|
||||
|
||||
|
@ -157,12 +158,12 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
}
|
||||
|
||||
/**@deprecated*/
|
||||
public Enumeration getServletNames() {
|
||||
public Enumeration<String> getServletNames() {
|
||||
return servletContext.getServletNames();
|
||||
}
|
||||
|
||||
/**@deprecated*/
|
||||
public Enumeration getServlets() {
|
||||
public Enumeration<Servlet> getServlets() {
|
||||
return servletContext.getServlets();
|
||||
}
|
||||
|
||||
|
@ -182,8 +183,8 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
// Added in Servlet 2.5
|
||||
public String getContextPath() {
|
||||
try {
|
||||
Method getContextPathMethod = servletContext.getClass().getMethod("getContextPath", null); //$NON-NLS-1$
|
||||
return (String) getContextPathMethod.invoke(servletContext, null) + proxyContext.getServletPath();
|
||||
Method getContextPathMethod = servletContext.getClass().getMethod("getContextPath", (Class<?>[])null); //$NON-NLS-1$
|
||||
return (String) getContextPathMethod.invoke(servletContext, (Object[])null) + proxyContext.getServletPath();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
@ -198,7 +199,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
return servletContext.addFilter(arg0, arg1);
|
||||
}
|
||||
|
||||
public Dynamic addFilter(String arg0, Class arg1) {
|
||||
public Dynamic addFilter(String arg0, Class<? extends Filter> arg1) {
|
||||
return servletContext.addFilter(arg0, arg1);
|
||||
}
|
||||
|
||||
|
@ -210,7 +211,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
servletContext.addListener(arg0);
|
||||
}
|
||||
|
||||
public void addListener(Class arg0) {
|
||||
public void addListener(Class<? extends EventListener> arg0) {
|
||||
servletContext.addListener(arg0);
|
||||
}
|
||||
|
||||
|
@ -225,23 +226,23 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
}
|
||||
|
||||
public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
|
||||
Class arg1) {
|
||||
Class<? extends Servlet> arg1) {
|
||||
return servletContext.addServlet(arg0, arg1);
|
||||
}
|
||||
|
||||
public Filter createFilter(Class arg0) throws ServletException {
|
||||
public <T extends Filter> T createFilter(Class<T> arg0) throws ServletException {
|
||||
return servletContext.createFilter(arg0);
|
||||
}
|
||||
|
||||
public EventListener createListener(Class arg0) throws ServletException {
|
||||
public <T extends EventListener> T createListener(Class<T> arg0) throws ServletException {
|
||||
return servletContext.createListener(arg0);
|
||||
}
|
||||
|
||||
public Servlet createServlet(Class arg0) throws ServletException {
|
||||
public <T extends Servlet> T createServlet(Class<T> arg0) throws ServletException {
|
||||
return servletContext.createServlet(arg0);
|
||||
}
|
||||
|
||||
public void declareRoles(String[] arg0) {
|
||||
public void declareRoles(String... arg0) {
|
||||
servletContext.declareRoles(arg0);
|
||||
}
|
||||
|
||||
|
@ -249,7 +250,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
return servletContext.getClassLoader();
|
||||
}
|
||||
|
||||
public Set getDefaultSessionTrackingModes() {
|
||||
public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
|
||||
return servletContext.getDefaultSessionTrackingModes();
|
||||
}
|
||||
|
||||
|
@ -261,7 +262,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
return servletContext.getEffectiveMinorVersion();
|
||||
}
|
||||
|
||||
public Set getEffectiveSessionTrackingModes() {
|
||||
public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
|
||||
return servletContext.getEffectiveSessionTrackingModes();
|
||||
}
|
||||
|
||||
|
@ -269,7 +270,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
return servletContext.getFilterRegistration(arg0);
|
||||
}
|
||||
|
||||
public Map getFilterRegistrations() {
|
||||
public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
|
||||
return servletContext.getFilterRegistrations();
|
||||
}
|
||||
|
||||
|
@ -281,7 +282,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
return servletContext.getServletRegistration(arg0);
|
||||
}
|
||||
|
||||
public Map getServletRegistrations() {
|
||||
public Map<String, ? extends ServletRegistration> getServletRegistrations() {
|
||||
return servletContext.getServletRegistrations();
|
||||
}
|
||||
|
||||
|
@ -293,7 +294,7 @@ public class ServletContextAdaptor implements ServletContext {
|
|||
return servletContext.setInitParameter(arg0, arg1);
|
||||
}
|
||||
|
||||
public void setSessionTrackingModes(Set arg0) {
|
||||
public void setSessionTrackingModes(Set<SessionTrackingMode> arg0) {
|
||||
servletContext.setSessionTrackingModes(arg0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#Wed Jun 01 10:21:31 MYT 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
|
||||
org.eclipse.jdt.core.compiler.compliance=1.3
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.3
|
|
@ -1,8 +0,0 @@
|
|||
#Wed Jun 01 10:21:31 MYT 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
|
||||
org.eclipse.jdt.core.compiler.compliance=1.3
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.3
|
Loading…
Reference in New Issue