GWT - 提取两个字符之间的文本

GWT - extract text in between two characters

在 GWT 中,我有一个 servlet,它 return 是从数据库到客户端的图像。我需要提取部分字符串才能正确显示图像。 return在chrome、firefox、IE中的src部分有斜线。例如:String s = "src=\""; 这在下面的字符串中不可见。可能是斜线在 http 字符串周围添加了更多括号。我不确定?

  what is returned in those 3 browsers is = <img style="-webkit-user-select: none;" src="http://localhost:8080/dashboardmanager/downloadfile?entityId=4886">

EDGE 浏览器在 src 中没有斜线,所以我提取图像的方法在 edge 中不起作用

什么边returns:

String edge = "<img src=”http://localhost:8080/dashboardmanager/downloadfile?entityId=4886”>";

问题:我需要提取下面的字符串。

http://localhost:8080/dashboardmanager/downloadfile?entityId=4886

使用 src= 或 src=\

我尝试并使用 return 没有括号 "src=\":

的浏览器
String s = "src=\"";
int index = returned.indexOf(s) + s.length();
image.setUrl(returned.substring(index, returned.indexOf("\"", index + 1)));

但在 EDGE 中无法工作,因为它没有 return 斜线

我无权访问 GWT 中的模式和匹配器。

我如何提取并记住 entityId 编号会发生变化 http://localhost:8080/dashboardmanager/downloadfile?entityId=4886

上面的 returned 字符串中是什么?

编辑:

我需要一种通用的方法来提取 http://localhost:8080/dashboardmanager/downloadfile?entityId=4886

当字符串在两个方面都可能看起来像这样时。

String edge = "<img src=”http://localhost:8080/dashboardmanager/downloadfile?entityId=4886”>";

3 browsers is = <img style="-webkit-user-select: none;" src="http://localhost:8080/dashboardmanager/downloadfile?entityId=4886">
    public static void main(String[] args) {
        String toParse = "<img style=\"-webkit-user-select: none;\" src=\"http://localhost:8080/dashboardmanager/downloadfile?entityId=4886\">";    
        String delimiter = "src=\"";
        int index = toParse.indexOf(delimiter) + delimiter.length();
        System.out.println(toParse.substring(index, toParse.length()).split("\"")[0]);      
    }