WebService implementation example based on rest mechanism (Java edition)
Rest is the abbreviation for the Representational state transfer (general Chinese translation is a descriptive status transfer). 2000 Roy Fielding in his Ph. D. thesis "Architectural Styles and the design of network-based Software architectures" Architecture and web-based Software architecture Design "Rest" is proposed.
Rest is an arch
We basically go through a Web browser every day, going through some news, watching videos and the like.As we all know, this is the so-called B/s structure (browser/server, browser/server mode), is the web after the rise of a network structure pattern, web browser is the client's most important application software.That's it. Simply look at what the basic implementation principle is for a Web
Java to implement IO communication (server article)How to use Java to implement our communications? First we understand what communication is? What is the mechanism of communication?Let's start with a discussion of what is communication? Communication refers to the exchange and transmission of information between a person and a person or a person and nature throu
Introduction??In order to learn Java network programming, with a qq ( Dick Silk version ) as an example practiced hand, recorded the development process of the Dick Silk version of QQ , here we think we have mastered the basic part of the network, that is, the HTTP protocol,TCP/IP protocol, etc., on this basis we start our Java Network part of the learning, we wa
Software for external publishing of Web resources Web ResourcesThe resources that exist in the Web application server that are accessible to the outside world are Web resourcesFor example: HTML, Css, JS, pictures, videos, etc. that exist inside the Web application serverStatic resources: Data that is accessible to people in a Web page is always the same. For
HTTP answer code, also known as a status code, reflects the state of the Web server processing HTTP requests. The HTTP answer code consists of 3 digits, with the first number defining the type of the answer code:
1xx-Information Class (information), which indicates receipt of a Web browser request, is being further processed
2xx-Success Class (successful), which indicates that user requests are received correctly, understood and p
1. It proves that Java program is run everywhere at once, and also proves the cross-platform feature of Java program, basically do not make great changes to run the program normally;2. The physical separation between the data layer and the business layer is done, and Windows is made a database server and Linux as a Web server
Why use a thread pool
For server-side programs, it is often the client incoming short (short execution time, relatively single work content) task, requiring the server to quickly process and return results. If the server receives one task at a time, creating a thread and executing it is a good choice in the prototype phase, but it is not a good choice to create
clientDos.writeutf ("Accept connection request, connection successful!")); //when you do not need to continue using this connection, close the connectionSocket.close (); Ss.close (); } Catch(IOException e) {e.printstacktrace (); }}}2. Client code PackageCom.lanber.socket;import Java.io.DataInputStream;ImportJava.io.dataoutputstream;import java.io.IOException;ImportJava.io.OutputStream;ImportJava.net.Socket;Importjava.net.UnknownHostException; Public classClientdemo {/***@paramargs*/ Pu
The example RMI is the specification of a remote invocation of the Java platform, and here is a small example of the native test passing
A total of three Java classes, remote interfaces, server-side programs, client programs
Remote interface:
Import java.rmi.*;
Public in
1. How to Implement cache using Java?
Java has its own cache Input and Output classes, such as inputstream and fileoutputstram, which can be viewed by the API. If you want to implement it by yourself, you can set a byte array that is large enough, put what you need into the cache.
1. Why does cache exist?Generally, a website or an application requests the application
On the server side, if implemented in the Java language, it is JavaServer Pages (JSPs) and servlets that deal directly with browsers. Behind them are the data Beans, DB Beans, and commands that are implemented through Java.
1. Java Server Pages (JSPs)
JavaServer pages (JSP
done in the previous PHP example. Each request generates a new thread, and the various I/O operations in the thread are blocked until the request is fully processed. To minimize the cost of creating and destroying them, threads are pooled, but still, thousands of connections mean thousands of threads, which is bad for the scheduler.
An important milestone is the ability to perform non-blocking I/O calls in the J
done in the previous PHP example. Each request generates a new thread, and the various I/O operations in the thread are blocked until the request is fully processed. To minimize the cost of creating and destroying them, threads are pooled, but still, thousands of connections mean thousands of threads, which is bad for the scheduler.
An important milestone is the ability to perform non-blocking I/O calls in the J
RMI is an RPC framework in the Java language, this article gives the following basic examples:1. Implement the interface: Public Interface extends Remote { publicint Add (intintthrows java.rmi.RemoteException;}2, the server to implement the interface: Public classCalcimplextendsUnicastRemoteObjectImplementsIcalc {protectedCalcimpl ()throwsRemoteException {Super(); } @Override Public intAddintPARAM1,intp
This article will introduce in detail how to implement a simple HTTP Server Based on the Java language. This article will mainly introduce three aspects: 1) Basic knowledge of the HTTP protocol, 2) java.net. socket class, 3) java.net. serversocket class. After reading this article, you can rewrite this server with multi-thread technology to a better
This example describes the use of various methods of the request object in Java. Share to everyone for your reference, specific as follows:
The request object is to issue requests from the client to the server, including information submitted by the user and some information from the client. The request object is an implementation instance of the Javax.servlet.h
The socket is also called a socket, and the application usually makes a request to the network through a "socket" or answers a network request.Java has simplified the programming interface for sockets. Java provides serversocket to support it. In fact, when creating an instance object of the class and providing a port resource, a fixed location can be set up for other computers to access, such as: ServerSocket ser
----Summary: Before the advent of Java, writing multithreaded programs is a cumbersome and fraught with many unsafe factors. With Java, it is easy to write secure and efficient multithreaded programs, and we can easily implement multi-threaded server program with multithreading and Java network package.
----
prepare you for asynchronous blocking of Io APIs.Three, separation fast and slow 3.1 bio limitationsCPU and memory are high-speed devices, disk, network and other IO devices are low-speed devices, in the Java programming language, the use of CPU and memory is abstracted to the use of threads, stacks, heaps, the use of IO devices is abstracted as IO-related API calls.Obviously, if the bio-style IO API is used, because of its synchronous blocking featu
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.