Issue #1676 remove deprecated methods from WebAppContext
This commit is contained in:
parent
f1146856ac
commit
2443ca34f3
|
@ -19,6 +19,7 @@
|
|||
package org.eclipse.jetty.example.asyncrest;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.webapp.ClasspathPattern;
|
||||
import org.eclipse.jetty.webapp.WebAppContext;
|
||||
|
||||
public class DemoServer
|
||||
|
@ -34,7 +35,7 @@ public class DemoServer
|
|||
webapp.setContextPath("/");
|
||||
webapp.setWar(jetty_home+"/target/async-rest/");
|
||||
webapp.setParentLoaderPriority(true);
|
||||
webapp.setServerClasses(new String[]{});
|
||||
webapp.setServerClasspathPattern(new ClasspathPattern());
|
||||
server.setHandler(webapp);
|
||||
|
||||
server.start();
|
||||
|
|
|
@ -638,18 +638,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
|||
return _configurations.toArray();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return Returns the configurations.
|
||||
* @deprecated
|
||||
*/
|
||||
public Configuration[] getConfigurations()
|
||||
{
|
||||
if (_configurations.size()==0)
|
||||
loadConfigurations();
|
||||
return _configurations.getConfigurations().toArray(new Configuration[_configurations.size()]);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return Returns the configurations.
|
||||
|
@ -774,30 +762,12 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @see #setServerClasses(String[])
|
||||
* @return Returns the serverClasses.
|
||||
*/
|
||||
@ManagedAttribute(value="classes and packages hidden by the context classloader", readonly=true)
|
||||
public String[] getServerClasses()
|
||||
{
|
||||
return _serverClasses.getPatterns();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Deprecated
|
||||
public void addSystemClass(String clazz)
|
||||
{
|
||||
_systemClasses.add(clazz);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Deprecated
|
||||
public void addServerClass(String clazz)
|
||||
{
|
||||
_serverClasses.add(clazz);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public boolean isServerClass(Class<?> clazz)
|
||||
|
@ -1230,38 +1200,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
|||
_contextWhiteList = contextWhiteList;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Set the server classes patterns.
|
||||
* <p>
|
||||
* Server classes/packages are classes used to implement the server and are hidden
|
||||
* from the context. If the context needs to load these classes, it must have its
|
||||
* own copy of them in WEB-INF/lib or WEB-INF/classes.
|
||||
* A {@link ClasspathPattern} is used to match the server classes.
|
||||
* @deprecated use {@link #setServerClasspathPattern(ClasspathPattern)} or {@link Configuration}s
|
||||
* @param serverClasses The serverClasses to set.
|
||||
*/
|
||||
public void setServerClasses(String... serverClasses)
|
||||
{
|
||||
setServerClasspathPattern(new ClasspathPattern(serverClasses));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* Set the system classes patterns.
|
||||
* <p>
|
||||
* System classes/packages are classes provided by the JVM and that
|
||||
* cannot be replaced by classes of the same name from WEB-INF,
|
||||
* regardless of the value of {@link #setParentLoaderPriority(boolean)}.
|
||||
* A {@link ClasspathPattern} is used to match the system classes.
|
||||
* @deprecated use {@link #setSystemClasspathPattern(ClasspathPattern)} or {@link Configuration}s
|
||||
* @param systemClasses The systemClasses to set.
|
||||
*/
|
||||
public void setSystemClasses(String... systemClasses)
|
||||
{
|
||||
setSystemClasspathPattern(new ClasspathPattern(systemClasses));
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** Set temporary directory for context.
|
||||
|
|
|
@ -186,7 +186,6 @@ public class WebAppClassLoaderTest
|
|||
assertCanLoadClass("org.acme.webapp.ClassInJarA");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void testExposedClassDeprecated() throws Exception
|
||||
{
|
||||
|
@ -194,7 +193,7 @@ public class WebAppClassLoaderTest
|
|||
String[] newSC=new String[oldSC.length+1];
|
||||
newSC[0]="-org.eclipse.jetty.webapp.Configuration";
|
||||
System.arraycopy(oldSC,0,newSC,1,oldSC.length);
|
||||
_context.setServerClasses(newSC);
|
||||
_context.setServerClasspathPattern(new ClasspathPattern(newSC));
|
||||
|
||||
assertCanLoadClass("org.acme.webapp.ClassInJarA");
|
||||
assertCanLoadClass("org.acme.webapp.ClassInJarB");
|
||||
|
@ -225,13 +224,14 @@ public class WebAppClassLoaderTest
|
|||
String[] newServC=new String[oldServC.length+1];
|
||||
newServC[0]="org.eclipse.jetty.webapp.Configuration";
|
||||
System.arraycopy(oldServC,0,newServC,1,oldServC.length);
|
||||
_context.setServerClasses(newServC);
|
||||
|
||||
|
||||
_context.setServerClasspathPattern(new ClasspathPattern(newServC));
|
||||
|
||||
String[] oldSysC=_context.getSystemClasses();
|
||||
String[] newSysC=new String[oldSysC.length+1];
|
||||
newSysC[0]="org.eclipse.jetty.webapp.";
|
||||
System.arraycopy(oldSysC,0,newSysC,1,oldSysC.length);
|
||||
_context.setSystemClasses(newSysC);
|
||||
_context.setSystemClasspathPattern(new ClasspathPattern(newSysC));
|
||||
|
||||
assertCanLoadClass("org.acme.webapp.ClassInJarA");
|
||||
assertCanLoadClass("org.acme.webapp.ClassInJarB");
|
||||
|
@ -243,16 +243,16 @@ public class WebAppClassLoaderTest
|
|||
newSysC=new String[oldSysC.length+1];
|
||||
newSysC[0]="org.acme.webapp.ClassInJarA";
|
||||
System.arraycopy(oldSysC,0,newSysC,1,oldSysC.length);
|
||||
_context.setSystemClasses(newSysC);
|
||||
_context.setSystemClasspathPattern(new ClasspathPattern(newSysC));
|
||||
|
||||
assertCanLoadResource("org/acme/webapp/ClassInJarA.class");
|
||||
_context.setSystemClasses(oldSysC);
|
||||
_context.setSystemClasspathPattern(new ClasspathPattern(oldSysC));
|
||||
|
||||
oldServC=_context.getServerClasses();
|
||||
newServC=new String[oldServC.length+1];
|
||||
newServC[0]="org.acme.webapp.ClassInJarA";
|
||||
System.arraycopy(oldServC,0,newServC,1,oldServC.length);
|
||||
_context.setServerClasses(newServC);
|
||||
_context.setServerClasspathPattern(new ClasspathPattern(newServC));
|
||||
assertCanLoadResource("org/acme/webapp/ClassInJarA.class");
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ public class WebAppClassLoaderTest
|
|||
String[] newServC=new String[oldServC.length+1];
|
||||
newServC[0]="org.acme.";
|
||||
System.arraycopy(oldServC,0,newServC,1,oldServC.length);
|
||||
_context.setServerClasses(newServC);
|
||||
_context.setServerClasspathPattern(new ClasspathPattern(newServC));
|
||||
|
||||
_context.setParentLoaderPriority(true);
|
||||
// dump(_context);
|
||||
|
@ -340,12 +340,12 @@ public class WebAppClassLoaderTest
|
|||
// assertEquals(0,resources.get(0).toString().indexOf("jar:file:"));
|
||||
// assertEquals(0,resources.get(1).toString().indexOf("file:"));
|
||||
|
||||
_context.setServerClasses(oldServC);
|
||||
_context.setServerClasspathPattern(new ClasspathPattern(oldServC));
|
||||
String[] oldSysC=_context.getSystemClasses();
|
||||
String[] newSysC=new String[oldSysC.length+1];
|
||||
newSysC[0]="org.acme.";
|
||||
System.arraycopy(oldSysC,0,newSysC,1,oldSysC.length);
|
||||
_context.setSystemClasses(newSysC);
|
||||
_context.setSystemClasspathPattern(new ClasspathPattern(newSysC));
|
||||
|
||||
_context.setParentLoaderPriority(true);
|
||||
// dump(_context);
|
||||
|
|
|
@ -335,8 +335,7 @@ public abstract class RFC2616BaseTest
|
|||
HttpFields fields = new HttpFields();
|
||||
|
||||
fields.put("Q","bbb;q=0.5,aaa,ccc;q=0.002,d;q=0,e;q=0.0001,ddd;q=0.001,aa2,abb;q=0.7");
|
||||
Enumeration<String> qualities = fields.getValues("Q",", \t");
|
||||
List<?> list = HttpFields.qualityList(qualities);
|
||||
List<String> list = fields.getQualityCSV("Q");
|
||||
Assert.assertEquals("Quality parameters","aaa",HttpFields.valueParameters(list.get(0).toString(),null));
|
||||
Assert.assertEquals("Quality parameters","aa2",HttpFields.valueParameters(list.get(1).toString(),null));
|
||||
Assert.assertEquals("Quality parameters","abb",HttpFields.valueParameters(list.get(2).toString(),null));
|
||||
|
|
Loading…
Reference in New Issue