Class ServiceRequestHandler
- java.lang.Object
-
- org.appng.core.controller.handler.ServiceRequestHandler
-
- All Implemented Interfaces:
RequestHandler
public class ServiceRequestHandler extends Object implements RequestHandler
ARequestHandler
which handlesHttpServletRequest
s for different types of services.
The schema for a complete path to a service is<site-domain>/<service-path>/<site-name>/<application-name>/<service-type/<service-name>/<additional-params>
SiteProperties.SERVICE_PATH
.
Supported service-types are:
- webservice
Used for calling aWebservice
orAttachmentWebservice
.
Example:- http://localhost:8080/service/manager/appng-manager/webservice/logViewer<get-params>
- datasource
Used for calling a datasource provided by aApplication
.
Provides different formats: json,xml and html.
Examples:- http://localhost:8080/service/manager/appng-manager/datasource/xml/sites
- http://localhost:8080/service/manager/appng-manager/datasource/json/sites
- action
Used for calling an action provided by aApplication
.
Provides different formats: json,xml and html.
Examples:- http://localhost:8080/service/manager/appng-manager/action/xml/siteEvent/create?form_action=create
- http://localhost:8080/service/manager/appng-manager/action/json/siteEvent/create?form_action=create
- soap
Used for calling aSoapService
provided by aApplication
.
Example (GET for the wsdl):- http://localhost:8080/service/manager/appng-demoapplication/soap/PersonService/PersonService.wsdl
- http://localhost:8080/service/manager/appng-demoapplication/soap/PersonService
- rest
Used for addressing aRestController
offered by anApplication
Example:- http://localhost:8080/service/manager/appng-manager/rest/sites
- http://localhost:8080/service/manager/appng-manager/rest/site/1
- Author:
- Matthias Müller
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
FORMAT_JSON
protected static String
FORMAT_XML
-
Fields inherited from interface org.appng.core.controller.handler.RequestHandler
FORWARDED
-
-
Constructor Summary
Constructors Constructor Description ServiceRequestHandler(MarshallService marshallService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
callWebservice(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, ApplicationRequest applicationRequest, Environment env, Site site, ApplicationProvider application, String webserviceName)
void
handle(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path)
Handles the givenHttpServletRequest
,protected void
handleRest(AccessibleApplication application, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
protected void
handleSoap(Site site, AccessibleApplication application, Environment environment, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
protected String
writeJson(Object data)
-
-
-
Field Detail
-
FORMAT_JSON
protected static final String FORMAT_JSON
- See Also:
- Constant Field Values
-
FORMAT_XML
protected static final String FORMAT_XML
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServiceRequestHandler
public ServiceRequestHandler(MarshallService marshallService)
-
-
Method Detail
-
handle
public void handle(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, Environment environment, Site site, PathInfo path) throws IOException
Description copied from interface:RequestHandler
Handles the givenHttpServletRequest
,- Specified by:
handle
in interfaceRequestHandler
- Parameters:
servletRequest
- the currentHttpServletRequest
servletResponse
- the currentHttpServletResponse
environment
- the currentEnvironment
site
- the currentSite
path
- the currentPathInfo
- Throws:
IOException
- if a resource could not be found
-
writeJson
protected String writeJson(Object data) throws IOException, com.fasterxml.jackson.core.JsonGenerationException, com.fasterxml.jackson.databind.JsonMappingException
- Throws:
IOException
com.fasterxml.jackson.core.JsonGenerationException
com.fasterxml.jackson.databind.JsonMappingException
-
handleSoap
protected void handleSoap(Site site, AccessibleApplication application, Environment environment, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse) throws Exception
- Throws:
Exception
-
handleRest
protected void handleRest(AccessibleApplication application, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse) throws Exception
- Throws:
Exception
-
callWebservice
protected void callWebservice(javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse, ApplicationRequest applicationRequest, Environment env, Site site, ApplicationProvider application, String webserviceName) throws BusinessException, IOException
- Throws:
BusinessException
IOException
-
-