Class JettyRouteSpec

  • All Implemented Interfaces:
    ComponentLifecycle

    public class JettyRouteSpec
    extends java.lang.Object
    implements ComponentLifecycle
    Used with JettyRoutingService 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 is POST; the URL pattern will be parsed for capturing groups and the metadata parentId=zeus, childId=apollo will be set; the next service-id will be set to handleInsert.

       
          <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>
       
     
    You could achieve the same effect with a ExtractMetadataService as part of your normal service execution chain.

    • Constructor Detail

      • JettyRouteSpec

        public JettyRouteSpec()
    • Method Detail

      • stop

        public void stop()
        Description copied from interface: ComponentLifecycle
        Stop the component

        A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer, calling stop will pause message delivery. Throwing a RuntimeException may cause unintended consequences

        Specified by:
        stop in interface ComponentLifecycle
      • 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 interface ComponentLifecycle
      • withServiceId

        public JettyRouteSpec withServiceId​(java.lang.String s)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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.
      • setCondition

        public void setCondition​(JettyRouteCondition condition)
        The condition that causes a match.