title: Java Jersey: Receive form parameter as byte array
body: <p>Is it possible to receive form parameter as byte array with Jersey?</p>
  
  <p>I tried the following:</p>
  
  <pre><code>@Path("/someMethod")
  @POST
  @Produces(MediaType.TEXT_HTML)
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  public String someMethod(@FormParam("someParam") byte[] someParam)
  {
      return "";
  }
  </code></pre>
  
  <p>But got this error:</p>
  
  <pre><code>SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
    SEVERE: Missing dependency for method public java.lang.String SomeClass.someMethod(byte[]) at parameter at index 0
    SEVERE: Missing dependency for method public java.lang.String SomeClass.someMethod(byte[]) at parameter at index 0
    SEVERE: Method, public java.lang.String SomeClass.someMethod(byte[]), annotated with POST of resource, class SomeClass, is not recognized as valid resource method.
  </code></pre>
  
  <p>If I change byte[] to String, everything works correctly.</p>
  
  <p>The reason I need to receive data as byte[] and not as String is because data may be encoded using different charsets. It depends on the HTML document that submits data and I need to decode data correctly on server side (encoding charset is submitted in a separate parameter).</p>
  
  <p>So, if I can receive data as byte[], it will solve my problem. Any other solutions are welcome as well.</p>
  
  <p>Thank you!</p>