URL ending with /% using play framework 2.2.1

87 views
Skip to first unread message

minesh chopra

unread,
Feb 20, 2015, 7:20:17 AM2/20/15
to play-fr...@googlegroups.com
Hello team,

We are using the Play framework version 2.2.1. When we append '/%' to the URL, we get Unexpected Exception - URISyntaxException: Malformed escape pair at index 1: /%
For eg: if our URL is www.test.com it works fine. If we append /% ie www.test.com/%, it gives the above mentioned exception on the page.

We have to display page not found exception or any other error message like page not exists.

Also, we are not getting any error on console/logger.

Kindly do revert asap.

Thanks in advance.

Regards,
Minesh Chopra

Mirco Dotta

unread,
Feb 25, 2015, 7:19:32 AM2/25/15
to play-fr...@googlegroups.com
Have you tried overriding GlobalSettings.onBadRequest?

Cheers,
Mirco
----------------
Mirco Dotta - @mircodotta

Typesafe – Build reactive apps!

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

minesh chopra

unread,
Feb 25, 2015, 8:02:56 AM2/25/15
to play-fr...@googlegroups.com
Yes i have tried that. This function is not called when i enter the URL ending with /%.

Mirco Dotta

unread,
Feb 25, 2015, 8:16:32 AM2/25/15
to play-fr...@googlegroups.com
Funny. I’ve tested this using the on development Play master branch and `GlobalSettings.onBadRequest` does get called.

— Mirco

----------------
Mirco Dotta - @mircodotta

Typesafe – Build reactive apps!

minesh chopra

unread,
Feb 25, 2015, 11:45:24 PM2/25/15
to play-fr...@googlegroups.com
Hello Mirco,

Thanks for all your time and efforts.
I have created a Global class which extends play.GlobalSettings
Inside this class i have a method
@Override
public Promise<SimpleResult> onBadRequest(RequestHeader arg0, String arg1) {
System.out.println("onBadRequest :: ");
return Promise.<SimpleResult> pure(Results.ok(invalidURL.render(SessionElements.getLang())));
}

When i hit the URL www.test.com/%, print statment is not logged.

Kindly do let me know in case i am doing something wrong.

Thanks and regards,
Minesh

Mirco Dotta

unread,
Feb 26, 2015, 4:10:25 AM2/26/15
to play-fr...@googlegroups.com
Hey Minesh,

You aren’t doing anything wrong. Sorry if my last answer made you feel that way; it was not my intention.

Your code looks good. Because I couldn’t reproduce the issue you described with a Scala Play app using Play 2.4-SNAPSHOT, 
there must have been a commit fixing this issue between the time of the release you are using (2.2.1, if I’m not mistaken), and 
the current Play master.

If you have time, you could try to create a sample Play app that uses the latest stable Play release (2.3.8), and see if you can 
reproduce the problem. The rationale being that you could consider upgrading to Play 2.3.8 if things work as expected.

Cheers,
Mirco
----------------
Mirco Dotta - @mircodotta

Typesafe – Build reactive apps!

minesh chopra

unread,
Feb 26, 2015, 4:21:36 AM2/26/15
to play-fr...@googlegroups.com
Hello Mirco,

I didnt feel wrong in anything. As I am new to play framework, I thought I might have created global file in a wrong way so was asking about being wrong.
The thing is I have to fix this on 2.2.1 version only as the entire application is already developed on this version on play and changing the version is not possible.

Thanks alot for your time and efforts. I am thankful to you for this.

Regards,
Minesh

minesh chopra

unread,
Feb 26, 2015, 5:36:52 AM2/26/15
to play-fr...@googlegroups.com
Hello Mirco,

Do you have any idea why this is not working on 2.2.1 version?
Or how can we make this work for 2.2.1 version?

Regards,
Minesh
Reply all
Reply to author
Forward
0 new messages