You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Lulseged Zerfu <zl...@hotmail.com> on 2014/09/03 11:03:37 UTC

Encoding request URI

Hi
I have a problem sending UTF-8 encoded request URI to tomcat. I am always getting Bad request from tomcat.
Charset is set to UTF-8 in the request. My connectors in server.xml have URIEncoding="UTF-8" set.
I am using tomcat 8.0.11 on windows x64.
I would appreciate any help.
BRLulseged 		 	   		  

Re: Encoding request URI

Posted by Daniel Mikusa <dm...@pivotal.io>.
On Thu, Sep 4, 2014 at 2:00 AM, Lulseged Zerfu <zl...@hotmail.com>
wrote:

> Hi
> Hope it will format this time.
> I am not using any web browser to execute requests. I do use latest http
> client component from apache.
> My request URI contains characters that are not allowed in a URI. Some
> examples are[]"space .etc
>

If they are not allowed then you must url encode them.

   http://tools.ietf.org/html/rfc3986#section-2.1

I believe commons HTTP client can help with this.


> Therefore I send UTF-8 encoded request URI and it fails.


As it should.  UTF-8 is not going to help here, it has a different purpose.

Dan


> But if I ONLY encode not allowed characters, it works fine.
> Then I have to decode when processing the request inside a servlet.
> The problem with this approach is that I only encode some characters. This
> will not work one day I get another unallowed character that's not on my
> list.
> My request looks like:
> /mtasxdms/
> simservs.ngn.etsi.org/users/sip:abc@vodafon.com/simservs.xml/~~/simservs/communication-diversion/NoReplyTimer/simservs/communication-diversion/cp:ruleset/cp:rule[@id="cfnrc"]/cp:conditions/mmt-serv:valid-periods/mmt-serv:valid-days/mmt-serv:day?xmlns(cp=urn:ietf:params:xml:ns:common-policy)
> xmlns(mmt-serv=http://schemas.vodafon.com/mmtel/services)
>
> BRLulseged
>
> > Date: Wed, 3 Sep 2014 10:09:48 +0100
> > From: markt@apache.org
> > To: dev@tomcat.apache.org
> > Subject: Re: Encoding request URI
> >
> > On 03/09/2014 10:03, Lulseged Zerfu wrote:
> > > Hi
> > > I have a problem sending UTF-8 encoded request URI to tomcat. I am
> always getting Bad request from tomcat.
> > > Charset is set to UTF-8 in the request. My connectors in server.xml
> have URIEncoding="UTF-8" set.
> > > I am using tomcat 8.0.11 on windows x64.
> > > I would appreciate any help.
> >
> > Read this:
> > http://www.catb.org/esr/faqs/smart-questions.html
> >
> > Then post to the users mailing list.
> >
> > Mark
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: dev-help@tomcat.apache.org
> >
>

RE: Encoding request URI

Posted by Lulseged Zerfu <zl...@hotmail.com>.
Hi
Hope it will format this time.
I am not using any web browser to execute requests. I do use latest http client component from apache.
My request URI contains characters that are not allowed in a URI. Some examples are[]"space .etc
Therefore I send UTF-8 encoded request URI and it fails. But if I ONLY encode not allowed characters, it works fine.
Then I have to decode when processing the request inside a servlet.
The problem with this approach is that I only encode some characters. This will not work one day I get another unallowed character that's not on my list.
My request looks like:
/mtasxdms/simservs.ngn.etsi.org/users/sip:abc@vodafon.com/simservs.xml/~~/simservs/communication-diversion/NoReplyTimer/simservs/communication-diversion/cp:ruleset/cp:rule[@id="cfnrc"]/cp:conditions/mmt-serv:valid-periods/mmt-serv:valid-days/mmt-serv:day?xmlns(cp=urn:ietf:params:xml:ns:common-policy) xmlns(mmt-serv=http://schemas.vodafon.com/mmtel/services)

BRLulseged

> Date: Wed, 3 Sep 2014 10:09:48 +0100
> From: markt@apache.org
> To: dev@tomcat.apache.org
> Subject: Re: Encoding request URI
> 
> On 03/09/2014 10:03, Lulseged Zerfu wrote:
> > Hi
> > I have a problem sending UTF-8 encoded request URI to tomcat. I am always getting Bad request from tomcat.
> > Charset is set to UTF-8 in the request. My connectors in server.xml have URIEncoding="UTF-8" set.
> > I am using tomcat 8.0.11 on windows x64.
> > I would appreciate any help.
> 
> Read this:
> http://www.catb.org/esr/faqs/smart-questions.html
> 
> Then post to the users mailing list.
> 
> Mark
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 
 		 	   		  

Re: Encoding request URI

Posted by Mark Thomas <ma...@apache.org>.
On 03/09/2014 10:03, Lulseged Zerfu wrote:
> Hi
> I have a problem sending UTF-8 encoded request URI to tomcat. I am always getting Bad request from tomcat.
> Charset is set to UTF-8 in the request. My connectors in server.xml have URIEncoding="UTF-8" set.
> I am using tomcat 8.0.11 on windows x64.
> I would appreciate any help.

Read this:
http://www.catb.org/esr/faqs/smart-questions.html

Then post to the users mailing list.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org