Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
转义分号路由playframework 2.0.2_Playframework_Routes_Playframework 2.0_Uri - Fatal编程技术网

转义分号路由playframework 2.0.2

转义分号路由playframework 2.0.2,playframework,routes,playframework-2.0,uri,Playframework,Routes,Playframework 2.0,Uri,我想用playframework做一个重定向函数。到目前为止,我的路线上都有这个 GET /redirect com.test.redirect(redirecturl: String?="") 和我的控制器: public static Result redirect(String redirecturl) { return redirect(redirectURL); } 这很好,但当我传递包含分号的url时,我遇到了一个问题” 如果我去 http

我想用playframework做一个重定向函数。到目前为止,我的路线上都有这个

GET     /redirect            com.test.redirect(redirecturl: String?="")
和我的控制器:

public static Result redirect(String redirecturl) { 
   return redirect(redirectURL); 
}
这很好,但当我传递包含分号的url时,我遇到了一个问题”

如果我去

http:localhost:9000/重定向?重定向URL=http://www.google.com;TestAfter分号

它将我重定向到google.com,但在我的日志中,重定向URL仅等于“”在分号后停止


有办法逃脱吗?或者在播放中执行自定义路由?

您应该能够通过在路由文件中使用自定义正则表达式来转义它。这在中进行了描述。 基本上,类似以下的方法应该可以工作:

GET     /redirect/$url<.+>            com.test.redirect(url: String?="")
GET/redirect/$url com.test.redirect(url:String?=“”)

您应该能够使用routes文件中的自定义正则表达式对其进行转义。这在中进行了描述。 基本上,类似以下的方法应该可以工作:

GET     /redirect/$url<.+>            com.test.redirect(url: String?="")
GET/redirect/$url com.test.redirect(url:String?=“”)