Package org.simple4j.wsfeeler.pojoashttp
Class HTTPExposer
java.lang.Object
org.simple4j.wsfeeler.pojoashttp.HTTPExposer
This class can be used to expose any method in any bean in a Spring ApplicationContext as a HTTP service
-
Constructor Summary
ConstructorsConstructorDescriptionHTTPExposer(org.springframework.context.ApplicationContext context) Constructor with org.springframework.context.ApplicationContext instance as parameter -
Method Summary
Modifier and TypeMethodDescriptionabstract voidexpose()This method will turn on the listener to expose bean methods as web serviceintIdle timeout in milli seconds for the listener thread to be destroyed to reach min thread countintPort number to start the listener atintMax thread count for the listener to serve requestsintMin thread count for the listener to serve requestsURL base path for the listener to expose the serviceprotected StringprocessRequest(String body) voidsetListenerIdleTimeoutMillis(int listenerIdleTimeoutMillis) voidsetListenerPortNumber(int listenerPortNumber) voidsetListenerThreadMax(int listenerThreadMax) voidsetListenerThreadMin(int listenerThreadMin) voidsetUrlBase(String urlBase)
-
Constructor Details
-
HTTPExposer
public HTTPExposer(org.springframework.context.ApplicationContext context) Constructor with org.springframework.context.ApplicationContext instance as parameter- Parameters:
context- - org.springframework.context.ApplicationContext instance
-
-
Method Details
-
expose
public abstract void expose()This method will turn on the listener to expose bean methods as web service -
processRequest
protected String processRequest(String body) throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException, com.fasterxml.jackson.core.JsonProcessingException, com.fasterxml.jackson.databind.JsonMappingException, NoSuchMethodException, InvocationTargetException - Throws:
ClassNotFoundExceptionIllegalAccessExceptionNoSuchFieldExceptioncom.fasterxml.jackson.core.JsonProcessingExceptioncom.fasterxml.jackson.databind.JsonMappingExceptionNoSuchMethodExceptionInvocationTargetException
-
getListenerPortNumber
public int getListenerPortNumber()Port number to start the listener at -
setListenerPortNumber
public void setListenerPortNumber(int listenerPortNumber) -
getListenerThreadMax
public int getListenerThreadMax()Max thread count for the listener to serve requests -
setListenerThreadMax
public void setListenerThreadMax(int listenerThreadMax) -
getListenerThreadMin
public int getListenerThreadMin()Min thread count for the listener to serve requests -
setListenerThreadMin
public void setListenerThreadMin(int listenerThreadMin) -
getListenerIdleTimeoutMillis
public int getListenerIdleTimeoutMillis()Idle timeout in milli seconds for the listener thread to be destroyed to reach min thread count -
setListenerIdleTimeoutMillis
public void setListenerIdleTimeoutMillis(int listenerIdleTimeoutMillis) -
getUrlBase
URL base path for the listener to expose the service -
setUrlBase
-