Class JettyRouteSpec
- java.lang.Object
-
- com.adaptris.core.http.jetty.JettyRouteSpec
-
- All Implemented Interfaces:
ComponentLifecycle
public class JettyRouteSpec extends java.lang.Object implements ComponentLifecycle
Used withJettyRoutingService
to help decide which branch to execute.Since the URI itself may contain parameters that may need to be extracted as metadata, it is possible to do that as part of the matching process here. Given a URL of
/record/zeus/apollo
the following configuration will match provided the HTTP method isPOST
; the URL pattern will be parsed for capturing groups and the metadataparentId=zeus
,childId=apollo
will be set; the next service-id will be set tohandleInsert
.<jetty-route-spec> <condition> <url-pattern>^/record/(.*)/(.*)$</url-pattern> <method>POST</method> <metadata-key>parentId</metadata-key> <metadata-key>childId</metadata-key> </condition> <service-id>handleInsert</service-id> </jetty-route-spec>
ExtractMetadataService
as part of your normal service execution chain.
-
-
Constructor Summary
Constructors Constructor Description JettyRouteSpec()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JettyRouteCondition.JettyRoute
build(java.lang.String method, java.lang.String uri)
void
close()
Closes the component.JettyRouteCondition
getCondition()
The condition that causes a match.java.lang.String
getServiceId()
The service-id that will be used if the route matches.void
init()
Initialises the component.void
setCondition(JettyRouteCondition condition)
The condition that causes a match.void
setServiceId(java.lang.String serviceId)
The service-id that will be used if the route matches.void
start()
Starts the component.void
stop()
Stop the componentjava.lang.String
toString()
JettyRouteSpec
withCondition(JettyRouteCondition condition)
JettyRouteSpec
withServiceId(java.lang.String s)
-
-
-
Method Detail
-
init
public void init() throws CoreException
Description copied from interface:ComponentLifecycle
Initialises the component.Component initialisation includes config verification, creation of connections etc.
- Specified by:
init
in interfaceComponentLifecycle
- Throws:
CoreException
- wrapping any underlyingException
s
-
start
public void start() throws CoreException
Description copied from interface:ComponentLifecycle
Starts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.- Specified by:
start
in interfaceComponentLifecycle
- Throws:
CoreException
- wrapping any underlyingException
s
-
stop
public void stop()
Description copied from interface:ComponentLifecycle
Stop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing aRuntimeException
may cause unintended consequences- Specified by:
stop
in interfaceComponentLifecycle
-
close
public void close()
Description copied from interface:ComponentLifecycle
Closes the component.A closed component should release any connections it uses, etc. and clean up completely. Throwing a
RuntimeException
may cause unintended consequences- Specified by:
close
in interfaceComponentLifecycle
-
withServiceId
public JettyRouteSpec withServiceId(java.lang.String s)
-
withCondition
public JettyRouteSpec withCondition(JettyRouteCondition condition)
-
build
public JettyRouteCondition.JettyRoute build(java.lang.String method, java.lang.String uri) throws CoreException
- Throws:
CoreException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getServiceId
public java.lang.String getServiceId()
The service-id that will be used if the route matches.
-
setServiceId
public void setServiceId(java.lang.String serviceId)
The service-id that will be used if the route matches.
-
getCondition
public JettyRouteCondition getCondition()
The condition that causes a match.
-
setCondition
public void setCondition(JettyRouteCondition condition)
The condition that causes a match.
-
-