Package org.citrusframework.http.server
Class HttpServer
java.lang.Object
org.citrusframework.endpoint.AbstractEndpoint
org.citrusframework.server.AbstractServer
org.citrusframework.http.server.HttpServer
- All Implemented Interfaces:
Runnable,InitializingPhase,Named,ShutdownPhase,Endpoint,Server,ReferenceResolverAware
Simple Http server implementation starting an embedded Jetty server instance with
Spring Application context support. Incoming requests are handled with Spring MVC.
- Since:
- 2007
- Author:
- Christoph Deppisch
-
Field Summary
Fields inherited from class org.citrusframework.server.AbstractServer
DEFAULT_CHANNEL_ID_SUFFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigure(org.eclipse.jetty.servlet.ServletContextHandler contextHandler) Subclasses may add additional configuration on context handler.List<org.springframework.http.MediaType>Gets the binaryMediaTypes.org.eclipse.jetty.server.ConnectorGets the connector.org.eclipse.jetty.server.Connector[]Gets the connectors.Gets the contextConfigLocation.Gets the contextPath.intGets the defaultStatusCode.protected org.springframework.web.servlet.DispatcherServletGets the Citrus dispatcher servlet.Gets the value of the filterMappings property.Gets the map of the filters.Gets the message converter.intgetPort()Gets the port.Gets the resourceBase.intGets the response cache size.org.eclipse.jetty.security.SecurityHandlerGets the securityHandler.org.eclipse.jetty.servlet.ServletHandlerGets the servletHandler.Gets the servletMappingPath.Gets the customized servlet name or default name if not set.voidbooleanGets the handleAttributeHeaders.booleanGets the handleCookies.booleanGets the useRootContextAsParent.voidsetBinaryMediaTypes(List<org.springframework.http.MediaType> binaryMediaTypes) Sets the binaryMediaTypes.voidsetConnector(org.eclipse.jetty.server.Connector connector) Sets the connector.voidsetConnectors(org.eclipse.jetty.server.Connector[] connectors) Sets the connectors.voidsetContextConfigLocation(String contextConfigLocation) Sets the contextConfigLocation.voidsetContextPath(String contextPath) Sets the contextPath.voidsetDefaultStatusCode(int defaultStatusCode) Sets the defaultStatusCode.voidsetFilterMappings(Map<String, String> filterMappings) Sets the filterMappings property.voidsetFilters(Map<String, jakarta.servlet.Filter> filters) Sets the map of filters.voidsetHandleAttributeHeaders(boolean handleAttributeHeaders) Sets the handleAttributeHeaders.voidsetHandleCookies(boolean handleCookies) Sets the handleCookies.voidsetMessageConverter(HttpMessageConverter messageConverter) Sets the message converter.voidsetPort(int port) Sets the port.voidsetResourceBase(String resourceBase) Sets the resourceBase.voidsetResponseCacheSize(int responseCacheSize) Sets the response cache size.voidsetSecurityHandler(org.eclipse.jetty.security.SecurityHandler securityHandler) Sets the securityHandler.voidsetServletHandler(org.eclipse.jetty.servlet.ServletHandler servletHandler) Sets the servletHandler.voidsetServletMappingPath(String servletMappingPath) Sets the servletMappingPath.voidsetServletName(String servletName) Sets the servletName.voidsetUseRootContextAsParent(boolean useRootContextAsParent) Sets the useRootContextAsParent.protected voidshutdown()protected voidstartup()Methods inherited from class org.citrusframework.server.AbstractServer
createConsumer, createProducer, destroy, getDefaultTimeout, getEndpointAdapter, getEndpointConfiguration, getInterceptors, getReferenceResolver, isAutoStart, isDebugLogging, isRunning, join, run, setAutoStart, setDebugLogging, setDefaultTimeout, setEndpointAdapter, setInterceptors, setReferenceResolver, setRunning, start, stopMethods inherited from class org.citrusframework.endpoint.AbstractEndpoint
getActor, getConsumerName, getName, getProducerName, setActor, setName
-
Constructor Details
-
HttpServer
public HttpServer()
-
-
Method Details
-
shutdown
protected void shutdown()- Specified by:
shutdownin classAbstractServer
-
startup
protected void startup()- Specified by:
startupin classAbstractServer
-
configure
protected void configure(org.eclipse.jetty.servlet.ServletContextHandler contextHandler) Subclasses may add additional configuration on context handler.- Parameters:
contextHandler-
-
initialize
public void initialize()- Specified by:
initializein interfaceInitializingPhase- Overrides:
initializein classAbstractServer
-
getDispatcherServlet
protected org.springframework.web.servlet.DispatcherServlet getDispatcherServlet()Gets the Citrus dispatcher servlet.- Returns:
-
getServletName
Gets the customized servlet name or default name if not set.- Returns:
- the servletName
-
getPort
public int getPort()Gets the port.- Returns:
- the port to get.
-
setPort
public void setPort(int port) Sets the port.- Parameters:
port- the port to set
-
getResourceBase
Gets the resourceBase.- Returns:
- the resourceBase to get.
-
setResourceBase
Sets the resourceBase.- Parameters:
resourceBase- the resourceBase to set
-
getContextConfigLocation
Gets the contextConfigLocation.- Returns:
- the contextConfigLocation to get.
-
setContextConfigLocation
Sets the contextConfigLocation.- Parameters:
contextConfigLocation- the contextConfigLocation to set
-
getConnector
public org.eclipse.jetty.server.Connector getConnector()Gets the connector.- Returns:
- the connector to get.
-
setConnector
public void setConnector(org.eclipse.jetty.server.Connector connector) Sets the connector.- Parameters:
connector- the connector to set
-
setFilters
Sets the map of filters.- Parameters:
filters-
-
getFilters
Gets the map of the filters.- Returns:
- the filters
-
setFilterMappings
Sets the filterMappings property.- Parameters:
filterMappings-
-
getFilterMappings
Gets the value of the filterMappings property.- Returns:
- the filterMappings
-
getConnectors
public org.eclipse.jetty.server.Connector[] getConnectors()Gets the connectors.- Returns:
- the connectors
-
setConnectors
public void setConnectors(org.eclipse.jetty.server.Connector[] connectors) Sets the connectors.- Parameters:
connectors- the connectors to set
-
getServletMappingPath
Gets the servletMappingPath.- Returns:
- the servletMappingPath to get.
-
setServletMappingPath
Sets the servletMappingPath.- Parameters:
servletMappingPath- the servletMappingPath to set
-
getContextPath
Gets the contextPath.- Returns:
- the contextPath to get.
-
setContextPath
Sets the contextPath.- Parameters:
contextPath- the contextPath to set
-
getSecurityHandler
public org.eclipse.jetty.security.SecurityHandler getSecurityHandler()Gets the securityHandler.- Returns:
- the securityHandler to get.
-
setSecurityHandler
public void setSecurityHandler(org.eclipse.jetty.security.SecurityHandler securityHandler) Sets the securityHandler.- Parameters:
securityHandler- the securityHandler to set
-
getServletHandler
public org.eclipse.jetty.servlet.ServletHandler getServletHandler()Gets the servletHandler.- Returns:
- the servletHandler to get.
-
setServletHandler
public void setServletHandler(org.eclipse.jetty.servlet.ServletHandler servletHandler) Sets the servletHandler.- Parameters:
servletHandler- the servletHandler to set
-
setServletName
Sets the servletName.- Parameters:
servletName- the servletName to set
-
isUseRootContextAsParent
public boolean isUseRootContextAsParent()Gets the useRootContextAsParent.- Returns:
- the useRootContextAsParent to get.
-
setUseRootContextAsParent
public void setUseRootContextAsParent(boolean useRootContextAsParent) Sets the useRootContextAsParent.- Parameters:
useRootContextAsParent- the useRootContextAsParent to set
-
getMessageConverter
Gets the message converter.- Returns:
-
setMessageConverter
Sets the message converter.- Parameters:
messageConverter-
-
isHandleAttributeHeaders
public boolean isHandleAttributeHeaders()Gets the handleAttributeHeaders.- Returns:
-
setHandleAttributeHeaders
public void setHandleAttributeHeaders(boolean handleAttributeHeaders) Sets the handleAttributeHeaders.- Parameters:
handleAttributeHeaders-
-
isHandleCookies
public boolean isHandleCookies()Gets the handleCookies.- Returns:
-
setHandleCookies
public void setHandleCookies(boolean handleCookies) Sets the handleCookies.- Parameters:
handleCookies-
-
getResponseCacheSize
public int getResponseCacheSize()Gets the response cache size.- Returns:
-
setResponseCacheSize
public void setResponseCacheSize(int responseCacheSize) Sets the response cache size.- Parameters:
responseCacheSize-
-
getDefaultStatusCode
public int getDefaultStatusCode()Gets the defaultStatusCode.- Returns:
-
setDefaultStatusCode
public void setDefaultStatusCode(int defaultStatusCode) Sets the defaultStatusCode.- Parameters:
defaultStatusCode-
-
getBinaryMediaTypes
Gets the binaryMediaTypes.- Returns:
-
setBinaryMediaTypes
Sets the binaryMediaTypes.- Parameters:
binaryMediaTypes-
-