From: <rb...@us...> - 2017-12-11 18:07:14
|
Revision: 14995 http://sourceforge.net/p/htmlunit/code/14995 Author: rbri Date: 2017-12-11 18:07:11 +0000 (Mon, 11 Dec 2017) Log Message: ----------- WebClient.setWebStartHandler() and the interface WebStartHandler added. Create your implementation of this interface to support WebStart links. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/WebStartHandler.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/package-info.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-12-11 18:01:58 UTC (rev 14994) +++ trunk/htmlunit/src/changes/changes.xml 2017-12-11 18:07:11 UTC (rev 14995) @@ -7,8 +7,12 @@ </properties> <body> - <release version="2.29" date="xx, 2017" description=""> + <release version="2.29" date="xx, 2017" description="Bugfixes, WebStart support"> <action type="add" dev="rbri"> + WebClient.setWebStartHandler() and the interface WebStartHandler added. Create your implementation + of this interface to support WebStart links. + </action> + <action type="add" dev="rbri"> JavaScript: CanvasGradient.addColorStop() added </action> <action type="fix" dev="rbri"> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-12-11 18:01:58 UTC (rev 14994) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-12-11 18:07:11 UTC (rev 14995) @@ -94,6 +94,7 @@ import com.gargoylesoftware.htmlunit.util.Cookie; import com.gargoylesoftware.htmlunit.util.NameValuePair; import com.gargoylesoftware.htmlunit.util.UrlUtils; +import com.gargoylesoftware.htmlunit.webstart.WebStartHandler; import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject; @@ -159,6 +160,7 @@ private PromptHandler promptHandler_; private StatusHandler statusHandler_; private AttachmentHandler attachmentHandler_; + private WebStartHandler webStartHandler_; private AppletConfirmHandler appletConfirmHandler_; private AjaxController ajaxController_ = new AjaxController(); @@ -507,6 +509,11 @@ return webWindow.getEnclosedPage(); } + if (webStartHandler_ != null && "application/x-java-jnlp-file".equals(webResponse.getContentType())) { + webStartHandler_.handleJnlpResponse(webResponse); + return webWindow.getEnclosedPage(); + } + if (attachmentHandler_ != null && Attachment.isAttachment(webResponse)) { final WebWindow w = openWindow(null, null, webWindow); final Page page = pageCreator_.createPage(webResponse, w); @@ -1700,6 +1707,22 @@ } /** + * Sets the WebStart handler. + * @param handler the new WebStart handler + */ + public void setWebStartHandler(final WebStartHandler handler) { + webStartHandler_ = handler; + } + + /** + * Returns the current WebStart handler. + * @return the current WebStart handler + */ + public WebStartHandler getWebStartHandler() { + return webStartHandler_; + } + + /** * Sets the applet confirm handler. * @param handler the new applet confirm handler handler */ Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/WebStartHandler.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/WebStartHandler.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/WebStartHandler.java 2017-12-11 18:07:11 UTC (rev 14995) @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2002-2017 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.gargoylesoftware.htmlunit.webstart; + +import com.gargoylesoftware.htmlunit.WebResponse; + +/** + * WebStart support. + * + * @author Ronald Brill + */ +public interface WebStartHandler { + + /** + * Handles the jnlp file response. + * @param webResponse the response to get the jnlp content from + */ + void handleJnlpResponse(WebResponse webResponse); +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/WebStartHandler.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/package-info.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/package-info.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/package-info.java 2017-12-11 18:07:11 UTC (rev 14995) @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2002-2017 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Miscellaneous utilities. + */ +package com.gargoylesoftware.htmlunit.webstart; Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/webstart/package-info.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property |