Android Open Source - ls-vertretungsplan Response






From Project

Back to project page ls-vertretungsplan.

License

The source code is released under:

GNU General Public License

If you think the Android project ls-vertretungsplan listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.joejernst.http;
/*from   w w w . j a  v  a  2s  .c  o m*/
import java.util.List;
import java.util.Map;

/*
 * Copyright 2012 Joe J. Ernst
 * <p/>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * This class represents an HTTP Response message.
 */
public class Response extends Message<Response> {

    int responseCode;
    String responseMessage;

    /**
     * The default constructor is a no-op
     */
    public Response() {
        // no-op
    }

    /**
     * Gets the HTTP Response Code from this Response instace.
     *
     * @return The HTTP Response Code that was sent from the server
     */
    public int getResponseCode() {
        return responseCode;
    }

    /**
     * Sets the HTTP Response Code on this object.
     *
     * @param responseCode Any of the standard HTTP Response Codes
     * @return This object, to support chained method calls
     */
    public Response setResponseCode(int responseCode) {
        this.responseCode = responseCode;
        return this;
    }

    /**
     * Returns a message pertaining to the Response Code.
     *
     * @return Any response message that may have been returned by the server.  This message should be related to the
     * and should not be confused with the Response Body.
     */
    public String getResponseMessage() {
        return responseMessage;
    }

    /**
     * Sets the Response Message, which should pertain to the Response Code
     * @param responseMessage Any message which was sent back from the server, pertaining to the Response Code
     * @return this Response, to support chained method calls
     */
    public Response setResponseMessage(String responseMessage) {
        this.responseMessage = responseMessage;
        return this;
    }

    /**
     * Returns a String representation of this Response.  Helpful for debugging.
     * @return  Returns a String representation of this Response.  Helpful for debugging.
     */
    public String toString() {
        StringBuilder builder = new StringBuilder();
        String newline = System.getProperty("line.separator");

        builder.append("Response Code: ")
                .append(this.responseCode)
                .append(newline)
                .append("Response Message: ")
                .append(newline).append(newline)
                .append("Headers: ").append(newline);

        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
            List<String> values = entry.getValue();
            for (String value : values) {
                builder.append(entry.getKey()).append(" = ").append(value).append(newline);
            }
        }

        builder.append(newline).append("Body: ").append(newline)
                .append(body);

        return builder.toString();
    }
}




Java Source Code List

com.joejernst.http.Message.java
com.joejernst.http.Request.java
com.joejernst.http.Response.java
com.johan.vertretungsplan.GCMIntentService.java
com.johan.vertretungsplan.LoginDialogFragment.java
com.johan.vertretungsplan.NachrichtenFragment.java
com.johan.vertretungsplan.SettingsActivity.java
com.johan.vertretungsplan.SettingsFragment.java
com.johan.vertretungsplan.StartActivity.java
com.johan.vertretungsplan.VertretungFragment.java
com.johan.vertretungsplan.VertretungsplanApplication.java
com.johan.vertretungsplan.VertretungsplanFragment.java
com.johan.vertretungsplan.additionalinfo.BaseAdditionalInfoParser.java
com.johan.vertretungsplan.additionalinfo.WinterShParser.java
com.johan.vertretungsplan.background.VertretungsplanService.java
com.johan.vertretungsplan.comparators.AlphabeticalSchoolComparator.java
com.johan.vertretungsplan.comparators.DistanceSchoolComparator.java
com.johan.vertretungsplan.objects.AdditionalInfo.java
com.johan.vertretungsplan.objects.KlassenVertretungsplan.java
com.johan.vertretungsplan.objects.Schule.java
com.johan.vertretungsplan.objects.Vertretung.java
com.johan.vertretungsplan.objects.VertretungsplanTag.java
com.johan.vertretungsplan.objects.Vertretungsplan.java
com.johan.vertretungsplan.parser.BackendConnectParser.java
com.johan.vertretungsplan.parser.BaseParser.java
com.johan.vertretungsplan.ui.LinkAlertDialog.java
com.johan.vertretungsplan.ui.TabSwipeActivity.java
com.johan.vertretungsplan.ui.WebViewAlertDialog.java
com.johan.vertretungsplan.utils.Animations.java
com.johan.vertretungsplan.utils.Utils.java
com.johan.vertretungsplan.widget.VertretungsplanWidgetProvider.java
com.johan.vertretungsplan.widget.VertretungsplanWidgetService.java