Class WebPlugin

    • Field Detail

      • PR_ROOT_RESOURCE

        public static final java.lang.String PR_ROOT_RESOURCE
        See Also:
        Constant Field Values
      • PR_CONFIG_MODEL_PARAMS

        public static final java.lang.String PR_CONFIG_MODEL_PARAMS
        See Also:
        Constant Field Values
      • PR_HIDE_RESOURCE_CONFIG

        public static final java.lang.String PR_HIDE_RESOURCE_CONFIG
        See Also:
        Constant Field Values
      • PR_ENABLE_KEEP_ALIVE

        public static final java.lang.String PR_ENABLE_KEEP_ALIVE
        See Also:
        Constant Field Values
      • PR_ENABLE_PAIRING

        public static final java.lang.String PR_ENABLE_PAIRING
        See Also:
        Constant Field Values
      • PROPERTIES_MIGRATED

        public static final java.lang.String PROPERTIES_MIGRATED
        See Also:
        Constant Field Values
      • PAIRING_MIGRATED

        public static final java.lang.String PAIRING_MIGRATED
        See Also:
        Constant Field Values
      • PAIRING_SESSION_KEY

        public static final java.lang.String PAIRING_SESSION_KEY
        See Also:
        Constant Field Values
      • CONFIG_PASSWORD_ENABLE

        public static final java.lang.String CONFIG_PASSWORD_ENABLE
        See Also:
        Constant Field Values
      • CONFIG_PASSWORD_ENABLE_DEFAULT

        public static final boolean CONFIG_PASSWORD_ENABLE_DEFAULT
        See Also:
        Constant Field Values
      • CONFIG_NO_PW_WHITELIST

        public static final java.lang.String CONFIG_NO_PW_WHITELIST
        See Also:
        Constant Field Values
      • CONFIG_NO_PW_WHITELIST_DEFAULT

        public static final java.lang.String CONFIG_NO_PW_WHITELIST_DEFAULT
        See Also:
        Constant Field Values
      • CONFIG_PAIRING_ENABLE

        public static final java.lang.String CONFIG_PAIRING_ENABLE
        See Also:
        Constant Field Values
      • CONFIG_PAIRING_ENABLE_DEFAULT

        public static final boolean CONFIG_PAIRING_ENABLE_DEFAULT
        See Also:
        Constant Field Values
      • CONFIG_PORT_OVERRIDE

        public static final java.lang.String CONFIG_PORT_OVERRIDE
        See Also:
        Constant Field Values
      • CONFIG_PAIRING_AUTO_AUTH

        public static final java.lang.String CONFIG_PAIRING_AUTO_AUTH
        See Also:
        Constant Field Values
      • CONFIG_PAIRING_AUTO_AUTH_DEFAULT

        public static final boolean CONFIG_PAIRING_AUTO_AUTH_DEFAULT
        See Also:
        Constant Field Values
      • CONFIG_ENABLE_DEFAULT

        public boolean CONFIG_ENABLE_DEFAULT
      • CONFIG_USER_DEFAULT

        public static final java.lang.String CONFIG_USER_DEFAULT
        See Also:
        Constant Field Values
      • CONFIG_PASSWORD_DEFAULT

        public static final byte[] CONFIG_PASSWORD_DEFAULT
      • CONFIG_PORT_DEFAULT

        public int CONFIG_PORT_DEFAULT
      • CONFIG_BIND_IP_DEFAULT

        public java.lang.String CONFIG_BIND_IP_DEFAULT
      • CONFIG_PROTOCOL_DEFAULT

        public static final java.lang.String CONFIG_PROTOCOL_DEFAULT
        See Also:
        Constant Field Values
      • CONFIG_UPNP_ENABLE

        public static final java.lang.String CONFIG_UPNP_ENABLE
        See Also:
        Constant Field Values
      • CONFIG_UPNP_ENABLE_DEFAULT

        public boolean CONFIG_UPNP_ENABLE_DEFAULT
      • CONFIG_HOME_PAGE

        public static final java.lang.String CONFIG_HOME_PAGE
        See Also:
        Constant Field Values
      • CONFIG_HOME_PAGE_DEFAULT

        public java.lang.String CONFIG_HOME_PAGE_DEFAULT
      • CONFIG_ROOT_DIR_DEFAULT

        public java.lang.String CONFIG_ROOT_DIR_DEFAULT
      • CONFIG_ROOT_RESOURCE

        public static final java.lang.String CONFIG_ROOT_RESOURCE
        See Also:
        Constant Field Values
      • CONFIG_ROOT_RESOURCE_DEFAULT

        public java.lang.String CONFIG_ROOT_RESOURCE_DEFAULT
      • CONFIG_MODE_FULL

        public static final java.lang.String CONFIG_MODE_FULL
        See Also:
        Constant Field Values
      • CONFIG_MODE_DEFAULT

        public static final java.lang.String CONFIG_MODE_DEFAULT
        See Also:
        Constant Field Values
      • CONFIG_ACCESS_DEFAULT

        public java.lang.String CONFIG_ACCESS_DEFAULT
      • welcome_pages

        protected static final java.lang.String[] welcome_pages
      • welcome_files

        protected static java.io.File[] welcome_files
      • network_dispatcher

        private static final AsyncDispatcher network_dispatcher
      • p_sid

        private java.lang.String p_sid
      • setting_auto_auth

        private boolean setting_auto_auth
      • pairing_access_code

        private java.lang.String pairing_access_code
      • pairing_session_code

        private java.lang.String pairing_session_code
      • plugin_enabled

        private boolean plugin_enabled
      • na_intf_listener_added

        private boolean na_intf_listener_added
      • home_page

        private java.lang.String home_page
      • file_root

        private java.io.File file_root
      • resource_root

        private java.lang.String resource_root
      • root_dir

        private java.lang.String root_dir
      • ip_range_all

        private boolean ip_range_all
      • ip_ranges

        private java.util.List<IPRange> ip_ranges
      • properties

        private java.util.Properties properties
      • tls

        private static java.lang.ThreadLocal<java.lang.String> tls
      • GRACE_PERIOD_MARKER

        private static final java.lang.String GRACE_PERIOD_MARKER
        See Also:
        Constant Field Values
      • logout_timer

        private java.util.Map<java.lang.String,​java.lang.Long> logout_timer
      • unloaded

        private boolean unloaded
    • Constructor Detail

      • WebPlugin

        public WebPlugin()
      • WebPlugin

        public WebPlugin​(java.util.Properties defaults)
    • Method Detail

      • initialize

        public void initialize​(PluginInterface _plugin_interface)
                        throws PluginException
        Description copied from interface: Plugin
        This method is called when the Plugin is loaded by the client
        Specified by:
        initialize in interface Plugin
        Parameters:
        _plugin_interface - the interface that the plugin must use to communicate with the client
        Throws:
        PluginException
      • initStage

        protected void initStage​(int num)
      • getConnectionTestURL

        private java.lang.String getConnectionTestURL​(java.lang.String sid)
      • isPluginEnabled

        protected boolean isPluginEnabled()
      • unloadPlugin

        protected void unloadPlugin()
      • setupResources

        private void setupResources()
      • setupAccess

        private void setupAccess()
      • setupServer

        protected void setupServer()
      • hasOurCookie

        private boolean hasOurCookie​(java.lang.String cookies)
      • sameAddress

        private boolean sameAddress​(java.net.InetAddress a1,
                                    java.net.InetAddress a2)
      • setupUPnP

        protected void setupUPnP()
      • setupPairing

        protected void setupPairing​(java.lang.String sid,
                                    boolean pairing_enabled)
      • setupSessionCode

        private void setupSessionCode​(java.lang.String key)
      • setupAutoAuth

        protected void setupAutoAuth()
      • updatePairing

        protected void updatePairing​(java.lang.String sid)
      • getServerBindIP

        public java.net.InetAddress getServerBindIP()
      • getServerPort

        public int getServerPort()
      • getPort

        public int getPort()
      • getProtocol

        public java.lang.String getProtocol()
      • setUserAndPassword

        public void setUserAndPassword​(java.lang.String user,
                                       java.lang.String password)
      • unsetUserAndPassword

        public void unsetUserAndPassword()
      • recordAuthRequest

        private void recordAuthRequest​(java.lang.String client_ip,
                                       boolean good)
      • recordRequest

        private void recordRequest​(TrackerWebPageRequest request,
                                   boolean good,
                                   boolean is_tunnel)
      • handleTunnelRequest

        private byte[] handleTunnelRequest​(java.net.InetAddress originator,
                                           java.lang.String endpoint_url,
                                           byte[] request_bytes)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • useFile

        protected boolean useFile​(TrackerWebPageRequest request,
                                  TrackerWebPageResponse response,
                                  java.io.File root,
                                  java.lang.String relative_url)
                           throws java.io.IOException
        this method can be over-ridden to handle custom file delivery
        Parameters:
        request -
        response -
        root -
        relative_url -
        Returns:
        Throws:
        java.io.IOException
      • getArgumentFromURL

        private java.lang.String getArgumentFromURL​(java.net.URL url,
                                                    java.lang.String argument)
      • returnTextPlain

        private boolean returnTextPlain​(TrackerWebPageResponse response,
                                        java.lang.String str)
      • returnJSON

        private boolean returnJSON​(TrackerWebPageResponse response,
                                   java.lang.String str)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • returnStuff

        private boolean returnStuff​(TrackerWebPageResponse response,
                                    java.lang.String content_type,
                                    java.lang.String str)
      • log

        protected void log​(java.lang.String str)
      • log

        protected void log​(java.lang.String str,
                           java.lang.Throwable e)