HttpOverXmppResp.java

  1. /**
  2.  *
  3.  * Copyright 2014 Andriy Tsykholyas
  4.  *
  5.  * Licensed under the Apache License, Version 2.0 (the "License");
  6.  * you may not use this file except in compliance with the License.
  7.  * You may obtain a copy of the License at
  8.  *
  9.  *     http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.jivesoftware.smackx.hoxt.packet;

  18. import org.jivesoftware.smack.util.StringUtils;

  19. /**
  20.  * Represents Resp IQ packet.
  21.  *
  22.  * @author Andriy Tsykholyas
  23.  * @see <a href="http://xmpp.org/extensions/xep-0332.html">XEP-0332: HTTP over XMPP transport</a>
  24.  */
  25. public class HttpOverXmppResp extends AbstractHttpOverXmpp {

  26.     public static final String ELEMENT = "resp";


  27.     public HttpOverXmppResp() {
  28.         super(ELEMENT);
  29.     }

  30.     private int statusCode;
  31.     private String statusMessage = null;

  32.     @Override
  33.     protected IQChildElementXmlStringBuilder getIQHoxtChildElementBuilder(IQChildElementXmlStringBuilder builder) {
  34.         builder.append(" ");
  35.         builder.append("version='").append(StringUtils.escapeForXML(version)).append("'");
  36.         builder.append(" ");
  37.         builder.append("statusCode='").append(Integer.toString(statusCode)).append("'");
  38.         if (statusMessage != null) {
  39.             builder.append(" ");
  40.             builder.append("statusMessage='").append(StringUtils.escapeForXML(statusMessage)).append("'");
  41.         }
  42.         builder.append(">");
  43.         return builder;
  44.     }

  45.     /**
  46.      * Returns statusCode attribute.
  47.      *
  48.      * @return statusCode attribute
  49.      */
  50.     public int getStatusCode() {
  51.         return statusCode;
  52.     }

  53.     /**
  54.      * Sets statusCode attribute.
  55.      *
  56.      * @param statusCode statusCode attribute
  57.      */
  58.     public void setStatusCode(int statusCode) {
  59.         this.statusCode = statusCode;
  60.     }

  61.     /**
  62.      * Returns statusMessage attribute.
  63.      *
  64.      * @return statusMessage attribute
  65.      */
  66.     public String getStatusMessage() {
  67.         return statusMessage;
  68.     }

  69.     /**
  70.      * Sets statusMessage attribute.
  71.      *
  72.      * @param statusMessage statusMessage attribute
  73.      */
  74.     public void setStatusMessage(String statusMessage) {
  75.         this.statusMessage = statusMessage;
  76.     }
  77. }