/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author mufi
 */
public class StringUtil {

    public static String getRequestAsString(HttpServletRequest request)
            throws java.io.IOException {

        BufferedReader requestData = new BufferedReader(
                new InputStreamReader(request.getInputStream(),"UTF-8"));
        StringBuffer stringBuffer = new StringBuffer();
        String line;

        try {
            while ((line = requestData.readLine()) != null) {
                stringBuffer.append(line);
            }
        } catch (Exception e) {
        }
        return stringBuffer.toString();

    }

}
