English 中文(简体)
Url作为死灰复燃的直径,造成不实要求
原标题:Url as path parameter in restful api causes bad request

We are developing a restful api using jersey (1.9.1) and tomcat 5.5. A given resource is identified with a urn and we would like to address a specific instance of that resource. In order to achieve this, we used the following code:

@Path("/XXXs")
public interface XXXResource {
    @GET
    @Path("{id}")
    @Produces({ MediaType.APPLICATION_JSON })
    XXXInfo getXXX(@PathParam("id") String id);
}

目的是利用以下简称处理这一资源:

The decoded path param value should be: http://ns.something.com/XXX/2

然而,当我使用加密机提出申请时,我从目录上获得了不实的要求信息。 因此,我的问题是:

  • Is it correct to use a Urn as a path parameter?
  • Why is tomcat considering this request as a bad request?

就在这样的情况下,我改变了方法的签字,以便参数从胎盘中提取,并且是有效的,但我想参数是路上的一部分。

感谢。

最佳回答

奥基,我通过在卡塔里纳增加以下线,解决了这一问题。 财产:

org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true

问题回答

暂无回答




相关问题
Allow RESTful DELETE method in asp.net mvc?

im currently setting up asp.net to accept DELETE http verb in the application. However, when i send "DELETE /posts/delete/1" i always get a 405 Method not allow error. I tried to take a look at ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

Use HTTPClient or HttpUrlConnection? [closed]

We re implementing a REST client on JRE 1.4. Seems two good options for a client REST framework are HttpClient and HttpUrlConnection. Is there a reason to use HttpClient over the JRE s ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Three Step Buyonline The RESTful way

We are re-developing our buyonline functionality and we are doing it the RESTful way. The process is a three step one and the customer is asked to enter data at each step. Let s say the three URL s ...

热门标签