public class RestServlet extends HttpServlet implements InterfaceContextAware
REST 应用的 Servlet 类,用于以 SCA(服务组件框架)方式发布 REST 服务信息。
| 限定符和类型 | 类和说明 |
|---|---|
class |
RestServlet.AdapterProxy |
| 构造器和说明 |
|---|
RestServlet() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected ServletAdapter |
createServletAdapter(HttpServletRequest request) |
void |
destroy() |
InterfaceContext |
getInterfaceContext()
返回接口上下文。
|
RestServlet.AdapterProxy |
getServletAdapter() |
void |
init(ServletConfig config) |
void |
service(HttpServletRequest request, HttpServletResponse response)
提供从 URI 到 REST 资源的请求转发处理。
|
void |
setInterfaceContext(InterfaceContext context)
设置接口上下文,用于注入接口上下文对象。
|
protected void |
setRestApplication(RestApplication restApplication)
设置Rest 应用
|
void |
setServletAdapter(RestServlet.AdapterProxy adapter) |
public void init(ServletConfig config)
throws ServletException
ServletExceptionpublic void destroy()
public void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
java.io.IOException
提供从 URI 到 REST 资源的请求转发处理。
request - 请求对象。response - 响应对象。ServletException - Servlet 异常。java.io.IOException - 失败或中断的 I/O 操作生成的异常。
protected ServletAdapter createServletAdapter(HttpServletRequest request)
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic InterfaceContext getInterfaceContext()
public void setInterfaceContext(InterfaceContext context)
设置接口上下文,用于注入接口上下文对象。
setInterfaceContext 在接口中 InterfaceContextAwarecontext - 服务接口上下文接口。public RestServlet.AdapterProxy getServletAdapter()
public void setServletAdapter(RestServlet.AdapterProxy adapter)
protected void setRestApplication(RestApplication restApplication)
restApplication -