Class TemplateContextResponse

java.lang.Object
com.tivoli.am.fim.fedmgr2.page.TemplateContextResponse

public class TemplateContextResponse extends Object
This class is used as a template context response object. Some request context is also included under templateContext.request This includes:
  • HTTP Method
  • Request path
  • Headers
  • Request parameters
  • The query string
  • Constructor Details

    • TemplateContextResponse

      public TemplateContextResponse()
  • Method Details

    • write

      public void write(String message)
      Send content to the output stream
       
       Example 
       
       templateContext.response.body.write("Hello")
       
       A macro can be retrieved and displayed to the output stream
       
       templateContext.macros["@TIMESTAMP@"]
       
       
      Parameters:
      message - message to be displayed
    • setHeader

      public void setHeader(String key, String value)
      Set response header
       
       
       Example
       To set the response header Content-Type
        
       templateContext.response.setHeader("Content-Type","application/json")
       
       
      Parameters:
      key - header key
      value - header value
    • sendRedirect

      public void sendRedirect(String url)
      Set response redirect url
       
       Example 
       To set the response redirect url
       
       templateContext.response.sendRedirect("https://www.ibm.com")
       
       
       
      Parameters:
      url - redirect url
    • setStatus

      public void setStatus(int code)
      Set response status code
       
        
       Example 
       To set the response status code
       
       templateContext.response.setStatus(400)
       
       
      Parameters:
      code - status code