English 中文(简体)
采用春天3月3日请求修改说明的“URL的最佳”
原标题:Match the "Rest of the URL" using Spring 3 RequestMapping Annotation [duplicate]
This question already has answers here:
Closed 10 years ago.

Possible Duplicate:
Spring 3 RequestMapping: Get path value

在春天,有办法在下述URL中捕获rest/of/the/url:

/myapp/foo/bar/rest/of/the/url

采用@Request • 绘制这方面的说明:

@RequestMapping(value="{appname}/{path1}/{path2}/{remainder}")
public String myRequestMethod(
    @PathVariable("appname") String appName, 
    PathVariable("path1") String path1, 
    PathVariable("path2") String path2,
    PathVariable("remainder") String remainder)

我谨请求这样做。

{appname}   -> myapp
{path1}     -> foo
{path2}     -> bar
{remainder} -> rest/of/the/url 

http://static.childrensource.org/children/docs/3.0.x/javadoc-api/org/childrenframework/web/bind/annotation/RequestMapping.html 请求 地图上有一个关于使用另一种定期表述的说明:

否则,URI模板将与经常表述[签字]相匹配。 (即除期限外的任何特性),但可以通过具体说明另一种定期表述加以改变:旅馆/旅馆:d+}

但是,当我使用类似请求时(我收到404份):情况并非如此。

@RequestMapping(value="{appname}/{path1}/{path2}/{remainder:.[\S]*}")

Does anyone know how to match the rest of an URL with a Spring RequestMapping?

问题回答

ny: 我刚才谈到也需要这样做。 这里我是如何解决的:

@RequestMapping(value = {"/someChildUrlIfYouWant/**"}

<代码>**” 如果你想走这条道路,那么你可以使用:

request.getAttribute( HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE )

页: 1 因此,如果你只是想走可变的儿童道路,那么你就不得不把扼杀的前面部分放在一边。

是否有意义?

上文试图:

@RequestMapping(value="{appname}/{path1}/{path2}/{remainder:.+}")

春季的缺席行为是为了停止对等。 尿液中不很直观。 我认为,时间性在道路上没有任何特别意义(而不是说/、或......)。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签