// Path: core/src/main/java/au/com/sensis/stubby/service/model/StubServiceResult.java
// public class StubServiceResult { // returned by the 'findMatch' method
// 
//     private List<MatchResult> attempts;
//     private StubResponse response;
//     private Long delay;
// 
//     public StubServiceResult(List<MatchResult> attempts) {
//         this.attempts = attempts;
//     }
// 
//     public StubServiceResult(List<MatchResult> attempts, StubResponse response, Long delay) {
//         this.attempts = attempts;
//         this.response = response;
//         this.delay = delay;
//     }
// 
//     public boolean matchFound() {
//         for (MatchResult attempt : attempts) {
//             if (attempt.matches()) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
//     public StubResponse getResponse() {
//         return response;
//     }
// 
//     public Long getDelay() {
//         return delay;
//     }
// 
//     public List<MatchResult> getAttempts() {
//         return attempts;
//     }
// 
// }


import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import au.com.sensis.stubby.service.model.StubServiceResult;
package au.com.sensis.stubby.servlet;





/*
 * Generic stubbed controller that can be used to stub any URL
 * Stubbed URLs can contain wildcards, eg: /path/*?param=*
 */
@SuppressWarnings("serial")
public class MatcherServlet extends AbstractStubServlet {

    private static final Logger LOGGER = Logger.getLogger(MatcherServlet.class);

    @Override
    public void service(HttpServletRequest request, HttpServletResponse response) {
        try {
// Path: core/src/main/java/au/com/sensis/stubby/service/model/StubServiceResult.java
// public class StubServiceResult { // returned by the 'findMatch' method
// 
//     private List<MatchResult> attempts;
//     private StubResponse response;
//     private Long delay;
// 
//     public StubServiceResult(List<MatchResult> attempts) {
//         this.attempts = attempts;
//     }
// 
//     public StubServiceResult(List<MatchResult> attempts, StubResponse response, Long delay) {
//         this.attempts = attempts;
//         this.response = response;
//         this.delay = delay;
//     }
// 
//     public boolean matchFound() {
//         for (MatchResult attempt : attempts) {
//             if (attempt.matches()) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
//     public StubResponse getResponse() {
//         return response;
//     }
// 
//     public Long getDelay() {
//         return delay;
//     }
// 
//     public List<MatchResult> getAttempts() {
//         return attempts;
//     }
// 
// }


// Path: servlet/src/main/java/au/com/sensis/stubby/servlet/MatcherServlet.java
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import au.com.sensis.stubby.service.model.StubServiceResult;

package au.com.sensis.stubby.servlet;





/*
 * Generic stubbed controller that can be used to stub any URL
 * Stubbed URLs can contain wildcards, eg: /path/*?param=*
 */
@SuppressWarnings("serial")
public class MatcherServlet extends AbstractStubServlet {

    private static final Logger LOGGER = Logger.getLogger(MatcherServlet.class);

    @Override
    public void service(HttpServletRequest request, HttpServletResponse response) {
        try {
            StubServiceResult result = service().findMatch(Transformer.fromServletRequest(request));