Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8375615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:13:22+00:00 2026-06-09T15:13:22+00:00

I have a RESTlet application embedded in a Tomcat server and clients are complaining

  • 0

I have a RESTlet application embedded in a Tomcat server and clients are complaining that % symbols in @FormParm parameters are doubly decoded in the RESTlet framework causing a server error 500.

My questions are:
Do the clients need to doubly encode percent symbols (e.g. send xx%2525xx to represent the five character sequence “xx%xx”)?
If so, is this a bug in the RESTlet framework or the common way of encoding form parameters?
If not, how am I misusing the RESTlet framework?

My API looks like

//... many imports omitted.
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.HttpHeaders;

@Path("/{session}/foo/")
@Transactional(propagation = Propagation.REQUIRED)

 /**  ........
  */
public class DocumentService extends BaseService {
// ...
     */
  @POST
  @Path("/{path:.*}/")
  @Consumes({"application/x-www-form-urlencoded"})
  @Produces({"application/json"})
  public Response alterDocument(final @Context UriInfo ui, 
    final @Context HttpHeaders hh,
    final @PathParam("session") String sessionToken,
    final @PathParam("path") String path,
    @FormParam("name") String name) throws WebApplicationException {
      /// code here not reached on call described below ....
    }

A curl command like:

curl -H “Accept: application/json” -d “name=100%25+working” http://${host}/api/sessionx21/foo/home/

Generates a server-side stack trace that looks like:

Apr 2, 2012 5:15:20 PM org.restlet.ext.jaxrs.internal.util.ExceptionHandler methodInvokeException
WARNING: Can not invoke the resource method
java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern – For input string: ” w”
   at java.net.URLDecoder.decode(URLDecoder.java:173)
   at org.restlet.data.Reference.decode(Reference.java:170)
   at org.restlet.data.Reference.decode(Reference.java:143)
   at org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList$AbstractParamGetter.convertParamValue(ParameterList.java:186)
   at org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList$AbstractParamGetter.convertParamValue(ParameterList.java:166)
   at org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList$FormOrQueryParamGetter.getParamValue(ParameterList.java:529)
   at org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList$FormParamGetter.getParamValue(ParameterList.java:561)
   at org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList$AbstractParamGetter.getValue(ParameterList.java:409)
   at org.restlet.ext.jaxrs.internal.wrappers.params.ParameterList.get(ParameterList.java:1096)
   at org.restlet.ext.jaxrs.internal.wrappers.AbstractMethodWrapper.internalInvoke(AbstractMethodWrapper.java:166)

My pom.xml file contains

    <repository>
      <id>maven-restlet</id>
      <name>Public online Restlet repository</name>
      <url>http://maven.restlet.org</url>
    </repository>
....
       <jaxb.version>2.1</jaxb.version>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:13:23+00:00Added an answer on June 9, 2026 at 3:13 pm

    I know this question posted long time ago, but maybe someone will still find it useful.
    I had the same problem today.

    After digging the restlet code – it seems like there is a bug of url-decoding the parameters twice.
    Workaround for this is to annotate the method with @Encoded. This annotation mark not to decode the paramaters, so it will only be decoded once.

    @POST
    @Path("/{path:.*}/")
    @Encoded
    @Consumes({"application/x-www-form-urlencoded"})
    @Produces({"application/json"})
    public Response alterDocument(final @Context UriInfo ui, 
      final @Context HttpHeaders hh,
      final @PathParam("session") String sessionToken,
      final @PathParam("path") String path,
      @FormParam("name") String name) throws WebApplicationException {
        /// code here not reached on call described below ....
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Restlet Service that looks like this: @POST @Produces(application/json) public String processImmediately(String
I have figured out that to integrate calls between Apache HTTP server and Restlet,
I have deployed our Restlet services to a Jetty Java Application server using the
Using Restlet I have created a router for my Java application. From using curl,
I have my Apache http server running on localhost:80 and restlet server on localhost:8182,
We have a restlet server and client. We need to pass the error status
i've started to introduce myself into REST. I use as REST-framework Restlet. I have
In my program, I have a web application that creates a PNG image. This
I have a Restlet API and a GWT web application in two seperate web
We have a small app with Restlet on the GAE server and GWT and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.