IT. Expert System.

Android Reference

ServerRequestHandler


javax.obex

Class ServerRequestHandler



  • public class ServerRequestHandler
    extends Object
    The ServerRequestHandler class defines an event listener that will respond to OBEX requests made to the server.

    The onConnect(), onSetPath(), onDelete(), onGet(), and onPut() methods may return any response code defined in the ResponseCodes class except for OBEX_HTTP_CONTINUE. If OBEX_HTTP_CONTINUE or a value not defined in the ResponseCodes class is returned, the server implementation will send an OBEX_HTTP_INTERNAL_ERROR response to the client.

    Connection ID and Target Headers

    According to the IrOBEX specification, a packet may not contain a Connection ID and Target header. Since the Connection ID header is managed by the implementation, it will not send a Connection ID header, if a Connection ID was specified, in a packet that has a Target header. In other words, if an application adds a Target header to a HeaderSet object used in an OBEX operation and a Connection ID was specified, no Connection ID will be sent in the packet containing the Target header.

    CREATE-EMPTY Requests

    A CREATE-EMPTY request allows clients to create empty objects on the server. When a CREATE-EMPTY request is received, the onPut() method will be called by the implementation. To differentiate between a normal PUT request and a CREATE-EMPTY request, an application must open the InputStream from the Operation object passed to the onPut() method. For a PUT request, the application will be able to read Body data from this InputStream. For a CREATE-EMPTY request, there will be no Body data to read. Therefore, a call to InputStream.read() will return -1.

    • Constructor Detail

      • ServerRequestHandler

        protected ServerRequestHandler()
        Creates a ServerRequestHandler.
    • Method Detail

      • setConnectionId

        public void setConnectionId(long connectionId)
        Sets the connection ID header to include in the reply packets.
        Parameters:
        connectionId - the connection ID to use; -1 if no connection ID should be sent
        Throws:
        IllegalArgumentException - if id is not in the range -1 to 232-1
      • getConnectionId

        public long getConnectionId()
        Retrieves the connection ID that is being used in the present connection. This method will return -1 if no connection ID is being used.
        Returns:
        the connection id being used or -1 if no connection ID is being used
      • onConnect

        public int onConnect(HeaderSet request,
                    HeaderSet reply)
        Called when a CONNECT request is received.

        If this method is not implemented by the class that extends this class, onConnect() will always return an OBEX_HTTP_OK response code.

        The headers received in the request can be retrieved from the request argument. The headers that should be sent in the reply must be specified in the reply argument.

        Parameters:
        request - contains the headers sent by the client; request will never be null
        reply - the headers that should be sent in the reply; reply will never be null
        Returns:
        a response code defined in ResponseCodes that will be returned to the client; if an invalid response code is provided, the OBEX_HTTP_INTERNAL_ERROR response code will be used
      • onDisconnect

        public void onDisconnect(HeaderSet request,
                        HeaderSet reply)
        Called when a DISCONNECT request is received.

        The headers received in the request can be retrieved from the request argument. The headers that should be sent in the reply must be specified in the reply argument.

        Parameters:
        request - contains the headers sent by the client; request will never be null
        reply - the headers that should be sent in the reply; reply will never be null
      • onSetPath

        public int onSetPath(HeaderSet request,
                    HeaderSet reply,
                    boolean backup,
                    boolean create)
        Called when a SETPATH request is received.

        If this method is not implemented by the class that extends this class, onSetPath() will always return an OBEX_HTTP_NOT_IMPLEMENTED response code.

        The headers received in the request can be retrieved from the request argument. The headers that should be sent in the reply must be specified in the reply argument.

        Parameters:
        request - contains the headers sent by the client; request will never be null
        reply - the headers that should be sent in the reply; reply will never be null
        backup - true if the client requests that the server back up one directory before changing to the path described by name; false to apply the request to the present path
        create - true if the path should be created if it does not already exist; false if the path should not be created if it does not exist and an error code should be returned
        Returns:
        a response code defined in ResponseCodes that will be returned to the client; if an invalid response code is provided, the OBEX_HTTP_INTERNAL_ERROR response code will be used
      • onDelete

        public int onDelete(HeaderSet request,
                   HeaderSet reply)
        Called when a DELETE request is received.

        If this method is not implemented by the class that extends this class, onDelete() will always return an OBEX_HTTP_NOT_IMPLEMENTED response code.

        The headers received in the request can be retrieved from the request argument. The headers that should be sent in the reply must be specified in the reply argument.

        Parameters:
        request - contains the headers sent by the client; request will never be null
        reply - the headers that should be sent in the reply; reply will never be null
        Returns:
        a response code defined in ResponseCodes that will be returned to the client; if an invalid response code is provided, the OBEX_HTTP_INTERNAL_ERROR response code will be used
      • onAbort

        public int onAbort(HeaderSet request,
                  HeaderSet reply)
        Called when a ABORT request is received.
      • onPut

        public int onPut(Operation operation)
        Called when a PUT request is received.

        If this method is not implemented by the class that extends this class, onPut() will always return an OBEX_HTTP_NOT_IMPLEMENTED response code.

        If an ABORT request is received during the processing of a PUT request, op will be closed by the implementation.

        Parameters:
        operation - contains the headers sent by the client and allows new headers to be sent in the reply; op will never be null
        Returns:
        a response code defined in ResponseCodes that will be returned to the client; if an invalid response code is provided, the OBEX_HTTP_INTERNAL_ERROR response code will be used
      • onGet

        public int onGet(Operation operation)
        Called when a GET request is received.

        If this method is not implemented by the class that extends this class, onGet() will always return an OBEX_HTTP_NOT_IMPLEMENTED response code.

        If an ABORT request is received during the processing of a GET request, op will be closed by the implementation.

        Parameters:
        operation - contains the headers sent by the client and allows new headers to be sent in the reply; op will never be null
        Returns:
        a response code defined in ResponseCodes that will be returned to the client; if an invalid response code is provided, the OBEX_HTTP_INTERNAL_ERROR response code will be used
      • onAuthenticationFailure

        public void onAuthenticationFailure(byte[] userName)
        Called when this object attempts to authenticate a client and the authentication request fails because the response digest in the authentication response header was wrong.

        If this method is not implemented by the class that extends this class, this method will do nothing.

        Parameters:
        userName - the user name returned in the authentication response; null if no user name was provided in the response
      • updateStatus

        public void updateStatus(String message)
        Called by ServerSession to update the status of current transaction

        If this method is not implemented by the class that extends this class, this method will do nothing.

      • onClose

        public void onClose()
        Called when session is closed.

        If this method is not implemented by the class that extends this class, this method will do nothing.



Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 572 / 158666326. Delta: 0.55247 с