title: Jersey REST And PathParam Regular Expressions
body: <p>I'm trying to use Jersey to develop a REST web service. My requirement is for me to be able to  access the web service and return data, based on the passed PatParam parameters. My web service so far is as follows:</p>
  
  <pre><code>@GET
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes({ "application/xml", "application/json", "application/x-www-form-urlencoded" })
  @Path("/1.0/people{extension:(.json)*}/{personId:([^/]+?)?}{entityExtension:(.json)*}")
  public String getLocation(@PathParam("extension") String extension, @PathParam("personId") String personId,@PathParam("entityExtension") String entityExtension)
  {
      if ((personId==null ||personId.equals("")) &amp;&amp; (extension == null || extension.equals("")))
          return "No Id, and no extension";
      else
          return "personId= "+personId + ", extension= " + extension+", entityExtension= "+entityExtension;
  }
  </code></pre>
  
  <p>With the above code in mind, what I'm trying to achieve is the following:</p>
  
  <pre><code>http://localhost:8080/Jersey/RestService/1.0/people.json
  </code></pre>
  
  <p>Should return the list of all people in the "json" format (Hence the .json extension)</p>
  
  <p>Now, I want to be able to get the information for a particular person by simply putting the person's ID, and return the person's information in json/xml based on the extension:</p>
  
  <pre><code>http://localhost:8080/Jersey/RestService/1.0/people/Mouhammed89.json
  </code></pre>
  
  <p>With the above URL, I should be returning the information for the personId: Mouhammed89, and returning the information in the json format.</p>
  
  <p>I know that my problem is with the regular expressions that I'm using, so I would really appreciate the help in creating them.</p>