Tutorial by Examples: client

Preemptive basic authentication is the practice of sending http basic authentication credentials (username and password) before a server replies with a 401 response asking for them. This can save a request round trip when consuming REST apis which are known to require basic authentication. As descr...
Using HttpClient as RestTemplate's underlying implementation to create HTTP requests allows for automatic handling of basic authentication requests (an http 401 response) when interacting with APIs. This example shows how to configure a RestTemplate to achieve this. // The credentials are stored he...
package main import ( "fmt" "k8s.io/client-go/1.5/kubernetes" "k8s.io/client-go/1.5/pkg/api/v1" "k8s.io/client-go/1.5/tools/clientcmd" ) func main() { config, err := clientcmd.BuildConfigFromFlags("", <kube-config-path&g...
pip install neo4jrestclient
from neo4jrestclient import client q = 'MATCH (u:User)-[r:likes]->(m:language) WHERE u.name="Marco" RETURN u, type(r), m' "db" as defined above results = db.query(q, returns=(client.Node, str, client.Node)) Print results for r in results: print("(%s)-[%s]->...
It's a good practice to encode state of Single Page Application (SPA) in url: my-app.com/admin-spa/users/edit/id123 This allows to save and share application state. When user puts url into browser's address bar and hits enter server must ignore client-side part of the requested url. If you serv...
Remove the token from the client storage to avoid usage Tokens are issued by the server and you can not force browsers to delete a cookie/localStorage or control how external clients are managing your tokens. Obviously if attackers have stolen the token before logout they still could use the token,...
The most interesting package for managing real tokens is django-rest-knox which supports multiple tokens per user (and cancelling each token independently), as well as having support for token expiration and several other security mechanisms. django-rest-knox depends on cryptography. You can find m...
Since Nightwatch has access to the browser console, it's possible to inspect client side objects using the .execute() API. In the following example, we're checking the Session object for a particular session variable. First, we begin by creating the file ./tests/nightwatch/api/meteor/checkSession...
// Include Nodejs' net module. const Net = require('net'); // The port number and hostname of the server. const port = 8080; const host = 'localhost'; // Create a new TCP client. const client = new Net.Socket(); // Send a connection request to the server. client.connect({ port: port, host:...
Creating a socket that uses the TCP (Transmission Control Protocol) $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); Make sure the socket is successfully created. The onSocketFailure function comes from Handling socket errors example in this topic. if(!is_resource($socket)) onSocketFailu...
This program is complimentary to Hello TCP Server program, you can run either of them to check the validity of each other. The program flow is quite common with Hello TCP server, so make sure to take a look at that too. Here's the code - #include <cstring> #include <iostream> #includ...
To get started we need a factory that produces WebClients. public class ClientFactory { private Map<String, WebClient> cache = new HashMap<>(); public enum RESTClient { PORTAL; } public WebClient fetchRestClient(RESTClient restClient) { if (th...
Before install this extension, you must install yii2-app. In this example, I use yii2-basic template. Guide for installation in here. Run composer require --prefer-dist yiisoft/yii2-authclient or add "yiisoft/yii2-authclient": "~2.1.0" to the require section of your comp...
function downloadCsv() { var blob = new Blob([csvString]); if (window.navigator.msSaveOrOpenBlob){ window.navigator.msSaveBlob(blob, "filename.csv"); } else { var a = window.document.createElement("a"); a.href = window.URL.createObjectURL(blob, { ...
To get started quickly you could use Spring Initializr to bootstrap your client. Add the Config Client to automatically generate a project with the needed dependencies. Or you could add the dependency manually to an existing Spring Cloud application. <dependency> <groupId>org.spri...
This is a simple RMI example with five Java classes and two packages, server and client. Server Package PersonListInterface.java public interface PersonListInterface extends Remote { /** * This interface is used by both client and server * @return List of Persons * @throws...
Create the source file for your new Client Script Create a new JavaScript file using your favorite editor or IDE Add the following source code to your file (original source here) /** * A simple "Hello, World!" example of a Client Script. Uses the `pageInit` * event to wr...
Create the source file for your new Client Script Create a new JavaScript file using your favorite editor or IDE Add the following source code to your file (original source here) define([], function () { /** * A simple "Hello, World!" example of a Client Script. U...
The Client Script is one of the more commonly used, and complex, script types available to you. As its name implies, the Client Script runs in the browser, i.e. on the client side. It is the only script type that runs on the client side; all others will execute on the server side of NetSuite. The p...

Page 3 of 5