com.supermap.services.rest
Class JaxrsServletForJersey
- java.lang.Object
-
- HttpServlet
-
- com.supermap.services.rest.JaxrsServletForJersey
-
- All Implemented Interfaces:
- InterfaceContextAware
- Direct Known Subclasses:
- DistributeAnalystServlet
public class JaxrsServletForJersey extends HttpServlet implements InterfaceContextAware
The Servlet class of JAX-RS standard based REST application, which is used for publishing REST service information by using SCA method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classJaxrsServletForJersey.JerseyServletConfigThe Servlet config class of REST application based on JaX-RS standard.protected static classJaxrsServletForJersey.RequestNotCompleteExceptionRequest incomplete exception, which means the current request is just a part of complete request.protected static classJaxrsServletForJersey.RequestWrapperHTTP request handling class, which is used to transform the URI path.
-
Constructor Summary
Constructors Constructor and Description JaxrsServletForJersey()The constructor.
-
Method Summary
Methods Modifier and Type Method and Description protected JaxrsServletForJersey.RequestWrappercreateRequestWrapper(HttpServletRequest request)Creates request object handle class, to generate the request object corresponding to the Servlet.voiddestroy()Destroys object.java.lang.StringgetId()InterfaceContextgetInterfaceContext()Gets the service interface context.protected java.lang.StringgetJaxrsApplicationName()Gets the Jaxts application name.protected ServletContainergetServletContainer()Gets the Servlet container.protected java.lang.StringgetURLQueryParamValue(HttpServletRequest request, java.lang.String paramName)Gets the specified query parameter in the request url, if there is parameters with the same name, the return value will use "%_" to separate the parameters.JaxrsServletForJersey.JerseyServletConfignewJerseyServletConfig(ServletConfig servletConfig)voidservice(HttpServletRequest request, HttpServletResponse response)Provides the request forward processing from URI to REST resource.voidsetInterfaceContext(InterfaceContext interfaceContext)Sets the service interface context to inject interface context object.voidsetJaxrsApplication(javax.ws.rs.core.Application value)voidsetJaxrsApplicationClass(java.lang.Class<? extends javax.ws.rs.core.Application> clz)Sets the Jaxts application class.voidsetJaxrsApplicationName(java.lang.String value)Sets the Jaxts application name.protected voidsetMockRequestEntity(JaxrsServletForJersey.RequestWrapper request)Sets the mocked request body.
-
-
-
Method Detail
-
getInterfaceContext
public InterfaceContext getInterfaceContext()
Gets the service interface context.
- Returns:
- The service interface context.
-
setInterfaceContext
public void setInterfaceContext(InterfaceContext interfaceContext)
Sets the service interface context to inject interface context object.
- Specified by:
setInterfaceContextin interfaceInterfaceContextAware- Parameters:
interfaceContext- The service interface context interface.
-
service
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOExceptionProvides the request forward processing from URI to REST resource.
- Parameters:
request- The request object.response- The response object.- Throws:
ServletException- Servlet exception.java.io.IOException- Exception generated by I/O operation failure or break.
-
destroy
public void destroy()
Destroys object.
-
createRequestWrapper
protected JaxrsServletForJersey.RequestWrapper createRequestWrapper(HttpServletRequest request) throws JaxrsServletForJersey.RequestNotCompleteException
Creates request object handle class, to generate the request object corresponding to the Servlet.
- Parameters:
request- The request object.- Returns:
- HTTP request handle object.
- Throws:
JaxrsServletForJersey.RequestNotCompleteException- Request incomplete exception.
-
setMockRequestEntity
protected void setMockRequestEntity(JaxrsServletForJersey.RequestWrapper request) throws JaxrsServletForJersey.RequestNotCompleteException
Sets the mocked request body.- Parameters:
request-- Throws:
JaxrsServletForJersey.RequestNotCompleteException
-
getURLQueryParamValue
protected java.lang.String getURLQueryParamValue(HttpServletRequest request, java.lang.String paramName)Gets the specified query parameter in the request url, if there is parameters with the same name, the return value will use "%_" to separate the parameters. The return values are decoded.
-
getServletContainer
protected ServletContainer getServletContainer()
Gets the Servlet container.
- Returns:
-
getJaxrsApplicationName
protected java.lang.String getJaxrsApplicationName()
Gets the Jaxts application name.
- Returns:
-
setJaxrsApplicationName
public void setJaxrsApplicationName(java.lang.String value)
Sets the Jaxts application name.
- Parameters:
value-- Since:
- 7.0.1
-
setJaxrsApplication
public void setJaxrsApplication(javax.ws.rs.core.Application value)
-
setJaxrsApplicationClass
public void setJaxrsApplicationClass(java.lang.Class<? extends javax.ws.rs.core.Application> clz)
Sets the Jaxts application class. It is equivalent to call etJaxrsApplicationName(clz.getName()).
- Parameters:
clz-- Since:
- 7.0.1
-
newJerseyServletConfig
public JaxrsServletForJersey.JerseyServletConfig newJerseyServletConfig(ServletConfig servletConfig)
-
getId
public java.lang.String getId()
-
-