Examples of BadRequest


Examples of play.mvc.results.BadRequest

    /**
     * Send a 400 Bad request
     */
    protected static void badRequest() {
        throw new BadRequest();
    }
View Full Code Here

Examples of play.mvc.results.BadRequest

    /**
     * Send a 400 Bad request
     */
    protected static void badRequest() {
        throw new BadRequest();
    }
View Full Code Here

Examples of play.mvc.results.BadRequest

    /**
     * Send a 400 Bad request
     */
    protected static void badRequest() {
        throw new BadRequest();
    }
View Full Code Here

Examples of play.mvc.results.BadRequest

    /**
     * Send a 400 Bad request
     */
    protected static void badRequest(String msg) {
        throw new BadRequest(msg);
    }
View Full Code Here

Examples of play.mvc.results.BadRequest

    /**
     * Send a 400 Bad request
     */
    protected static void badRequest() {
        throw new BadRequest();
    }
View Full Code Here

Examples of rocks.xmpp.core.stanza.model.errors.BadRequest

    }

    @Test
    public void marshalBadProfile() throws JAXBException, XMLStreamException {
        IQ result = new IQ("1", IQ.Type.ERROR);
        result.setError(new StanzaError(new BadRequest()));
        result.getError().setExtension(new BadProfile());
        String xml = marshal(result);
        Assert.assertEquals(xml, "<iq id=\"1\" type=\"error\"><error type=\"modify\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></bad-request><bad-profile xmlns=\"http://jabber.org/protocol/si\"></bad-profile></error></iq>");

    }
View Full Code Here

Examples of rocks.xmpp.core.stanza.model.errors.BadRequest

    }

    @Test
    public void marshalNoValidStreams() throws JAXBException, XMLStreamException {
        IQ result = new IQ("1", IQ.Type.ERROR);
        result.setError(new StanzaError(new BadRequest()));
        result.getError().setExtension(new NoValidStreams());
        String xml = marshal(result);
        Assert.assertEquals(xml, "<iq id=\"1\" type=\"error\"><error type=\"modify\"><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></bad-request><no-valid-streams xmlns=\"http://jabber.org/protocol/si\"></no-valid-streams></error></iq>");

    }
View Full Code Here

Examples of rocks.xmpp.core.stanza.model.errors.BadRequest

                    Socks5ByteStream socks5ByteStream = iq.getExtension(Socks5ByteStream.class);
                    if (socks5ByteStream != null) {
                        if (socks5ByteStream.getSessionId() == null) {
                            // If the request is malformed (e.g., the <query/> element does not include the 'sid' attribute), the Target MUST return an error of <bad-request/>.
                            xmppSession.send(iq.createError(new StanzaError(new BadRequest())));
                        } else {
                            notifyByteStreamEvent(new S5bEvent(Socks5ByteStreamManager.this, socks5ByteStream.getSessionId(), xmppSession, iq, socks5ByteStream.getStreamHosts()));
                        }
                        e.consume();
                    }
View Full Code Here

Examples of rocks.xmpp.core.stanza.model.errors.BadRequest

                                    }
                                }
                            }
                        }
                        if (noValidStreams) {
                            StanzaError error = new StanzaError(new BadRequest());
                            error.setExtension(new NoValidStreams());
                            xmppSession.send(iq.createError(error));
                        } else {
                            ProfileManager profileManager = profileManagers.get(streamInitiation.getProfile());

                            if (profileManager == null) {
                                StanzaError error = new StanzaError(new BadRequest());
                                error.setExtension(new BadProfile());
                                xmppSession.send(iq.createError(error));
                            } else {
                                profileManager.handle(iq, streamInitiation);
                            }
View Full Code Here

Examples of rocks.xmpp.core.stanza.model.errors.BadRequest

                        // The value of the 'action' attribute MUST be one of the following.
                        // If an entity receives a value not defined here, it MUST ignore the attribute and MUST return a <bad-request/> error to the sender.
                        // There is no default value for the 'action' attribute.
                        if (jingle.getAction() == null) {
                            xmppSession.send(iq.createError(new StanzaError(new BadRequest(), "No valid action attribute set.")));
                        } else if (jingle.getSessionId() == null) {
                            xmppSession.send(iq.createError(new StanzaError(new BadRequest(), "No session id set.")));
                        } else if (jingle.getAction() == Jingle.Action.SESSION_INITIATE) {

                            // Check if the Jingle request is not mal-formed, otherwise return a bad-request error.
                            // See 6.3.2 Errors
                            if (jingle.getContents().isEmpty()) {
                                xmppSession.send(iq.createError(new StanzaError(new BadRequest(), "No contents found.")));
                            } else {
                                boolean hasContentWithDispositionSession = false;
                                boolean hasSupportedApplications = false;
                                boolean hasSupportedTransports = false;
                                // Check if we support the application format and transport method and at least one content element has a disposition of "session".
                                for (Jingle.Content content : jingle.getContents()) {
                                    // Check if the content disposition is "session" (default value is "session").
                                    if (!hasContentWithDispositionSession && ("session".equals(content.getDisposition()) || content.getDisposition() == null)) {
                                        hasContentWithDispositionSession = true;
                                    }

                                    if (!hasSupportedApplications && content.getApplicationFormat() != null) {
                                        hasSupportedApplications = true;
                                    }

                                    if (!hasSupportedTransports && content.getTransportMethod() != null) {
                                        hasSupportedTransports = true;
                                    }
                                }

                                if (!hasContentWithDispositionSession) {
                                    // When sending a session-initiate with one <content/> element,
                                    // the value of the <content/> element's 'disposition' attribute MUST be "session"
                                    // (if there are multiple <content/> elements then at least one MUST have a disposition of "session");
                                    // if this rule is violated, the responder MUST return a <bad-request/> error to the initiator.
                                    xmppSession.send(iq.createError(new StanzaError(new BadRequest(), "No content with disposition 'session' found.")));
                                } else {
                                    // If the request was ok, immediately acknowledge the initiation request.
                                    // See 6.3.1 Acknowledgement
                                    xmppSession.send(iq.createResult());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.