mirror of https://github.com/jenkinsci/jenkins.git
needs a PageCreator to support JNLP files
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11601 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
parent
2763f18be3
commit
576df3dc80
|
|
@ -0,0 +1,26 @@
|
|||
package org.jvnet.hudson.test;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.DefaultPageCreator;
|
||||
import com.gargoylesoftware.htmlunit.Page;
|
||||
import com.gargoylesoftware.htmlunit.WebResponse;
|
||||
import com.gargoylesoftware.htmlunit.WebWindow;
|
||||
import com.gargoylesoftware.htmlunit.PageCreator;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* {@link PageCreator} that understands JNLP file.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class HudsonPageCreator extends DefaultPageCreator {
|
||||
@Override
|
||||
public Page createPage(WebResponse webResponse, WebWindow webWindow) throws IOException {
|
||||
String contentType = webResponse.getContentType().toLowerCase();
|
||||
if(contentType.equals("application/x-java-jnlp-file"))
|
||||
return createXmlPage(webResponse, webWindow);
|
||||
return super.createPage(webResponse, webWindow);
|
||||
}
|
||||
|
||||
public static final HudsonPageCreator INSTANCE = new HudsonPageCreator();
|
||||
}
|
||||
|
|
@ -191,6 +191,7 @@ public abstract class HudsonTestCase extends TestCase {
|
|||
public class WebClient extends com.gargoylesoftware.htmlunit.WebClient {
|
||||
public WebClient() {
|
||||
setJavaScriptEnabled(false);
|
||||
setPageCreator(HudsonPageCreator.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue