All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.directwebremoting.dwrp.PollBatch Maven / Gradle / Ivy

Go to download

DWR is easy Ajax for Java. It makes it simple to call Java code directly from Javascript. It gets rid of almost all the boilerplate code between the web browser and your Java code. This version 4.0.2 works with Jakarta Servlet 4.0.2.

There is a newer version: 5.0.0
Show newest version
package org.directwebremoting.dwrp;

import javax.servlet.http.HttpServletRequest;

import org.directwebremoting.extend.ProtocolConstants;
import org.directwebremoting.extend.ServerException;

/**
 * A container for the information passed in by an Poll request
 * @author Joe Walker [joe at getahead dot ltd dot uk]
 */
public class PollBatch extends Batch
{
    /**
     * @param request The request to parse to fill out this batch
     * @throws ServerException ...
     */
    public PollBatch(HttpServletRequest request) throws ServerException
    {
        super(request);

        if (getNextReverseAjaxIndex() == null)
        {
            throw new IllegalArgumentException("A reverse ajax poll must specify nextReverseAjaxIndex.");
        }
        debug = request.getHeader("User-Agent");
        String prString = extractParameter(ProtocolConstants.INBOUND_KEY_PARTIAL_RESPONSE, THROW);
        partialResponse = PartialResponse.fromOrdinal(prString);
    }

    /**
     * @return the partialResponse
     */
    public PartialResponse getPartialResponse()
    {
        return partialResponse;
    }

    /**
     * Does the browser want partial responses?
     */
    private final PartialResponse partialResponse;

    @Override
    public String toString()
    {
        return "PollBatch[partResp=" + partialResponse + ",debug=" + debug + "]";
    }

    /**
     * A quick string for debug purposes
     */
    private final String debug;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy