org.wso2.balana.ctx
Class ResponseCtx

java.lang.Object
  extended by org.wso2.balana.ctx.ResponseCtx

public class ResponseCtx
extends Object

Represents the response to a request made to the XACML PDP.

Since:
1.0
Author:
Seth Proctor, Marco Barreno

Constructor Summary
ResponseCtx(AbstractResult result)
          Constructor that creates a new ResponseCtx with only a single Result (a common case).
ResponseCtx(Set<AbstractResult> results, int version)
          Constructor that creates a new ResponseCtx with a Set of Results.
 
Method Summary
 String encode()
          Encodes this ResponseCtx into its XML form
 void encode(StringBuilder builder)
          Encodes this ResponseCtx into its XML form and writes this out to the provided StringBuilder
static ResponseCtx getInstance(Node root)
          Creates a new instance of ResponseCtx based on the given DOM root node.
static ResponseCtx getInstance(Node root, int version)
          Creates a new instance of ResponseCtx based on the given DOM root node.
 Set<AbstractResult> getResults()
          Get the set of Results from this response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseCtx

public ResponseCtx(AbstractResult result)
Constructor that creates a new ResponseCtx with only a single Result (a common case).

Parameters:
result - the single result in the response

ResponseCtx

public ResponseCtx(Set<AbstractResult> results,
                   int version)
Constructor that creates a new ResponseCtx with a Set of Results. The Set must be non-empty.

Parameters:
results - a Set of Result objects
version - XACML version
Method Detail

getInstance

public static ResponseCtx getInstance(Node root)
                               throws ParsingException
Creates a new instance of ResponseCtx based on the given DOM root node. A ParsingException is thrown if the DOM root doesn't represent a valid ResponseType.

Parameters:
root - the DOM root of a ResponseType
Returns:
a new ResponseCtx
Throws:
ParsingException - if the node is invalid

getInstance

public static ResponseCtx getInstance(Node root,
                                      int version)
                               throws ParsingException
Creates a new instance of ResponseCtx based on the given DOM root node. A ParsingException is thrown if the DOM root doesn't represent a valid ResponseType.

Parameters:
root - the DOM root of a ResponseType
version - XACML version
Returns:
a new ResponseCtx
Throws:
ParsingException - if the node is invalid

getResults

public Set<AbstractResult> getResults()
Get the set of Results from this response.

Returns:
a Set of results

encode

public String encode()
Encodes this ResponseCtx into its XML form

Returns:
String

encode

public void encode(StringBuilder builder)
Encodes this ResponseCtx into its XML form and writes this out to the provided StringBuilder

Parameters:
builder - string stream into which the XML-encoded data is written


Copyright © 2015 WSO2. All rights reserved.