2013-11-20 63 views
0

我們寫了一個服務控制器,用於春季這就好比是提供休息服務---休息服務無法正常工作在JBoss EAP 6.0

@Controller 
public class ServicesController { 
    //first service 
    @ResponseBody 
    @RequestMapping(value = "/emailDomainValidate", method = RequestMethod.POST, headers = { jsonContentType }) 
    public List<String> emailDomailValidate(@RequestBody EmailDomainValidateVO emailDomainValidate) { 
     List<String> errorCodes = getEmailDomainValidationService().emailDomainValidation(
     emailDomainValidate); 
    } 

    //second service 
    @ResponseBody 
    @RequestMapping(value = "/changePassword", method = RequestMethod.POST, headers = { jsonContentType }) 
    public List<String> changePassword(@RequestBody ChangePasswordVO changePasswordVO) { 
     List<String> passwords = getChangePasswordFacade().changePassword(changePasswordVO); 

    } 

} 

在web.xml中,我們提供了

<servlet-mapping> 
    <servlet-name>dispatcher</servlet-name> 
    <url-pattern>/service/*</url-pattern> 
</servlet-mapping> 

當我們通過發出休息電話訪問其中一項服務時---- http://「url」:8080/service/emailDomainValidate ---這是工作

但是當我們訪問其他服務時 h TTP:// 「網址」:8080 /服務/ changePassword ---這是不工作,並給了我們400 HTTP錯誤代碼

我們已經執行了到目前爲止的步驟是----

  1. 刪除服務器的臨時目錄。
  2. 調動
  3. 改變輸入VO級的服務,這是不工作---- ChangePasswordVO

請讓我這是爲什麼時提供的所有其他服務工作

仍無法正常工作非常感謝

回答

0

嘗試向控制器添加映射,然後將映射添加到您的方法。這是爲我工作至少:

@Controller 
@RequestMapping('/rest') 
public class ServicesController { 

    private static final Log log = LogFactory.getLog(ExampleRestController.class); 

    @ResponseBody 
    @RequestMapping(value = "/emailDomainValidate", method = RequestMethod.POST, headers = { jsonContentType }) 
    public List<String> emailDomailValidate(@RequestBody EmailDomainValidateVO emailDomainValidate) { 
     if(log.isDebugEnabled()) log.debug('emailDomainValidate hit'); 
     List<String> errorCodes = getEmailDomainValidationService().emailDomainValidation(emailDomainValidate); 
    } 

    //second service 
    @ResponseBody 
    @RequestMapping(value = "/changePassword", method = RequestMethod.POST, headers = { jsonContentType }) 
    public List<String> changePassword(@RequestBody ChangePasswordVO changePasswordVO) { 
     if(log.isDebugEnabled()) log.debug('change password hit'); 

     List<String> passwords = getChangePasswordFacade().changePassword(changePasswordVO); 
    } 

} 

然後你會郵寄到:

http://localhost:8080/service/rest/emailDomainValidate 
http://localhost:8080/service/rest/changePassword 
+0

感謝jyore回答,提到的服務其餘的工作,所以不認爲它必須與問題提供的映射 – Abhi

+0

此問題僅在獨立執行時與Jboss集羣環境一起出現,它的工作原理完美無缺 – Abhi