📧 [email protected]
Bethibande#8532
bethibande / jwebapi Goto Github PK
View Code? Open in Web Editor NEWA simple framework for easy creation of simple http servers/clients
License: Apache License 2.0
A simple framework for easy creation of simple http servers/clients
License: Apache License 2.0
📧 [email protected]
Bethibande#8532
.removeHandler(String uri);
Store OutputHandler instances insteadof classes, removes need to create instances on the fly.
For more info, see TODO item in HttpHandler
currently, every log message submits a new task to the thread-pool, this is obviously not good. Sometimes the logger also stops printing messages completely, this has not yet been debuged, but is probably caused by this. The goal of this issue is, to now only use one static thread to print all queued message of a logger
Currently, the status message of the http response header sent by the server is always "OK" regardless of the status code
Resolve some of the warnings shown by intellij
There needs to be a priority used to define which handlers get checked and subsequently executed first.
At the moment there is no way to do this. I want to be able to define a handler with the uri "/" and the type string which will act as a 404 error handler. At the moment this handler, depending on when it is registered, will prevent other handlers from being executed. In order for this handler to work as intented, it needs a priority making sure, it is always the last entry in the list of handlers.
Should look something like this
@URI(value = "/", type = URI.URIType.STRING, priority = Integer.MIN_VALUE)
public Object notFoundHandler() {
Store a Gson instance in the server or context, this allows for people to customize the gson instance used by all classes
Cache parameter mappings for constructors and methods. This prevents having to apply all ParameterProcessors to every parameter with every request. Creating mappings of which ParameterProcessor needs to be applied to which parameter will increase performance.
After before the first version containing the client is built, some things have to be cleaned up. There are lots of methods and classes used by the server that are now redundant. And should be replace with classes and methods added during client development.
Create URIObject and replace URI class in JWebServer methods HashMap
Not sure as to what this is supposed to look like or wheter it's actually needed or not
Create a RequestParameterProcessor class, which is an abstract class and implements ParameterProcessor, this class should only fire if the request is not empty and only has a server instance
Register all classes annotated with an annotation as handlers, without having to register each class individually.
Perhaps even add a value to said annotation, and make it ignore all annotated classes that don't have a certain value.
By default the JWebServer class uses the com.sun.net.httpserver.HttpServer class. The experimental branch has a custom implementation of this class, that does not implement a lot of features like the HttpContext class and more, due to this, the custom server implementation is quite a bit faster than the default com.sun.net.httpserver.HttpServer class. Use this class as a default instead.
Before that, the HttpServer and HttpExchange classes have to implement a few important features like the stop method.
Add a method for adding handlers using the Function interface, instead of implementing handlers as methods using the @uri annotation. The method should look something like this:
.registerHandler(String uri, Function<ServerContext, Object> fun);
Allow for there to be more than one instance per repository class per client instance. And allow for each repository class to have its own base-url
Stopping the custom HttpServer implementation stops the ThreadPoolExecutor of the server, this same executor may be used by other servers and thus should not be stopped.
Add a proper Logger and debug messages
private Function<Request, Headers> headerSupplier;
The ClientHandler class currently has two nested for loops, these are unnecessary and should be replace with pre calculated mappings like the ones the server uses for its parameter processors.
register individual methods instead of registering all methods within a certain class
jwebserver.registerMethod(Method method);
jwebserver.registerMethod(Class class, String methodName, Class... methodSignature);
No idea what this is gonna look like, but something like this would certainly be convenient to have.
The logger seems to print mm:hh insead of hh:mm, minutes and hours are swapped. The format should obviously be hh:mm
if there is a method declared as
@URI("/test")
public Object test(
@PostData YourObject obj
) {
obj.doSomething();
return someValue;
}
the annotation is supposed to read the post data and turn it into a YourObject instance and pass it into the method.
Create an experimental branch, for experiments, like Custom HttpServer implementations or more.
@URI("/test")
public class Test {
@URI("/helloWorld")
public Object test() {
return [...];
}
}
Should result in uri "/test/helloWorld" for method test()
Needs #3 to be implemented first
Add UpdateTimeout value into cache and cache config and subsequently remove update timeouts stored in JWebServer and Session classes. Note: Make Cache.update() method return a boolean, to show whether or not the cache was updated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.