Class XmlResponseUtil
- java.lang.Object
-
- jetbrains.buildServer.controllers.XmlResponseUtil
-
public class XmlResponseUtil extends Object
Utility class containing a set of useful methods for controllers producing XML responses (in particular for controllers processing AJAX requests).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.jdom.ElementnewXmlResponse()Creates new document with <response/> tag as its root element.static voidwriteErrors(org.jdom.Element xmlResponse, ActionErrors errors)Writes the specified errors into the XML responsestatic voidwriteFormModifiedIfNeeded(org.jdom.Element xmlResponse, StatefulObject state)Adds <modified/> tag to XML response if methodStatefulObject.isStateModified()returns true.static voidwriteRedirect(org.jdom.Element xmlResponse, String url)Adds <redirect/> tag to XML response which will contain the specified url inside.static voidwriteTestResult(org.jdom.Element xmlResponse, String additionalInfo)Adds <testConnectionResult/> tag into the XML response which contains specified additionalInfo parameter inside.static voidwriteXmlResponse(org.jdom.Element xmlResponse, javax.servlet.http.HttpServletResponse response)Serializes the specified xml response to output stream of the HTTP servlet response.
-
-
-
Method Detail
-
newXmlResponse
@NotNull public static org.jdom.Element newXmlResponse()
Creates new document with <response/> tag as its root element.- Returns:
- new document
-
writeXmlResponse
public static void writeXmlResponse(org.jdom.Element xmlResponse, javax.servlet.http.HttpServletResponse response) throws IOExceptionSerializes the specified xml response to output stream of the HTTP servlet response.- Parameters:
xmlResponse- XML document to serializeresponse- HTTP response- Throws:
IOException- if an IO error occurs
-
writeFormModifiedIfNeeded
public static void writeFormModifiedIfNeeded(org.jdom.Element xmlResponse, StatefulObject state)Adds <modified/> tag to XML response if methodStatefulObject.isStateModified()returns true.- Parameters:
xmlResponse- XML responsestate- object which state to check
-
writeRedirect
public static void writeRedirect(@NotNull org.jdom.Element xmlResponse, @NotNull String url)Adds <redirect/> tag to XML response which will contain the specified url inside.- Parameters:
xmlResponse- XML responseurl- an URL
-
writeErrors
public static void writeErrors(org.jdom.Element xmlResponse, ActionErrors errors)Writes the specified errors into the XML response- Parameters:
xmlResponse- XML responseerrors- errors
-
writeTestResult
public static void writeTestResult(org.jdom.Element xmlResponse, String additionalInfo)Adds <testConnectionResult/> tag into the XML response which contains specified additionalInfo parameter inside. TODO: move this method out of web-openapi- Parameters:
xmlResponse- XML responseadditionalInfo- parameter
-
-