Examples of HttpResponseStatus


Examples of blackberry.web.widget.bf.HTTPResponseStatus

     * @see net.rim.device.api.browser.field2.BrowserFieldController
     */
    public InputConnection handleResourceRequest( BrowserFieldRequest request ) throws Exception {

        if( this._browserField == null ) {
            return new HTTPResponseStatus( HTTPResponseStatus.SC_SERVER_ERROR, request ).getResponse();
        }
        if( request.getURL().startsWith( "http://localhost:8472/" ) ) {
            URI requestURI = URI.create( request.getURL() );
            String[] splitPath = StringUtilities.split( requestURI.getPath(), "/" );
            String featureID = "";
            for( int i = 0; i < splitPath.length - 1; i++ ) {
                if( featureID == "" ) {
                    featureID = featureID + splitPath[ i ];
                } else {
                    featureID = featureID + "." + splitPath[ i ];
                }
            }
            Object ext = ( (WidgetConfigImpl) _widgetConfig ).getExtensionObjectForFeature( featureID );
            if( ext != null && ext instanceof IJSExtension ) {
                JSExtensionRequest req = new JSExtensionRequest( request.getURL(), request.getPostData(), request.getHeaders(),
                        ( (WidgetConfigImpl) _widgetConfig ).getFeatureTable() );
                JSExtensionResponse res = new JSExtensionResponse( request.getURL(), null, request.getHeaders() );
                try {
                    ( (IJSExtension) ext ).invoke( req, res );
                    return new BrowserFieldResponse( res.getURL(), res.getPostData(), res.getHeaders() );
                } catch( net.rim.device.api.web.WidgetException e ) {
                    // this block is reached if the method cannot be found within the extension
                    return new HTTPResponseStatus( HTTPResponseStatus.SC_NOT_IMPLEMENTED, request ).getResponse();
                }
            } else {
                if( ext == null ) {
                    return new HTTPResponseStatus( HTTPResponseStatus.SC_NOT_FOUND, request ).getResponse();
                } else if( !( ext instanceof IJSExtension ) ) {
                    return new HTTPResponseStatus( HTTPResponseStatus.SC_NOT_IMPLEMENTED, request ).getResponse();
                }
            }
        }
        WidgetAccess access = _widgetPolicy.getElement( request.getURL(), _widgetConfig.getAccessList() );
        if( access == null && !_hasMultiAccess ) {
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

    @Override
    protected HttpMessage createMessage(String[] initialLine) throws Exception {
        return new DefaultHttpResponse(
                RtspVersions.valueOf(initialLine[0]),
                new HttpResponseStatus(Integer.valueOf(initialLine[1]), initialLine[2]));
    }
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

    private final byte[] content;

    public NettyResponse(HttpResponse httpResponse)
    {
        // status
        HttpResponseStatus status = httpResponse.getStatus();
        this.statusCode = status.getCode();
        this.statusMessage = status.getReasonPhrase();

        // headers
        Builder<String, String> headers = ImmutableListMultimap.builder();
        for (Entry<String, String> header : httpResponse.getHeaders()) {
            headers.put(header);
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

            if (space == -1) {
                return HttpResponseStatus.valueOf(Integer.parseInt(status));
            } else {
                int code = Integer.parseInt(status.substring(0, space));
                String reasonPhrase = status.substring(space + 1);
                HttpResponseStatus responseStatus = HttpResponseStatus.valueOf(code);
                if (responseStatus.getReasonPhrase().equals(reasonPhrase)) {
                    return responseStatus;
                } else {
                    return new HttpResponseStatus(code, reasonPhrase);
                }
            }
        } catch (Exception e) {
            return null;
        }
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

     *            HTTP response returned from the server for the request sent by beginOpeningHandshake00().
     * @throws WebSocketHandshakeException
     */
    @Override
    public void finishHandshake(Channel channel, HttpResponse response) {
        final HttpResponseStatus status = HttpResponseStatus.SWITCHING_PROTOCOLS;

        if (!response.getStatus().equals(status)) {
            throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus());
        }

View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

    }

    private static HttpResponse createHttpResponse(int spdyVersion, SpdyHeadersFrame responseFrame)
            throws Exception {
        // Create the first line of the response from the name/value pairs
        HttpResponseStatus status = SpdyHeaders.getStatus(spdyVersion, responseFrame);
        HttpVersion version = SpdyHeaders.getVersion(spdyVersion, responseFrame);
        SpdyHeaders.removeStatus(spdyVersion, responseFrame);
        SpdyHeaders.removeVersion(spdyVersion, responseFrame);

        HttpResponse httpResponse = new DefaultHttpResponse(version, status);
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

     *            HTTP response returned from the server for the request sent by beginOpeningHandshake00().
     * @throws WebSocketHandshakeException
     */
    @Override
    public void finishHandshake(Channel channel, HttpResponse response) {
        final HttpResponseStatus status = HttpResponseStatus.SWITCHING_PROTOCOLS;

        if (!response.getStatus().equals(status)) {
            throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus());
        }

View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

     *            HTTP response returned from the server for the request sent by beginOpeningHandshake00().
     * @throws WebSocketHandshakeException
     */
    @Override
    public void finishHandshake(Channel channel, HttpResponse response) {
        final HttpResponseStatus status = HttpResponseStatus.SWITCHING_PROTOCOLS;

        if (!response.getStatus().equals(status)) {
            throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus());
        }

View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

     *            HTTP response returned from the server for the request sent by beginOpeningHandshake00().
     * @throws WebSocketHandshakeException
     */
    @Override
    public void finishHandshake(Channel channel, HttpResponse response) {
        final HttpResponseStatus status = new HttpResponseStatus(101, "WebSocket Protocol Handshake");

        if (!response.getStatus().equals(status)) {
            throw new WebSocketHandshakeException("Invalid handshake response status: " + response.getStatus());
        }

View Full Code Here

Examples of com.facebook.presto.jdbc.internal.netty.handler.codec.http.HttpResponseStatus

        // Hixie 75 does not contain these headers while Hixie 76 does
        boolean isHixie76 = req.containsHeader(SEC_WEBSOCKET_KEY1) && req.containsHeader(SEC_WEBSOCKET_KEY2);

        // Create the WebSocket handshake response.
        HttpResponse res = new DefaultHttpResponse(HTTP_1_1, new HttpResponseStatus(101,
                isHixie76 ? "WebSocket Protocol Handshake" : "Web Socket Protocol Handshake"));
        res.addHeader(Names.UPGRADE, WEBSOCKET);
        res.addHeader(CONNECTION, Values.UPGRADE);

        // Fill in the headers and contents depending on handshake method.
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.