I made a Post method in java restful services. When from front end user clicked on button for the first time there will be an error page showing the error message given below and I am getting this error only for the first time. Second time when user click it, it's working fine.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Jan 27 03:51:51 EST 2017 There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not supported
This is my controller file:-
@RequestMapping(value="/classify",method = RequestMethod.POST)
public @ResponseBody
List<List<HashMap<Object,Object>>> doClassify1( HttpServletRequest request,HttpServletResponse resp) {
try
{
System.out.println("Start of Classify");
prop = new Properties() ;
input = StwTagController.class.getClassLoader().getResourceAsStream("application.properties");
prop.load(input) ;
String rdurl = prop.getProperty("plmclassify") ;
String appId = request.getParameter("appId");
String appType = request.getParameter("appType");
String[] objectData = request.getParameterValues("objectData");
parentId = request.getParameter("parentObjectId");
String userId = request.getHeader("sm_ssoid");
obj = stwTagService.doClassify(appId,appType,objectData,parentId,userId );
resp.sendRedirect(rdurl+parentId);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return obj;
}