public abstract class RestMethodHandler extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
isBodyJsonDecode |
protected Set<HttpRestHandler.METHOD> |
methods |
protected String |
name |
protected String |
path |
protected RestConfiguration |
restConfiguration |
Modifier | Constructor and Description |
---|---|
protected |
RestMethodHandler(String name,
String path,
boolean isBodyJsonDecode,
RestConfiguration config,
HttpRestHandler.METHOD... method) |
Modifier and Type | Method and Description |
---|---|
abstract void |
checkHandlerSessionCorrectness(HttpRestHandler handler,
RestArgument arguments,
RestArgument result)
Check the session (arguments, result) vs handler correctness, called
before
any BODY elements but after URI
and HEADER.
|
abstract void |
endParsingRequest(HttpRestHandler handler,
RestArgument arguments,
RestArgument result,
Object body)
Called when all Data were passed to the handler
|
abstract Object |
getBody(HttpRestHandler handler,
io.netty.buffer.ByteBuf body,
RestArgument arguments,
RestArgument result)
Get data from BODY (supposedly a Json)
|
protected abstract com.fasterxml.jackson.databind.node.ArrayNode |
getDetailedAllow() |
abstract void |
getFileUpload(HttpRestHandler handler,
io.netty.handler.codec.http.multipart.FileUpload data,
RestArgument arguments,
RestArgument result)
Get a new Http Uploaded File from BODY
|
String |
getName() |
String |
getPath() |
io.netty.handler.codec.http.HttpResponseStatus |
handleException(HttpRestHandler handler,
RestArgument arguments,
RestArgument result,
Object body,
Exception exception)
Called when an exception occurs
|
boolean |
isBodyJsonDecoded() |
boolean |
isMethodIncluded(HttpRestHandler.METHOD method) |
protected void |
optionsCommand(HttpRestHandler handler,
RestArgument arguments,
RestArgument result)
Options command that all handler should implement
|
protected io.netty.channel.ChannelFuture |
sendOptionsResponse(HttpRestHandler handler,
io.netty.channel.ChannelHandlerContext ctx,
RestArgument result,
io.netty.handler.codec.http.HttpResponseStatus status) |
abstract io.netty.channel.ChannelFuture |
sendResponse(HttpRestHandler handler,
io.netty.channel.ChannelHandlerContext ctx,
RestArgument arguments,
RestArgument result,
Object body,
io.netty.handler.codec.http.HttpResponseStatus status)
Send a response (correct or not)
|
protected void |
setIntersectionMethods(HttpRestHandler.METHOD[] selectedMethods,
HttpRestHandler.METHOD... validMethod)
Will assign the intersection of both set of Methods
|
protected void |
setMethods(HttpRestHandler.METHOD... method) |
protected final String name
protected final String path
protected final Set<HttpRestHandler.METHOD> methods
protected final boolean isBodyJsonDecode
protected final RestConfiguration restConfiguration
protected RestMethodHandler(String name, String path, boolean isBodyJsonDecode, RestConfiguration config, HttpRestHandler.METHOD... method)
name
- name associated with this Method Handler (to enable
some
HashMap or Enum
classification)path
- associated base PathisBodyJsonDecode
- Is this method Handler using a Json as
Bodyconfig
- the associated configurationmethod
- the associated methodsprotected void setMethods(HttpRestHandler.METHOD... method)
protected void setIntersectionMethods(HttpRestHandler.METHOD[] selectedMethods, HttpRestHandler.METHOD... validMethod)
selectedMethods
- the selected Methods among availablevalidMethod
- the validMethod for this handlerpublic String getName()
public String getPath()
public boolean isMethodIncluded(HttpRestHandler.METHOD method)
method
- public abstract void checkHandlerSessionCorrectness(HttpRestHandler handler, RestArgument arguments, RestArgument result) throws HttpForbiddenRequestException
handler
- arguments
- result
- HttpForbiddenRequestException
public abstract void getFileUpload(HttpRestHandler handler, io.netty.handler.codec.http.multipart.FileUpload data, RestArgument arguments, RestArgument result) throws HttpIncorrectRequestException
handler
- data
- arguments
- result
- HttpIncorrectRequestException
public abstract Object getBody(HttpRestHandler handler, io.netty.buffer.ByteBuf body, RestArgument arguments, RestArgument result) throws HttpIncorrectRequestException
handler
- body
- arguments
- result
- HttpIncorrectRequestException
public abstract void endParsingRequest(HttpRestHandler handler, RestArgument arguments, RestArgument result, Object body) throws HttpIncorrectRequestException, HttpInvalidAuthenticationException, HttpNotFoundRequestException
handler
- arguments
- result
- body
- HttpIncorrectRequestException
HttpNotFoundRequestException
HttpInvalidAuthenticationException
public io.netty.handler.codec.http.HttpResponseStatus handleException(HttpRestHandler handler, RestArgument arguments, RestArgument result, Object body, Exception exception)
handler
- arguments
- result
- body
- exception
- public abstract io.netty.channel.ChannelFuture sendResponse(HttpRestHandler handler, io.netty.channel.ChannelHandlerContext ctx, RestArgument arguments, RestArgument result, Object body, io.netty.handler.codec.http.HttpResponseStatus status)
handler
- ctx
- arguments
- result
- body
- status
- protected io.netty.channel.ChannelFuture sendOptionsResponse(HttpRestHandler handler, io.netty.channel.ChannelHandlerContext ctx, RestArgument result, io.netty.handler.codec.http.HttpResponseStatus status)
protected void optionsCommand(HttpRestHandler handler, RestArgument arguments, RestArgument result)
handler
- arguments
- result
- protected abstract com.fasterxml.jackson.databind.node.ArrayNode getDetailedAllow()
public boolean isBodyJsonDecoded()
Copyright © 2009–2020 Waarp. All rights reserved.