Interface ServerCallback
- All Superinterfaces:
FunctionPointer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
ServerCallback callback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidA callback used to handle requests to aServer.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)method.default voidupcall(MemorySegment server, MemorySegment msg, MemorySegment path, MemorySegment query, MemorySegment userData) Theupcallmethod is called from native code.
-
Method Details
-
run
A callback used to handle requests to aServer.pathandquerycontain the likewise-named components of the Request-URI, subject to certain assumptions. By default,Serverdecodes all percent-encoding in the URI path, such that"/foo%2Fbar"is treated the same as"/foo/bar". If your server is serving resources in some non-POSIX-filesystem namespace, you may want to distinguish those as two distinct paths. In that case, you can set theServer:raw-pathsproperty when creating theServer, and it will leave those characters undecoded.querycontains the query component of the Request-URI parsed according to the rules for HTML form handling. Although this is the only commonly-used query string format in HTTP, there is nothing that actually requires that HTTP URIs use that format; if your server needs to use some other format, you can just ignorequery,and callMessage.getUri()and parse the URI's query field yourself.See
Server.addHandler(java.lang.String, org.gnome.soup.ServerCallback)andServer.addEarlyHandler(java.lang.String, org.gnome.soup.ServerCallback)for details of what handlers can/should do. -
upcall
default void upcall(MemorySegment server, MemorySegment msg, MemorySegment path, MemorySegment query, MemorySegment userData) Theupcallmethod is called from native code. The parameters are marshaled andrun(org.gnome.soup.Server, org.gnome.soup.ServerMessage, java.lang.String, org.gnome.glib.HashTable<java.lang.String, java.lang.String>)is executed. -
toCallback
Creates a native function pointer to theupcall(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-