Announcement Announcement Module
Collapse
No announcement yet.
Get data from POST Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get data from POST

    Hello.
    I must get data from POST in the same order as it sent but can not found any way to do this.
    The following code read nothing with reader and read data in wrong order with getParameterNames().
    What I'm doing wrong?
    Code:
        @RequestMapping(value = "/test")
        public ResponseEntity<String> test(HttpServletRequest request) { 	
    
        	System.out.println("Reader:");
        	BufferedReader reader;
    		try {
    			reader = request.getReader();
    	        String line;
    	        do {
    	            line = reader.readLine(); //null here on first iteration
    	            System.out.println(line);
    	        } while (line != null);
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    		
        	System.out.println("Params:");
    	Enumeration<String> requestParamNames = (Enumeration<String>)request.getParameterNames();
        	while (requestParamNames.hasMoreElements()) {
        	  String pName = (String) requestParamNames.nextElement();
        	  String pValue = request.getParameter(pName);
        	  System.out.println(pName + " = " + pValue);
        	}

  • #2
    Hi Artswan,
    which kind of data are you trying to get via post? A full object?

    Comment


    • #3
      Hi, thanks for reply.
      I want to get body from POST query. The data send by Avangate IPN service, it looks like:
      Code:
      SALEDATE: 2011-12-20 15:22:33
      REFNO: 10669036
      REFNOEXT: 
      ORDERNO: 1753
      HASH: 3db451fd5fca5dca33bf03dee614e2c3
      I need to concatenate values and calculate and check the hash that's why I must get it in the same order as it sent.

      Comment

      Working...
      X