简体   繁体   English

java.net.MalformedURLException:无协议:

[英]java.net.MalformedURLException: no protocol:

Why I am getting no protocol if i have http in the url path? 如果我的网址路径中有http,为什么我没有协议?

Log: 日志:

network: Connecting http://xxx.ccc.local/upload/up.php?aa=0&bb=Ap%F3lice+de+Seguro&cc=1028&from=documentos with cookie "CLinkLanguage=en; __utma=232844939.1396040569.1356709687.1357294077.1357902500.12; __utmz=232844939.1356709687.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=232844939.24.10.1357902500; symfony=e0lpbkrcu0bidkpiujd1if4pt4; __utmc=232844939; CLinkLanguage=en; PHPSESSID=uv31kr1vpojvqgnc9ae9nda921"

Exception: 例外:

    java.net.MalformedURLException: no protocol: 
        at java.net.URL.<init>(Unknown Source)
        at java.net.URL.<init>(Unknown Source)
        at java.net.URL.<init>(Unknown Source)

html html

 <APPLET  CODE = "wjhk.jupload.JUploadApplet" ARCHIVE = "upload/wjhk.jupload.jar" WIDTH = "600" HEIGHT = "400" MAYSCRIPT></XMP>
        <PARAM NAME = CODE VALUE = "wjhk.jupload.JUploadApplet" >
        <PARAM NAME = ARCHIVE VALUE = "upload/wjhk.jupload.jar" >
        <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.4">
        <PARAM NAME = "scriptable" VALUE="false">
        <PARAM NAME = "postURL" VALUE ="{$url}">
        <PARAM NAME = "anexosID" VALUE ="{$anexosID}">
        <PARAM NAME = "subanexosID" VALUE ="{$IdConsulta}">
        <PARAM NAME = "companyID" VALUE ="{$companyID}">
        <PARAM NAME = "resultURL" VALUE ="{$resultUrl}">
        <param name="debug" value="true">


    Java 1.4 or higher plugin required.

<APPLET  CODE = "wjhk.jupload.JUploadApplet" ARCHIVE = "upload/wjhk.jupload.jar" WIDTH = "600" HEIGHT = "400" MAYSCRIPT></XMP>
    <PARAM NAME = CODE VALUE = "wjhk.jupload.JUploadApplet" >
    <PARAM NAME = ARCHIVE VALUE = "upload/wjhk.jupload.jar" >
    <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.4">
    <PARAM NAME = "scriptable" VALUE="false">
    <PARAM NAME = "postURL" VALUE ="http://xxx.ccc.local/upload/up.php?aa=0&bb=Alvar%E1%2Ffg&cc=1028&from=documentos">
    <PARAM NAME = "anexosID" VALUE ="">
    <PARAM NAME = "subanexosID" VALUE ="">
    <PARAM NAME = "companyID" VALUE ="">
    <PARAM NAME = "resultURL" VALUE ="">
    <param name="debug" value="true">


Java 1.4 or higher plugin required.
</APPLET>

The value of the postURL parameter is a URL that can be parsed without exceptions, therefore the problem is somewhere else. postURL参数的值是可以无例外地解析的URL,因此问题出在其他地方。 What you can do: 你可以做什么:

  • Experiment with various applet parameters 试验各种applet参数
  • Ask for support from the developers of the applet 向小程序的开发者寻求支持
  • If you don't have the source code of the applet, you can probably still decompile it, and find out how it works: Where can I find a Java decompiler? 如果您没有该applet的源代码,则可能仍可以对其进行反编译,并了解其工作方式: 在哪里可以找到Java反编译器?

The following program shows only that the postURL value is OK for Java: 以下程序仅显示postURL值对于Java是可以的:

public class A {
    public static void main(String[] args) throws MalformedURLException {
        String s = "http://xxx.ccc.local/upload/up.php?aa=0&bb=Alvar%E1%2Ffg&cc=1028&from=documentos";

        URL url = new URL(s);
        String protocol = url.getProtocol();
        System.out.println(String.format("A::main: protocol = '%s'", protocol));
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM