mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-24 19:46:36 +01:00
Updated APIv5 PageExtension API (markdown)
parent
34911a8d8d
commit
8b2fac2ae1
@ -56,8 +56,6 @@ public interface Resolver {
|
||||
|
||||
Lets implement a new Resolver one method at a time.
|
||||
|
||||
----
|
||||
|
||||
### `Request`-object
|
||||
|
||||
`Request` object contains everything the HTTP request has, like Request headers, Request method, URI path (`/some/path/somewhere`), URI query (`?some=1&query=example`). In addition it contains Plan specific user information if present.
|
||||
@ -112,8 +110,6 @@ Optional<Response> resolve(Request request) {
|
||||
|
||||
</details>
|
||||
|
||||
----
|
||||
|
||||
### `canAccess`-method
|
||||
|
||||
This method should check if the user viewing the URL is allowed to do so.
|
||||
@ -153,8 +149,6 @@ Rest of the `Request` methods can be used for more granular access control.
|
||||
> - This method is not called if authentication is not enabled
|
||||
> - Implement `NoAuthResolver` if response should always be given
|
||||
|
||||
----
|
||||
|
||||
### `resolve`-method
|
||||
|
||||
This method links `Request`s to appropriate `Response` objects.
|
||||
@ -207,8 +201,6 @@ public class ResponseBuilder {
|
||||
- Response status code is `200` (OK) by default
|
||||
- It is recommended to `setMimeType` before setting content.
|
||||
|
||||
----
|
||||
|
||||
### Building
|
||||
|
||||
Following qualities are **required**:
|
||||
@ -224,8 +216,6 @@ Some methods of the builder set mimetype and content automatically:
|
||||
- `setJSONContent`
|
||||
- `setContent(String)` adds `"; charset=utf-8"` to the MimeType if mimetype was set before the call.
|
||||
|
||||
----
|
||||
|
||||
### Examples
|
||||
|
||||
```java
|
||||
@ -321,8 +311,6 @@ svc.getResource("PluginName", "example.html", () -> WebResource.create(content))
|
||||
- If the resource name ends with .html, it is possible for other API users to add javascript or stylesheet snippets to it.
|
||||
- After this call Plan will add a config option so that user can customize the file if they wish to do so.
|
||||
|
||||
----
|
||||
|
||||
### `WebResource`-class
|
||||
|
||||
This class represents the resource, and can be created with following static methods:
|
||||
|
Loading…
Reference in New Issue
Block a user