001/** 002 * 003 * Copyright 2014 Andriy Tsykholyas 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.hoxt.packet; 018 019import org.jivesoftware.smack.util.StringUtils; 020 021/** 022 * Represents Resp IQ packet. 023 * 024 * @author Andriy Tsykholyas 025 * @see <a href="http://xmpp.org/extensions/xep-0332.html">XEP-0332: HTTP over XMPP transport</a> 026 */ 027public class HttpOverXmppResp extends AbstractHttpOverXmpp { 028 029 public static final String ELEMENT = "resp"; 030 031 032 public HttpOverXmppResp() { 033 super(ELEMENT); 034 } 035 036 private int statusCode; 037 private String statusMessage = null; 038 039 @Override 040 protected IQChildElementXmlStringBuilder getIQHoxtChildElementBuilder(IQChildElementXmlStringBuilder builder) { 041 builder.append(" "); 042 builder.append("version='").append(StringUtils.escapeForXML(version)).append("'"); 043 builder.append(" "); 044 builder.append("statusCode='").append(Integer.toString(statusCode)).append("'"); 045 if (statusMessage != null) { 046 builder.append(" "); 047 builder.append("statusMessage='").append(StringUtils.escapeForXML(statusMessage)).append("'"); 048 } 049 builder.append(">"); 050 return builder; 051 } 052 053 /** 054 * Returns statusCode attribute. 055 * 056 * @return statusCode attribute 057 */ 058 public int getStatusCode() { 059 return statusCode; 060 } 061 062 /** 063 * Sets statusCode attribute. 064 * 065 * @param statusCode statusCode attribute 066 */ 067 public void setStatusCode(int statusCode) { 068 this.statusCode = statusCode; 069 } 070 071 /** 072 * Returns statusMessage attribute. 073 * 074 * @return statusMessage attribute 075 */ 076 public String getStatusMessage() { 077 return statusMessage; 078 } 079 080 /** 081 * Sets statusMessage attribute. 082 * 083 * @param statusMessage statusMessage attribute 084 */ 085 public void setStatusMessage(String statusMessage) { 086 this.statusMessage = statusMessage; 087 } 088}