Results 1 to 3 of 3

Thread: Get data from POST

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Default 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. #2

    Default

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

  3. #3
    Join Date
    Dec 2011
    Posts
    2

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •