diff options
author | kchan | 2008-11-20 04:03:54 +0000 |
---|---|---|
committer | kchan | 2008-11-20 04:03:54 +0000 |
commit | a1acb82622dee965ffbdfdd86a70cdc4a982daa8 (patch) | |
tree | 97801b3b7255c7b2f03a9a25a1cfffe129222998 /bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer | |
parent | acc038e1223c96b0f7f51432d7a7b9cf790be6d4 (diff) | |
download | webtools.webservices-a1acb82622dee965ffbdfdd86a70cdc4a982daa8.tar.gz webtools.webservices-a1acb82622dee965ffbdfdd86a70cdc4a982daa8.tar.xz webtools.webservices-a1acb82622dee965ffbdfdd86a70cdc4a982daa8.zip |
[255374] WSE does not handle utf-8 characters in URLs.
Diffstat (limited to 'bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer')
3 files changed, 41 insertions, 11 deletions
diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/util/URLUtils.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/util/URLUtils.java index b7070b348..d35c6498e 100644 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/util/URLUtils.java +++ b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/util/URLUtils.java @@ -1,16 +1,20 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: - * IBM Corporation - initial API and implementation + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20081119 255374 mahutch@ca.ibm.com - Mark Hutchinson *******************************************************************************/ package org.eclipse.wst.ws.internal.explorer.platform.util; import java.io.UnsupportedEncodingException; +import java.net.URI; import java.net.URLDecoder; import java.net.URLEncoder; @@ -98,4 +102,19 @@ public final class URLUtils throw new RuntimeException("%MSG_BROKEN_VM_DOES_NOT_SUPPORT_UTF-8",e); } } + + /** + * Encodes non-ASCII characters in a URL string. + * @param urlString The URL string to encode + * @return The URL as an encoded string + */ + public static String encodeURLString(String urlString) { + try { + URI uri = new URI(urlString); + return uri.toASCIIString(); + } catch (Exception e) { + //do nothing, we will just return the original string + } + return urlString; + } } diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/datamodel/WSDLElement.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/datamodel/WSDLElement.java index a27ea8080..e4356126f 100644 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/datamodel/WSDLElement.java +++ b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/datamodel/WSDLElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. + * Copyright (c) 2004, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ * 20060717 146707 mahutch@ca.ibm.com - Mark Hutchinson * 20070124 167487 gilberta@ca.ibm.com - Gilbert Andrews * 20080115 214955 gilberta@ca.ibm.com - Gilbert Andrews + * 20081119 255374 mahutch@ca.ibm.com - Mark Hutchinson, WSE does not handle utf-8 characters in URLs *******************************************************************************/ package org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel; @@ -43,6 +44,7 @@ import org.eclipse.wst.common.uriresolver.internal.util.URIEncoder; import org.eclipse.wst.ws.internal.common.HTTPUtility; import org.eclipse.wst.ws.internal.datamodel.Model; import org.eclipse.wst.ws.internal.explorer.platform.constants.ModelConstants; +import org.eclipse.wst.ws.internal.explorer.platform.util.URLUtils; import org.eclipse.wst.ws.internal.explorer.platform.util.Validator; import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants; import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.WSDLModelConstants; @@ -109,7 +111,7 @@ public class WSDLElement extends WSDLCommonElement public void setWsdlUrl(String wsdlUrl) { HTTPUtility http = new HTTPUtility(); - wsdlUrl_ = http.handleRedirect(wsdlUrl); + wsdlUrl_ = http.handleRedirect(URLUtils.encodeURLString(wsdlUrl)); } public String getWsdlUrl() { @@ -264,15 +266,18 @@ public class WSDLElement extends WSDLCommonElement } } xsdSchemaDirectiveURL.append(xsdSchemaDirectiveLocation); + + //encode the URL so that Schemas with non-ASCII filenames can be resolved + String xsdSchemaDirectiveURLString = URLUtils.encodeURLString(xsdSchemaDirectiveURL.toString()); // resolve schema directive XSDSchema resolvedSchema = xsdSchemaDirective.getResolvedSchema(); - if (resolvedSchema == null && xsdSchemaDirectiveURL.length() > 0) - resolvedSchema = getSchema(xsdSchemaDirectiveURL.toString()); + if (resolvedSchema == null && xsdSchemaDirectiveURLString.length() > 0) + resolvedSchema = getSchema(xsdSchemaDirectiveURLString); if (resolvedSchema != null) { - if(!checkSchemaURI(xsdSchemaDirectiveURL.toString())){ + if(!checkSchemaURI(xsdSchemaDirectiveURLString)){ schemaList_.addElement(resolvedSchema); - gatherSchemaDirective(resolvedSchema, xsdSchemaDirectiveURL.toString()); + gatherSchemaDirective(resolvedSchema, xsdSchemaDirectiveURLString); } } } @@ -367,6 +372,7 @@ public class WSDLElement extends WSDLCommonElement private final XSDSchema getSchema(String locURI) { + locURI = URLUtils.encodeURLString(locURI); XSDSchema xsdSchema = XSDSchemaImpl.getSchemaForSchema(locURI); if (xsdSchema == null) { diff --git a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsil/actions/OpenWSILAction.java b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsil/actions/OpenWSILAction.java index 1e3fe4b84..505bd1e6d 100644 --- a/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsil/actions/OpenWSILAction.java +++ b/bundles/org.eclipse.wst.ws.explorer/src/org/eclipse/wst/ws/internal/explorer/platform/wsil/actions/OpenWSILAction.java @@ -1,12 +1,15 @@ /******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. + * Copyright (c) 2001, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * IBM Corporation - initial API and implementation + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20081119 255374 mahutch@ca.ibm.com - Mark Hutchinson, WSE does not handle utf-8 characters in URLs *******************************************************************************/ package org.eclipse.wst.ws.internal.explorer.platform.wsil.actions; @@ -27,6 +30,7 @@ import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager; import org.eclipse.wst.ws.internal.explorer.platform.perspective.ToolManager; import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; +import org.eclipse.wst.ws.internal.explorer.platform.util.URLUtils; import org.eclipse.wst.ws.internal.explorer.platform.wsil.constants.WsilActionInputs; import org.eclipse.wst.ws.internal.explorer.platform.wsil.constants.WsilModelConstants; import org.eclipse.wst.ws.internal.explorer.platform.wsil.datamodel.WsilElement; @@ -64,6 +68,7 @@ public class OpenWSILAction extends FormAction public boolean run() { String wsilURL = (String)propertyTable_.get(WsilActionInputs.WSIL_URL); + wsilURL = URLUtils.encodeURLString(wsilURL); int inspectionType = Integer.parseInt((String)propertyTable_.get(WsilActionInputs.WSIL_INSPECTION_TYPE)); WSILPerspective wsilPerspective = controller_.getWSILPerspective(); MessageQueue msgQueue = wsilPerspective.getMessageQueue(); |