Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to determine inbound headers, url, cookies and other http request parts in a jrxml report


    ghudson_1
    • Version: v7 Product: JasperReports® Library

    Issue Description

    In certain cases you want your report to behave conditionally based on the HTTP Request for the report.

     

    Resolution

     

    You can access the application server's java.servlet.http.HttpServletRequest object to lookup information from the request via an expression like this one which calls the getHeader() method on the HttpServletRequest object:

    <textFieldExpression><![CDATA[((javax.servlet.http.HttpServletRequest)$P{REPORT_PARAMETERS_MAP}.get("HTTP_SERVLET_REQUEST")).getHeader("Host")]]></textFieldExpression>

    Review the java Servlet api objects linked below to see syntax for getting Cookies, parts of the url, etc.

    Ref. Case 01867264

    https://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...