X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fext%2Fedu%2Fucsf%2Frbvi%2Fstrucviz2%2FChimeraManager.java;fp=src%2Fext%2Fedu%2Fucsf%2Frbvi%2Fstrucviz2%2FChimeraManager.java;h=812bfea63fe5ed739cde0e2ff7730ea628abccc5;hb=882a6c7044693a72c20f336f26e87a5fcf30fe5b;hp=d7e7937930c50263b6ff9f30ef022ca80171267c;hpb=41129d3894c16b009f58d6ad81848b82315b0025;p=jalview.git diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java index d7e7937..812bfea 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java @@ -38,6 +38,9 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; @@ -363,7 +366,7 @@ public class ChimeraManager * Select something in Chimera * * @param command - * the selection command to pass to Chimera + * the selection command to pass to Chimera */ public void select(String command) { @@ -509,8 +512,8 @@ public class ChimeraManager /** * Return the list of depiction presets available from within Chimera. Chimera - * will return the list as a series of lines with the format: Preset type - * number "description" + * will return the list as a series of lines with the format: Preset type number + * "description" * * @return list of presets */ @@ -551,9 +554,9 @@ public class ChimeraManager } /** - * Launch Chimera, unless an instance linked to this object is already - * running. Returns true if chimera is successfully launched, or already - * running, else false. + * Launch Chimera, unless an instance linked to this object is already running. + * Returns true if chimera is successfully launched, or already running, else + * false. * * @param chimeraPaths * @return @@ -696,7 +699,7 @@ public class ChimeraManager * Determine the color that Chimera is using for this model. * * @param model - * the ChimeraModel we want to get the Color for + * the ChimeraModel we want to get the Color for * @return the default model Color for this model in Chimera */ public Color getModelColor(ChimeraModel model) @@ -713,11 +716,11 @@ public class ChimeraManager /** * * Get information about the residues associated with a model. This uses the - * Chimera listr command. We don't return the resulting residues, but we add - * the residues to the model. + * Chimera listr command. We don't return the resulting residues, but we add the + * residues to the model. * * @param model - * the ChimeraModel to get residue information for + * the ChimeraModel to get residue information for * */ public void addResidues(ChimeraModel model) @@ -809,10 +812,10 @@ public class ChimeraManager * Send a command to Chimera. * * @param command - * Command string to be send. + * Command string to be send. * @param reply - * Flag indicating whether the method should return the reply from - * Chimera or not. + * Flag indicating whether the method should return the reply + * from Chimera or not. * @return List of Strings corresponding to the lines in the Chimera reply or * null. */ @@ -833,7 +836,7 @@ public class ChimeraManager */ int waited = 0; int pause = 25; - while (busy && waited < 1001) + while (busy && waited < 1001) { try { @@ -876,8 +879,16 @@ public class ChimeraManager String method = getHttpRequestMethod(); if ("GET".equals(method)) { - command = command.replace(" ", "+").replace("#", "%23") - .replace("|", "%7C").replace(";", "%3B"); + try + { + command = URLEncoder.encode(command, + StandardCharsets.UTF_8.toString()); + } catch (UnsupportedEncodingException e) + { + command = command.replace(" ", "+").replace("#", "%23") + .replace("|", "%7C").replace(";", "%3B") + .replace(":", "%3A"); + } } commands.add(new BasicNameValuePair("command", command));