Class HtmlResponse


  • @Deprecated
    public class HtmlResponse
    extends java.lang.Object
    Deprecated.
    use org.apache.sling.servlets.post.HtmlResponse instead.
    Generator for a HTML status response that displays the changes made in a post request. see HtmlResponse.html for the format.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PN_CHANGE_LOG
      Deprecated.
      human readable changelog
      static java.lang.String PN_ERROR
      Deprecated.
      The Throwable caught while processing the request.
      static java.lang.String PN_IS_CREATED
      Deprecated.
      Indicating whether request processing created new data.
      static java.lang.String PN_LOCATION
      Deprecated.
      externally mapped location url of the modified path
      static java.lang.String PN_PARENT_LOCATION
      Deprecated.
      externally mapped location url of the parent of the modified path
      static java.lang.String PN_PATH
      Deprecated.
      the path of the modified item.
      static java.lang.String PN_REFERER
      Deprecated.
      the referrer of the request
      static java.lang.String PN_STATUS_CODE
      Deprecated.
      status code.
      static java.lang.String PN_STATUS_MESSAGE
      Deprecated.
      some human readable status message
      static java.lang.String PN_TITLE
      Deprecated.
      some human readable title like: 200 Created /foo/bar
    • Constructor Summary

      Constructors 
      Constructor Description
      HtmlResponse()
      Deprecated.
      Creates a new html response with default settings, which is null for almost all properties except the isCreateRequest() which defaults to false.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.Throwable getError()
      Deprecated.
      Returns any recorded error or null
      java.lang.String getLocation()
      Deprecated.
      Returns the location of the modification.
      java.lang.String getParentLocation()
      Deprecated.
      Returns the parent location of the modification.
      java.lang.String getPath()
      Deprecated.
      Returns the absolute path of the item upon which the request operated.
      java.lang.Object getProperty​(java.lang.String name)
      Deprecated.
      Returns the generic response property with the given name and type or null if no such property exists.
      <Type> Type getProperty​(java.lang.String name, java.lang.Class<Type> type)
      Deprecated.
      Returns the generic response property with the given name and type or null if no such property exists or the property is not of the requested type.
      java.lang.String getReferer()
      Deprecated.
      Returns the referer as from the 'referer' request header.
      int getStatusCode()
      Deprecated.
      Returns the status code of this instance.
      java.lang.String getStatusMessage()
      Deprecated.
      Get the status message
      boolean isCreateRequest()
      Deprecated.
      Returns true if this was a create request.
      boolean isSuccessful()
      Deprecated.
      Returns true if no error is set and if the status code is one of the 2xx codes.
      void onChange​(java.lang.String type, java.lang.String... arguments)
      Deprecated.
      Records a generic change of the given type.
      void onCopied​(java.lang.String srcPath, java.lang.String dstPath)
      Deprecated.
      Records a 'copied' change.
      void onCreated​(java.lang.String path)
      Deprecated.
      Records a 'created' change
      void onDeleted​(java.lang.String path)
      Deprecated.
      Records a 'deleted' change
      void onModified​(java.lang.String path)
      Deprecated.
      Records a 'modified' change
      void onMoved​(java.lang.String srcPath, java.lang.String dstPath)
      Deprecated.
      Records a 'moved' change.
      void send​(HttpServletResponse response, boolean setStatus)
      Deprecated.
      Writes the response to the given writer and replaces all ${var} patterns by the value of the respective property.
      void setCreateRequest​(boolean isCreateRequest)
      Deprecated.
      Sets whether the request was a create request or not.
      void setError​(java.lang.Throwable error)
      Deprecated.
      Set the error
      void setLocation​(java.lang.String location)
      Deprecated.
      Set the location
      void setParentLocation​(java.lang.String parentLocation)
      Deprecated.
      Set the parent location
      void setPath​(java.lang.String path)
      Deprecated.
      Sets the absolute path of the item upon which the request operated.
      void setProperty​(java.lang.String name, java.lang.Object value)
      Deprecated.
      Sets a generic response property with the given
      void setReferer​(java.lang.String referer)
      Deprecated.
      Sets the referer property
      void setStatus​(int code, java.lang.String message)
      Deprecated.
      sets the response status code properties
      void setTitle​(java.lang.String title)
      Deprecated.
      Sets the title of the response message
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PN_TITLE

        public static final java.lang.String PN_TITLE
        Deprecated.
        some human readable title like: 200 Created /foo/bar
        See Also:
        Constant Field Values
      • PN_STATUS_CODE

        public static final java.lang.String PN_STATUS_CODE
        Deprecated.
        status code. more or less http response status codes
        See Also:
        Constant Field Values
      • PN_STATUS_MESSAGE

        public static final java.lang.String PN_STATUS_MESSAGE
        Deprecated.
        some human readable status message
        See Also:
        Constant Field Values
      • PN_LOCATION

        public static final java.lang.String PN_LOCATION
        Deprecated.
        externally mapped location url of the modified path
        See Also:
        Constant Field Values
      • PN_PARENT_LOCATION

        public static final java.lang.String PN_PARENT_LOCATION
        Deprecated.
        externally mapped location url of the parent of the modified path
        See Also:
        Constant Field Values
      • PN_PATH

        public static final java.lang.String PN_PATH
        Deprecated.
        the path of the modified item. this is usually the addressed resource or in case of a creation request (eg: /foo/*) the path of the newly created node.
        See Also:
        Constant Field Values
      • PN_REFERER

        public static final java.lang.String PN_REFERER
        Deprecated.
        the referrer of the request
        See Also:
        Constant Field Values
      • PN_IS_CREATED

        public static final java.lang.String PN_IS_CREATED
        Deprecated.
        Indicating whether request processing created new data. This property is initialized to false and may be changed by calling the setCreateRequest(boolean) method.
        See Also:
        Constant Field Values
      • PN_CHANGE_LOG

        public static final java.lang.String PN_CHANGE_LOG
        Deprecated.
        human readable changelog
        See Also:
        Constant Field Values
      • PN_ERROR

        public static final java.lang.String PN_ERROR
        Deprecated.
        The Throwable caught while processing the request. This property is not set unless the setError(Throwable) method is called.
        See Also:
        Constant Field Values
    • Constructor Detail

      • HtmlResponse

        public HtmlResponse()
        Deprecated.
        Creates a new html response with default settings, which is null for almost all properties except the isCreateRequest() which defaults to false.
    • Method Detail

      • getReferer

        public java.lang.String getReferer()
        Deprecated.
        Returns the referer as from the 'referer' request header.
        Returns:
        The referrer
      • setReferer

        public void setReferer​(java.lang.String referer)
        Deprecated.
        Sets the referer property
        Parameters:
        referer - The referrer to set
      • getPath

        public java.lang.String getPath()
        Deprecated.
        Returns the absolute path of the item upon which the request operated.

        If the setPath(String) method has not been called yet, this method returns null.

        Returns:
        The path or null.
      • setPath

        public void setPath​(java.lang.String path)
        Deprecated.
        Sets the absolute path of the item upon which the request operated.
        Parameters:
        path - The path
      • isCreateRequest

        public boolean isCreateRequest()
        Deprecated.
        Returns true if this was a create request.

        Before calling the setCreateRequest(boolean) method, this method always returns false.

        Returns:
        true if this is a create request
      • setCreateRequest

        public void setCreateRequest​(boolean isCreateRequest)
        Deprecated.
        Sets whether the request was a create request or not.
        Parameters:
        isCreateRequest - flag for the create request
      • getLocation

        public java.lang.String getLocation()
        Deprecated.
        Returns the location of the modification. this is the externalized form of the current path.
        Returns:
        the location of the modification.
      • setLocation

        public void setLocation​(java.lang.String location)
        Deprecated.
        Set the location
        Parameters:
        location - The location
      • getParentLocation

        public java.lang.String getParentLocation()
        Deprecated.
        Returns the parent location of the modification. this is the externalized form of the parent node of the current path.
        Returns:
        the location of the modification.
      • setParentLocation

        public void setParentLocation​(java.lang.String parentLocation)
        Deprecated.
        Set the parent location
        Parameters:
        parentLocation - The parent location
      • setTitle

        public void setTitle​(java.lang.String title)
        Deprecated.
        Sets the title of the response message
        Parameters:
        title - the title
      • setStatus

        public void setStatus​(int code,
                              java.lang.String message)
        Deprecated.
        sets the response status code properties
        Parameters:
        code - the code
        message - the message
      • getStatusCode

        public int getStatusCode()
        Deprecated.
        Returns the status code of this instance. If the status code has never been set by calling the setStatus(int, String) method, the status code is determined by checking if there was an error. If there was an error, the response is assumed to be unsuccessful and 500 is returned. If there is no error, the response is assumed to be successful and 200 is returned.
        Returns:
        The status code
      • getStatusMessage

        public java.lang.String getStatusMessage()
        Deprecated.
        Get the status message
        Returns:
        The status message
      • getError

        public java.lang.Throwable getError()
        Deprecated.
        Returns any recorded error or null
        Returns:
        an error or null
      • setError

        public void setError​(java.lang.Throwable error)
        Deprecated.
        Set the error
        Parameters:
        error - The error
      • isSuccessful

        public boolean isSuccessful()
        Deprecated.
        Returns true if no error is set and if the status code is one of the 2xx codes.
        Returns:
        true if successful
      • onModified

        public void onModified​(java.lang.String path)
        Deprecated.
        Records a 'modified' change
        Parameters:
        path - path of the item that was modified
      • onCreated

        public void onCreated​(java.lang.String path)
        Deprecated.
        Records a 'created' change
        Parameters:
        path - path of the item that was created
      • onDeleted

        public void onDeleted​(java.lang.String path)
        Deprecated.
        Records a 'deleted' change
        Parameters:
        path - path of the item that was deleted
      • onMoved

        public void onMoved​(java.lang.String srcPath,
                            java.lang.String dstPath)
        Deprecated.
        Records a 'moved' change.

        Note: the moved change only records the basic move command. the implied changes on the moved properties and sub nodes are not recorded.

        Parameters:
        srcPath - source path of the node that was moved
        dstPath - destination path of the node that was moved.
      • onCopied

        public void onCopied​(java.lang.String srcPath,
                             java.lang.String dstPath)
        Deprecated.
        Records a 'copied' change.

        Note: the copy change only records the basic copy command. the implied changes on the copied properties and sub nodes are not recorded.

        Parameters:
        srcPath - source path of the node that was copied
        dstPath - destination path of the node that was copied.
      • onChange

        public void onChange​(java.lang.String type,
                             java.lang.String... arguments)
        Deprecated.
        Records a generic change of the given type.

        The change is added to the internal list of changes with the syntax of a method call, where the type is the method name and the arguments are the string arguments to the method enclosed in double quotes. For example, the the call

         onChange("sameple", "arg1", "arg2");
         
        is aded as
         sample("arg1", "arg2")
         
        to the internal list of changes.
        Parameters:
        type - The type of the modification
        arguments - The arguments to the modifications
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.Object value)
        Deprecated.
        Sets a generic response property with the given
        Parameters:
        name - name of the property
        value - value of the property
      • getProperty

        public <Type> Type getProperty​(java.lang.String name,
                                       java.lang.Class<Type> type)
        Deprecated.
        Returns the generic response property with the given name and type or null if no such property exists or the property is not of the requested type.
        Type Parameters:
        Type - The type to get
        Parameters:
        name - The property name
        type - The type to get
        Returns:
        The property value or null.
      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
        Deprecated.
        Returns the generic response property with the given name and type or null if no such property exists.
        Parameters:
        name - The property name
        Returns:
        The property value or null.
      • send

        public void send​(HttpServletResponse response,
                         boolean setStatus)
                  throws java.io.IOException
        Deprecated.
        Writes the response to the given writer and replaces all ${var} patterns by the value of the respective property. if the property is not defined the pattern is not modified.
        Parameters:
        response - to send to
        setStatus - whether to set the status code on the response
        Throws:
        java.io.IOException - if an i/o exception occurs