Passing a String with slashes, hyphens using _at_Path, @PathParameter/@QueryParameter

From: Rameswara Sashi Kiran Challa <>
Date: Mon, 22 Feb 2010 17:40:43 -0500

Hello All,

I am new to JAX-RS and I am trying to use Jersey to build a simple RESTful

I have 2 questions. Please clarify these:


   I am trying to have my simple webservice like this URL

   The InChIName is a string like this
   5H,1H3,(H,11,12). How do I pass this as a @PathParam, I mean a normal
   String is working fine but here there are slashes,hyphens, and commas. How
   do I make it to ignore these. I tried putting it in quotes, but that didnt
   work. How should I do this?

          I got this working using @Context UriInfo and
getQueryparamaeters() method. But if I use that my URL should have a '?=' to
take in the InChIname. I do not want to have "?=" in my URL structure.

          Please correct me if I am thinking wrong.


   I need to pass that InChI to another webservice and that returns an XML
   as an output and I want to display that XML output as my Webservice's
   output. If I have @Produces("application/xml") will it work?

This is my code:

public class InChIto3D {
    public String get3DCoordinates(@PathParam("inchiname")String inchiName) {
        String ne="";
            URL eutilsurl = new URL(

                      + "db=pccompound&term=%22"+inchiName+"%22[inchi]");
            BufferedReader in = new BufferedReader(
            String inputline;
            while ((inputline=in.readLine())!=null)
        }catch (MalformedURLException e1) {
        }catch (IOException e2){
        return ne;

Thanks in advance


Sashikiran Challa
MS Cheminformatics,
School of Informatics and Computing,
Indiana University, Bloomington,IN