2017-04-10 16 views
0

我有一個名爲applicationPath:/網絡,和/網頁後,我想用一個類,每放,刪除後,在代碼更新方法是這樣的:@Path(「/ *」)可用於什麼工作?

@ApplicationPath("/web") 
public class If3WebApplication extends Application { 

} 

而且在這個類我想處理所有的HTTP方法:

@Path("/*") //this is not working... 
public class OAuthToken{ 
private HashMap<String, String> endpointMap = new LinkedHashMap<>(); 
@PostConstruct 
public void init(){ 
    endpointMap.put("token", "/token"); // hre will be all urls 
} 

@POST 
@Consumes("application/x-www-form-urlencoded") 
@Produces("text/plain") 
public void get(){ 
    ..... 
} 

所以我想給OAuthToken處理所有POST方法來至極TTO /網頁/ URL和POST方法......但@Path(「/ *」)不工作......做魔術的最好方法是什麼?感謝幫助!

回答

2

您可以嘗試使用澤西表達如下

@Path("{any: .*}")

+0

是那什麼,我需要:)香港專業教育學院嘗試過的/.* – kodaek99

相關問題