Example usage for javax.servlet.http HttpServletRequest toString

List of usage examples for javax.servlet.http HttpServletRequest toString

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:uk.ac.ebi.phenotype.web.controller.GenesController.java

/**
 * Prints out the request object//from w  ww  .j a v  a2 s.c  o m
 */
@RequestMapping("/genes/print-request")
public ResponseEntity<String> printRequest(HttpServletRequest request) {

    Enumeration<String> s = request.getHeaderNames();

    while (s.hasMoreElements()) {
        String header = (String) s.nextElement();
        Enumeration<String> headers = request.getHeaders(header);

        while (headers.hasMoreElements()) {
            String actualHeader = (String) headers.nextElement();
        }
    }

    HttpHeaders resp = new HttpHeaders();
    resp.setContentType(MediaType.APPLICATION_JSON);

    return new ResponseEntity<String>(request.toString(), resp, HttpStatus.CREATED);
}