簡體   English   中英

Spring MVC 3.2 Jackson錯誤請求

[英]Spring MVC 3.2 Jackson Bad Request

我從Spring 3.1遷移到Spring 3.2.5。 遷移到Spring 3.2.5之前,當我更新庫時,一切似乎都無法正常工作,我的一些其余調用返回了400 Bad Request。

這是方法

    @RequestMapping(value = AJAX_SEARCH_MED)
    @ResponseBody
    DataTablesAjaxResponse<ActiveMedicationView> ajaxSearchActiveMedication(
            @PathVariable(PATH_PIN) String pin,
            @RequestBody DataTablesAjaxRequest request);

我已經為此配置了mvc:annotation

<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
    <!-- Turn off working out content type based on URL file extension, should fall back to looking at the Accept headers -->
    <property name="favorPathExtension" value="false" />
</bean>

在我的pom中。 我有這個傑克遜編組圖書館

  <dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-mapper-asl</artifactId>
    <version>1.9.10</version>
  </dependency>

但是,從數據表進行調用時,我總是收到一個錯誤的請求。

在此處輸入圖片說明

調用方法的代碼

$('#prescriptionsTable').dataTable({
        "bProcessing":true,
        "bServerSide":true,
        "bFilter":false,
        "sAjaxSource":"/cms/ajax/patient/2012010000000009/active-medication.html",
        "aoColumnDefs":[ //Other configurations here

試試這個配置:

    @RequestMapping(value = AJAX_SEARCH_MED, method = RequestMethod.GET, headers="Content-Type=application/json")
        @ResponseBody
        public DataTablesAjaxResponse<ActiveMedicationView> ajaxSearchActiveMedication(
                @PathVariable(PATH_PIN) String pin,
                @RequestBody DataTablesAjaxRequest request)
{
// random code
};

如果仍不能解決問題,我們可以嘗試進一步挖掘以找出問題所在。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM