Package org.yamcs.http
Class HandlerContext
java.lang.Object
org.yamcs.http.HandlerContext
-
Constructor Summary
ConstructorsConstructorDescriptionHandlerContext
(String contextPath, io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req) -
Method Summary
Modifier and TypeMethodDescriptionio.netty.buffer.ByteBuf
String[]
getCredentials
(String type) getFormParameter
(String parameter) getHeader
(CharSequence name) io.netty.channel.ChannelHandlerContext
io.netty.handler.codec.http.FullHttpRequest
getParameter
(String parameter) getQueryParameter
(String parameter) Attempts to derive the externally used URL to Yamcs based on request informationboolean
boolean
isGET()
boolean
isPOST()
void
render
(io.netty.handler.codec.http.HttpResponseStatus status, String templateResource, Map<String, Object> vars) void
renderToString
(String templateResource, Map<String, Object> vars) void
requireFormParameter
(String parameter) void
void
requireMethod
(io.netty.handler.codec.http.HttpMethod... allowedMethods) requireParameter
(String parameter) void
requireQueryParameter
(String parameter) void
sendOK()
void
sendOK
(com.google.gson.JsonObject jsonObject) void
sendOK
(com.google.protobuf.Message message) void
sendRedirect
(String location) io.netty.channel.ChannelFuture
sendResponse
(io.netty.handler.codec.http.HttpResponse response)
-
Constructor Details
-
HandlerContext
public HandlerContext(String contextPath, io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http.FullHttpRequest req)
-
-
Method Details
-
getRequestBaseURL
Attempts to derive the externally used URL to Yamcs based on request information- Returns:
- a url of the form [protocol]://[host]:[port][context]
-
getNettyChannelHandlerContext
public io.netty.channel.ChannelHandlerContext getNettyChannelHandlerContext() -
getNettyFullHttpRequest
public io.netty.handler.codec.http.FullHttpRequest getNettyFullHttpRequest() -
getContextPath
-
getPathWithoutContext
-
isGET
public boolean isGET() -
isPOST
public boolean isPOST() -
requireGET
public void requireGET() -
requirePOST
public void requirePOST() -
requireMethod
public void requireMethod(io.netty.handler.codec.http.HttpMethod... allowedMethods) -
requireFormEncoding
public void requireFormEncoding() -
requireFormParameter
-
requireQueryParameter
-
requireParameter
-
getHeader
-
isFormEncoded
public boolean isFormEncoded() -
getCredentials
-
getBasicCredentials
-
getFormParameter
-
getQueryParameter
-
getParameter
-
createByteBuf
public io.netty.buffer.ByteBuf createByteBuf() -
renderOK
-
render
-
renderToString
-
sendOK
public void sendOK() -
sendOK
public void sendOK(com.google.protobuf.Message message) -
sendOK
public void sendOK(com.google.gson.JsonObject jsonObject) -
sendResponse
public io.netty.channel.ChannelFuture sendResponse(io.netty.handler.codec.http.HttpResponse response) -
sendRedirect
-