diff --git a/annotation/build.xml b/annotation/build.xml
deleted file mode 100644
index 6c820c16..00000000
--- a/annotation/build.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/annotation/pom.xml b/annotation/pom.xml
deleted file mode 100644
index 330e31e8..00000000
--- a/annotation/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
- 4.0.0
- org.tuckey
- urlrewritefilter-annotation
- jar
- 5.0.0
- UrlRewriteFilter Annotation
- http://www.tuckey.org/urlrewrite/
- 2006
-
- Add-on to urlrewritefilter to support annotations
-
-
-
- UTF-8
-
-
-
-
- BSD
- http://www.opensource.org/licenses/bsd-license.php
- repo
-
-
-
-
- scm:git:https://github.com/paultuckey/urlrewritefilter.git
- scm:git:https://github.com/paultuckey/urlrewritefilter.git
- https://github.com/paultuckey/urlrewritefilter
-
-
-
- https://github.com/paultuckey/urlrewritefilter/issues
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.3.2
-
- 1.5
- 1.5
- -proc:none
-
-
-
-
-
-
-
- com.sun
- tools
- 1.6.0
- system
- ${java.home}/../lib/tools.jar
-
-
- junit
- junit
- 4.13.1
- compile
-
-
- javax.servlet
- servlet-api
- 2.4
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-report-plugin
- 2.5
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 3.2.2
-
-
- jakarta
- package
-
- shade
-
-
- jakarta
- true
- false
-
-
- ${project.groupId}:${project.artifactId}
-
-
-
-
- javax.servlet
- jakarta.servlet
-
-
- javax.annotation
- jakarta.annotation
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpExceptionHandler.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpExceptionHandler.java
deleted file mode 100644
index 81522f84..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpExceptionHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.SOURCE)
-@Target(ElementType.METHOD)
-public @interface HttpExceptionHandler {
-
- String value() default "[ unassigned ]";
-
-}
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpJson.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpJson.java
deleted file mode 100644
index ed6e3c96..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpJson.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A marker annotation for allowing a method to be called via HTTP and the results to be returned as JSON.
- */
-@Retention(RetentionPolicy.SOURCE)
-@Target(ElementType.METHOD)
-public @interface HttpJson {
-
- String value() default "[ unassigned ]";
-
- /**
- * A weighting to be applied to the url, if higher it will move this url to the "top" if lower more towards the
- * "bottom".
- *
- * @return weight
- */
- int weight() default 0;
-
-}
\ No newline at end of file
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpParam.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpParam.java
deleted file mode 100644
index 90b6f092..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpParam.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for matching parameters in HTTP requests.
- *
- * Usage:
- *
- * \@HttpUrl("^/search/(people|objects)/$")
- * public void someMethod(@HttpParam("fName") String firstName, @HttpParam String lastName)
- * for the request /search/people/?fName=bob&lastName=smith
- * will invoke the method with someMethod("bob", "smith", "people")
- * to be used in conjunction with @HttpUrl
- */
-@Retention(RetentionPolicy.SOURCE)
-@Target(ElementType.PARAMETER)
-public @interface HttpParam {
-
- /**
- * If not set will use the name of the parameter (case insensitive).
- * can be a expression ie, $1 (the first group of @HttpUrl regexp), %{header:user-agent} (the user agent header).
- *
- * @return value
- */
- String value() default "[ unassigned ]";
-
-}
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrl.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrl.java
deleted file mode 100644
index 8abb049b..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for matching URL's in HTTP requests.
- */
-@Retention(RetentionPolicy.SOURCE)
-@Target(ElementType.METHOD)
-public @interface HttpUrl {
-
- String value();
-
- /**
- * A weighting to be applied to the url, if higher it will move this url to the "top" if lower more towards the
- * "bottom".
- *
- * @return weight
- */
- int weight() default 0;
-
-}
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrlAPTFactory.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrlAPTFactory.java
deleted file mode 100644
index 299dfa19..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrlAPTFactory.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.AnnotationProcessorFactory;
-import com.sun.mirror.apt.AnnotationProcessors;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Annotation Processor Factory for UrlRewriteFilter annotations.
- *
- * @deprecated Use UrlRewriteAnnotationProcessor
- */
-public class HttpUrlAPTFactory implements AnnotationProcessorFactory {
-
- /**
- * Returns a note annotation processor.
- *
- * @return An annotation processor for note annotations if requested,
- * otherwise, returns the NO_OP annotation processor.
- */
- public AnnotationProcessor getProcessorFor(Set declarations,
- AnnotationProcessorEnvironment env) {
- AnnotationProcessor result;
- if (declarations.isEmpty()) {
- result = AnnotationProcessors.NO_OP;
- } else {
- result = new HttpUrlAnnotationProcessor(env);
- }
- return result;
-
- }
-
- /**
- * This factory only builds processors for all UrlRewrite annotations.
- *
- * @return a collection containing only the note annotation name.
- */
- public Collection supportedAnnotationTypes() {
- Set set = new HashSet();
- set.add(HttpUrl.class.getName());
- set.add(HttpExceptionHandler.class.getName());
- set.add(HttpParam.class.getName());
- return set;
- }
-
- /**
- * Options supported by this annotation processor.
- *
- * @return collection of options.
- */
- public Collection supportedOptions() {
- Set set = new HashSet();
- set.add("-AsaveRulesTo");
- set.add("-AshowPositions");
- set.add("-Adebug");
- return set;
- }
-}
-
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrlAnnotationProcessor.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrlAnnotationProcessor.java
deleted file mode 100644
index d38a0316..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/HttpUrlAnnotationProcessor.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import com.sun.mirror.apt.AnnotationProcessor;
-import com.sun.mirror.apt.AnnotationProcessorEnvironment;
-import com.sun.mirror.apt.Filer;
-import com.sun.mirror.apt.Messager;
-import com.sun.mirror.declaration.AnnotationTypeDeclaration;
-import com.sun.mirror.declaration.Declaration;
-import com.sun.mirror.declaration.MethodDeclaration;
-import com.sun.mirror.declaration.ParameterDeclaration;
-import com.sun.mirror.util.SourcePosition;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * Annotation processor for UrlRewrite. Will search compiled classes for annotations and generate XML.
- *
- * Processor for JDK 1.5.
- *
- * @deprecated use UrlRewriteAnnotationProcessor.
- */
-public class HttpUrlAnnotationProcessor implements AnnotationProcessor {
-
- private AnnotationProcessorEnvironment environment;
- private AnnotationTypeDeclaration httpUrlDeclaration;
- private AnnotationTypeDeclaration httpExceptionHandlerDeclaration;
- private List processedAnnotations = new ArrayList();
- private List httpExceptionHandlers = new ArrayList();
- private Messager messager;
- private boolean showPositionsOfAnnotations = false;
- private boolean debug = false;
-
- public HttpUrlAnnotationProcessor(AnnotationProcessorEnvironment env) {
- environment = env;
- messager = env.getMessager();
- // get the type declaration for the annotations we are processing for
- httpUrlDeclaration = (AnnotationTypeDeclaration) environment.getTypeDeclaration(HttpUrl.class.getName());
- httpExceptionHandlerDeclaration = (AnnotationTypeDeclaration) environment.getTypeDeclaration(HttpExceptionHandler.class.getName());
- }
-
- public void process() {
- Map options = environment.getOptions();
- Set keys = options.keySet();
- String saveRulesTo = null;
- for (String key : keys) {
- if (key.startsWith("-AsaveRulesTo=")) {
- saveRulesTo = key.substring("-AsaveRulesTo=".length());
- }
- if (key.startsWith("-AshowPositions=")) {
- showPositionsOfAnnotations = "true".equalsIgnoreCase(key.substring("-AshowPositions=".length()));
- }
- if (key.startsWith("-Adebug=")) {
- debug = "true".equalsIgnoreCase(key.substring("-Adebug=".length()));
- }
- }
- debugMsg("Processing");
- if (saveRulesTo == null) {
- messager.printError("ERROR: conf option must be specified");
- return;
- }
-
- File confFile = new File(saveRulesTo);
- PrintWriter pw;
- boolean delFile = false;
- try {
- if (!confFile.exists()) {
- if ( ! confFile.createNewFile() ) {
- checkDirsExistMkdir(confFile.getParentFile());
- confFile.createNewFile();
- }
- }
- if (!confFile.canWrite()) throw new IOException("cannot write to " + confFile.getName());
- pw = environment.getFiler().createTextFile(Filer.Location.CLASS_TREE, "", confFile, null);
- } catch (IOException e) {
- e.printStackTrace();
- return;
- }
- try {
-
- // Get all declarations that use the HttpUrl annotation.
- debugMsg("Looking for @HttpUrl");
- Collection urlDeclarations = environment.getDeclarationsAnnotatedWith(httpUrlDeclaration);
- for (Declaration declaration : urlDeclarations) {
- ProcessedHttpUrlAnnotation pa = processHttpUrlAnnotation(declaration);
- if (pa == null) delFile = true;
- else processedAnnotations.add(pa);
- }
-
- // Get all declarations that use the HttpExceptionHandler annotation.
- debugMsg("Looking for @HttpExceptionHandler");
- Collection exceptionDeclarations = environment.getDeclarationsAnnotatedWith(httpExceptionHandlerDeclaration);
- for (Declaration declaration : exceptionDeclarations) {
- ProcessedHttpExceptionAnnotation phea = processHttpExceptionHandlerAnnotation(declaration);
- if (phea == null) delFile = true;
- else httpExceptionHandlers.add(phea);
- }
-
- if (processedAnnotations.size() > 0) {
- messager.printNotice("Got " + processedAnnotations.size() + " @HttpUrl annotations");
- Collections.sort(processedAnnotations);
- }
- if (httpExceptionHandlers.size() > 0) {
- messager.printNotice("Got " + httpExceptionHandlers.size() + " @HttpExceptionHandler annotations");
- Collections.sort(httpExceptionHandlers);
- }
-
- if (!delFile) {
- environment.getMessager().printNotice("Writing to " + confFile);
- outputRules(pw);
- outputExceptionHandlers(pw);
-
- } else {
- confFile.delete();
- }
-
- } catch (Throwable t) {
- delFile = true;
- t.printStackTrace();
- }
- if (delFile) {
- messager.printError("Error occured during processing deleting generated file.");
- confFile.delete();
- }
-
- pw.close();
- }
-
- private void outputRules(PrintWriter pw) {
- for (ProcessedHttpUrlAnnotation pa : processedAnnotations) {
- pw.println("");
- pw.println(" " + pa.sourceRef + "");
- if (!isBlank(pa.docComment)) {
- pw.println(" ");
- pw.println(padEachLine(" ", escapeXML(pa.docComment)));
- pw.println(" ");
- }
- pw.println(" " + pa.value + "");
- pw.println(" ");
- if (!pa.chainUsed) {
- pw.println(" null");
- }
- pw.println("");
- pw.flush();
- }
- }
-
- private void outputExceptionHandlers(PrintWriter pw) {
- for (ProcessedHttpExceptionAnnotation pa : httpExceptionHandlers) {
- pw.println("");
- if (!isBlank(pa.docComment)) {
- pw.println(" ");
- pw.println(padEachLine(" ", escapeXML(pa.docComment)));
- pw.println(" ");
- }
- pw.println(" ");
- pw.println("");
- pw.flush();
- }
- }
-
- private ProcessedHttpUrlAnnotation processHttpUrlAnnotation(Declaration declaration) {
- HttpUrl httpUrl = declaration.getAnnotation(HttpUrl.class);
- return new ProcessedHttpUrlAnnotation(HttpUrl.class.getName(), declaration, httpUrl.value(), httpUrl.weight());
- }
-
- private ProcessedHttpExceptionAnnotation processHttpExceptionHandlerAnnotation(Declaration declaration) {
- SourcePosition position = declaration.getPosition();
- if (!(declaration instanceof MethodDeclaration)) {
- messager.printWarning(declaration.getPosition(), "@HttpExceptionHandler declared on a non-method " + position);
- return null;
- }
- MethodDeclaration methodDeclaration = (MethodDeclaration) declaration;
- HttpExceptionHandler httpExceptionHandler = declaration.getAnnotation(HttpExceptionHandler.class);
- String className = methodDeclaration.getDeclaringType().getQualifiedName();
-
- ProcessedHttpExceptionAnnotation ea = new ProcessedHttpExceptionAnnotation();
- ea.exceptionName = httpExceptionHandler.value(); //.getName();
- ea.methodName = declaration.getSimpleName();
- ea.docComment = declaration.getDocComment();
- ea.className = className;
-
- ea.setParams(methodDeclaration.getParameters());
-
- // out exceptionName might not be set
- if ("[ unassigned ]".equals(ea.exceptionName) && methodDeclaration.getParameters().size() > 0) {
- // use first param
- ea.exceptionName = methodDeclaration.getParameters().iterator().next().getType().toString();
- }
-
- if (showPositionsOfAnnotations) {
- messager.printNotice(position, "@HttpExceptionHandlerUrl value " + ea.value + " weight " + ea.weight);
- }
- return ea;
- }
-
- class ProcessedHttpUrlAnnotation implements Comparable {
- public int weight = 0;
- public String value;
- public boolean chainUsed;
- public String paramsFormatted;
- public String methodName;
- public String className;
- public String docComment;
- public String sourceRef;
- private static final String FILTER_CHAIN_CLASS_NAME = "javax.servlet.FilterChain";
-
- public ProcessedHttpUrlAnnotation() {
- // empty
- }
-
- public ProcessedHttpUrlAnnotation(String typeName, Declaration declaration, String value, int weight) {
- MethodDeclaration methodDeclaration = (MethodDeclaration) declaration;
- String className = methodDeclaration.getDeclaringType().getQualifiedName();
- this.methodName = declaration.getSimpleName();
- this.docComment = declaration.getDocComment();
- this.className = className;
- this.value = value;
- this.weight = weight;
- this.setParams(methodDeclaration.getParameters());
- String typeNameShort = typeName.substring(typeName.lastIndexOf("."));
- SourcePosition positionInCode = declaration.getPosition();
- sourceRef = positionInCode.file().getName() + ":" + positionInCode.line();
- if (!(declaration instanceof MethodDeclaration)) {
- messager.printWarning(positionInCode, "@" + typeNameShort + " declared on a non-method " + positionInCode);
- }
- if (showPositionsOfAnnotations) {
- messager.printNotice(positionInCode, "@" + typeNameShort + " value " + value + " weight " + weight);
- }
- }
-
- public int compareTo(ProcessedHttpUrlAnnotation other) {
- if (this.weight < other.weight) return 1;
- if (this.weight > other.weight) return -1;
- if (this.className != null && other.className != null) {
- int comp = this.className.compareTo(other.className);
- if (comp != 0) return comp;
- }
- if (this.methodName != null && other.methodName != null) {
- return this.methodName.compareTo(other.methodName);
- }
- return 0;
- }
-
- void setParams(Collection params) {
- paramsFormatted = "(";
- chainUsed = false;
- if (params.size() > 0) {
- int i = 1;
- for (ParameterDeclaration paramDeclaration : params) {
- String paramType = paramDeclaration.getType().toString();
- if (FILTER_CHAIN_CLASS_NAME.equals(paramType)) {
- chainUsed = true;
- }
- paramsFormatted += (i == 1 ? "" : ", ") + paramType;
-
- HttpParam httpParam = paramDeclaration.getAnnotation(HttpParam.class);
- if (httpParam != null) {
- paramsFormatted += " ";
- if (!"[ unassigned ]".equals(httpParam.value())) {
- paramsFormatted += httpParam.value();
- } else {
- paramsFormatted += paramDeclaration.getSimpleName();
- }
- }
- i++;
- }
- }
- paramsFormatted += ")";
- }
- }
-
- class ProcessedHttpExceptionAnnotation extends ProcessedHttpUrlAnnotation {
- public String exceptionName;
-
- public int compareTo(ProcessedHttpExceptionAnnotation other) {
- int comp = super.compareTo(other);
- if (comp == 0) comp = exceptionName.compareTo(other.exceptionName);
- return comp;
- }
-
- }
-
-
- /**
- * a very very basic xml escaper.
- *
- * @param s string to escape
- * @return the escaped string
- */
- private static String escapeXML(String s) {
- if (s == null) {
- return null;
- }
- final int length = s.length();
- StringBuffer b = new StringBuffer();
- for (int i = 0; i < length; i++) {
- char c = s.charAt(i);
- switch (c) {
- case '&':
- b.append("&");
- break;
- case '<':
- b.append("<");
- break;
- case '>':
- b.append(">");
- break;
- default:
- b.append(c);
- break;
- }
- }
- return b.toString();
- }
-
- private static String padEachLine(String padWith, String str) {
- StringBuffer out = new StringBuffer();
- String[] lines = str.split("\n");
- int i = 0;
- while (i < lines.length) {
- String line = lines[i];
- out.append(padWith);
- out.append(line);
- i++;
- if (i < lines.length) out.append('\n');
- }
- return out.toString();
- }
-
- private static boolean isBlank(final String str) {
- return str == null || "".equals(str) || "".equals(str.trim());
- }
-
- private static void checkDirsExistMkdir(File dir) {
- if (!dir.getParentFile().exists()) {
- checkDirsExistMkdir(dir.getParentFile());
- }
- if (!dir.exists()) {
- dir.mkdir();
- }
- }
-
- private void debugMsg(String msg) {
- if (!debug) return;
- messager.printNotice("Debug: " + msg);
- }
-
-}
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/ProcessorServiceLoaderCheck.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/ProcessorServiceLoaderCheck.java
deleted file mode 100644
index 90c594e2..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/ProcessorServiceLoaderCheck.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import javax.annotation.processing.Processor;
-import java.util.ServiceLoader;
-
-/**
- * Quick and dirty class to check that "service" file is loaded in the current classpath.
- */
-public class ProcessorServiceLoaderCheck {
-
- public static void main(String[] args) {
- System.out.println("Checking for services...");
- ServiceLoader processorServices = ServiceLoader.load(Processor.class);
- for (Object o : processorServices) {
- System.out.println(o);
- }
- System.out.println("Done.");
- }
-}
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/UrlRewriteAnnotationProcessor.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/UrlRewriteAnnotationProcessor.java
deleted file mode 100644
index 25f7ffd7..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/annotation/UrlRewriteAnnotationProcessor.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.Messager;
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.lang.model.element.*;
-import javax.lang.model.util.Elements;
-import javax.tools.Diagnostic;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Annotation processor for UrlRewrite. Will search classes for annotations and generate XML fragment.
- * JDK 1.6+
- *
- *
- * @since 3.2
- */
-@SupportedAnnotationTypes("org.tuckey.web.filters.urlrewrite.*")
-public class UrlRewriteAnnotationProcessor extends AbstractProcessor {
-
- private List processedAnnotations = new ArrayList();
- private List processedJsonAnnotations = new ArrayList();
- private List httpExceptionHandlers = new ArrayList();
- private Messager messager;
- private Elements elementUtils;
- private boolean showPositions = false;
- private boolean debug = false;
- private boolean errorDuringProcessing = false;
- private String dest = null;
- private String rpcBase = "/rpc/";
-
- public UrlRewriteAnnotationProcessor() {
- // needed
- }
-
- public Set getSupportedOptions() {
- HashSet options = new HashSet();
- options.add("urlrewriteDest");
- options.add("urlrewriteShowPositions");
- options.add("urlrewriteDebug");
- options.add("urlrewriteRpcBase");
- return options;
- }
-
- public synchronized void init(ProcessingEnvironment processingEnv) {
- this.messager = processingEnv.getMessager();
- this.elementUtils = processingEnv.getElementUtils();
-
- Map options = processingEnv.getOptions();
- Set keys = options.keySet();
- for (String key : keys) {
- if (key.equalsIgnoreCase("urlrewriteDest")) {
- dest = options.get(key);
-
- } else if (key.equalsIgnoreCase("urlrewriteShowPositions")) {
- showPositions = "true".equalsIgnoreCase(options.get(key));
-
- } else if (key.equalsIgnoreCase("urlrewriteDebug")) {
- debug = "true".equalsIgnoreCase(options.get(key));
-
- } else if (key.equalsIgnoreCase("urlrewriteRpcBase")) {
- rpcBase = options.get(key);
- }
- }
- debugMsg("init");
- }
-
- public boolean process(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (isBlank(dest)) {
- if (roundEnv.processingOver())
- infoMsg(getClass().getSimpleName() + ": -AurlrewriteDest not specified, annotations ignored");
- return true;
- }
- debugMsg("process");
-
- Set extends Element> urlDeclarations = roundEnv.getElementsAnnotatedWith(HttpUrl.class);
- for (Element element : urlDeclarations) {
- processedAnnotations.add(new ProcessedHttpUrlAnnotation(element));
- }
-
- Set extends Element> jsonDeclarations = roundEnv.getElementsAnnotatedWith(HttpJson.class);
- for (Element element : jsonDeclarations) {
- processedJsonAnnotations.add(new ProcessedHttpJsonAnnotation(element));
- }
-
- Set extends Element> exceptionDeclarations = roundEnv.getElementsAnnotatedWith(HttpExceptionHandler.class);
- for (Element element : exceptionDeclarations) {
- httpExceptionHandlers.add(new ProcessedHttpExceptionAnnotation(element));
- }
-
- if (roundEnv.processingOver()) {
- if (processedAnnotations.size() > 0) {
- infoMsg("Got " + processedAnnotations.size() + " @HttpUrl annotations");
- }
- if (processedJsonAnnotations.size() > 0) {
- infoMsg("Got " + processedJsonAnnotations.size() + " @HttpJson annotations");
- processedAnnotations.addAll(processedJsonAnnotations);
- }
- Collections.sort(processedAnnotations);
-
- if (httpExceptionHandlers.size() > 0) {
- infoMsg("Got " + httpExceptionHandlers.size() + " @HttpExceptionHandler annotations");
- Collections.sort(httpExceptionHandlers);
- }
- try {
- File destFile = new File(dest);
- if (!destFile.exists()){
- if ( destFile.getParentFile() == null ) {
- infoMsg("Parent file null for " + destFile);
- }
- if ( ! destFile.createNewFile() ) {
- infoMsg("could not make new file for " + destFile + " trying to mkdirs");
- checkDirsExistMkdir(destFile.getParentFile());
- if ( ! destFile.createNewFile() ) {
- errorMsg("could not make new file for " + destFile);
- }
- }
- }
- if (!destFile.canWrite()) {
- throw new IOException("cannot write to " + destFile.getName());
- }
- if (errorDuringProcessing) {
- errorMsg("Error occured during processing deleting generated file.");
- destFile.delete();
-
- } else {
- PrintWriter pw = new PrintWriter(destFile);
- infoMsg("Writing to " + destFile);
- outputRules(pw);
- outputExceptionHandlers(pw);
- pw.close();
-
- }
- } catch (FileNotFoundException e) {
- errorMsg(e);
- e.printStackTrace();
-
- } catch (IOException e) {
- errorMsg(e);
- e.printStackTrace();
- }
- }
- return true;
- }
-
- private void outputRules(PrintWriter pw) {
- for (ProcessedHttpUrlAnnotation pa : processedAnnotations) {
- boolean jsonHandler = pa instanceof ProcessedHttpJsonAnnotation;
- pw.println("");
- pw.println(" " + pa.className + "." + pa.methodName + "");
- if (!isBlank(pa.docComment)) {
- pw.println(" ");
- pw.println(padEachLine(" ", escapeXML(pa.docComment)));
- pw.println(" ");
- }
- pw.println(" " + pa.value + "");
- pw.println(" ");
- if (!pa.chainUsed) {
- pw.println(" null");
- }
- pw.println("");
- pw.flush();
- }
- }
-
- private void outputExceptionHandlers(PrintWriter pw) {
- for (ProcessedHttpExceptionAnnotation pa : httpExceptionHandlers) {
- pw.println("");
- if (!isBlank(pa.docComment)) {
- pw.println(" ");
- pw.println(padEachLine(" ", escapeXML(pa.docComment)));
- pw.println(" ");
- }
- pw.println(" ");
- pw.println("");
- pw.flush();
- }
- }
-
- class ProcessedUrlRewriteFilterAnnotation implements Comparable {
-
- public String methodName;
- public String className;
- public String docComment;
- public String paramsFormatted;
-
- public ExecutableElement init(Element declaration) {
- if (!ElementKind.METHOD.equals(declaration.getKind())) {
- errorMsg("declared on a non-method (type is " + declaration.getKind() + ")", declaration);
- return null;
- }
- ExecutableElement methodDeclaration = (ExecutableElement) declaration;
- TypeElement classDeclaration = (TypeElement) methodDeclaration.getEnclosingElement();
- className = classDeclaration.getQualifiedName().toString();
- methodName = declaration.getSimpleName().toString();
- docComment = elementUtils.getDocComment(declaration);
- return methodDeclaration;
- }
-
- public int compareTo(ProcessedUrlRewriteFilterAnnotation other) {
- if (this.className != null && other.className != null) {
- int comp = this.className.compareTo(other.className);
- if (comp != 0) return comp;
- }
- if (this.methodName != null && other.methodName != null) {
- return this.methodName.compareTo(other.methodName);
- }
- return 0;
- }
-
- void setParams(Collection extends VariableElement> params) {
- paramsFormatted = "(";
- if (params.size() > 0) {
- int i = 1;
- for (VariableElement paramDeclaration : params) {
- String paramType = paramDeclaration.asType().toString();
- paramsFormatted += (i == 1 ? "" : ", ") + paramType;
- HttpParam httpParam = paramDeclaration.getAnnotation(HttpParam.class);
- if (httpParam != null) {
- paramsFormatted += " ";
- if (!"[ unassigned ]".equals(httpParam.value())) {
- paramsFormatted += httpParam.value();
- } else {
- paramsFormatted += paramDeclaration.getSimpleName();
- }
- }
- i++;
- }
- }
- paramsFormatted += ")";
- }
-
- }
-
- class ProcessedHttpJsonAnnotation extends ProcessedHttpUrlAnnotation {
- public ProcessedHttpJsonAnnotation(Element declaration) {
- ExecutableElement methodDeclaration = init(declaration);
- if (methodDeclaration == null) return;
-
- HttpJson httpJson = declaration.getAnnotation(HttpJson.class);
- if ("[ unassigned ]".equals(httpJson.value()) ) {
- this.value = rpcBase + this.className + "/" + this.methodName;
- } else {
- this.value = httpJson.value();
- }
- this.weight = httpJson.weight();
- setParams(methodDeclaration.getParameters());
-
- if (showPositions) {
- messager.printMessage(Diagnostic.Kind.NOTE, "@HttpJson value " + value + " weight " + weight, methodDeclaration);
- }
- }
-
- }
-
- class ProcessedHttpUrlAnnotation extends ProcessedUrlRewriteFilterAnnotation {
- public int weight = 0;
- public String value;
- public boolean chainUsed;
- public String sourceRef;
- private static final String FILTER_CHAIN_CLASS_NAME = "javax.servlet.FilterChain";
-
- public ProcessedHttpUrlAnnotation() {
- // empty
- }
-
- public ProcessedHttpUrlAnnotation(Element declaration) {
- ExecutableElement methodDeclaration = init(declaration);
- if (methodDeclaration == null) return;
-
- HttpUrl httpUrl = declaration.getAnnotation(HttpUrl.class);
- this.value = httpUrl.value();
- this.weight = httpUrl.weight();
- setParams(methodDeclaration.getParameters());
-
- if (showPositions) {
- messager.printMessage(Diagnostic.Kind.NOTE, "@HttpUrl value " + value + " weight " + weight, methodDeclaration);
- }
- }
-
- public int compareTo(ProcessedHttpUrlAnnotation other) {
- if (this.weight < other.weight) return 1;
- if (this.weight > other.weight) return -1;
- return super.compareTo(other);
- }
-
- protected void setParams(Collection extends VariableElement> params) {
- chainUsed = false;
- if (params.size() > 0) {
- for (VariableElement paramDeclaration : params) {
- String paramType = paramDeclaration.asType().toString();
- if (FILTER_CHAIN_CLASS_NAME.equals(paramType)) {
- chainUsed = true;
- }
- }
- }
- super.setParams(params);
- }
-
- }
-
- class ProcessedHttpExceptionAnnotation extends ProcessedUrlRewriteFilterAnnotation {
- public String exceptionName;
-
- public ProcessedHttpExceptionAnnotation(Element declaration) {
- ExecutableElement methodDeclaration = init(declaration);
- if (methodDeclaration == null) return;
-
- HttpExceptionHandler httpExceptionHandler = declaration.getAnnotation(HttpExceptionHandler.class);
- exceptionName = httpExceptionHandler.value();
-
- // out exceptionName might not be set
- if ("[ unassigned ]".equals(exceptionName) ) {
- // use first param
- exceptionName = methodDeclaration.getParameters().get(0).asType().toString();
- }
- setParams(methodDeclaration.getParameters());
-
- if (showPositions) {
- messager.printMessage(Diagnostic.Kind.NOTE, "@HttpExceptionHandlerUrl exceptionName " + exceptionName, methodDeclaration);
- }
- }
-
- public int compareTo(ProcessedHttpExceptionAnnotation other) {
- int comp = super.compareTo(other);
- if (comp == 0) comp = exceptionName.compareTo(other.exceptionName);
- return comp;
- }
-
- }
-
-
- /**
- * a very very basic xml escaper.
- *
- * @param s string to escape
- * @return the escaped string
- */
- private static String escapeXML(String s) {
- if (s == null) {
- return null;
- }
- final int length = s.length();
- StringBuffer b = new StringBuffer();
- for (int i = 0; i < length; i++) {
- char c = s.charAt(i);
- switch (c) {
- case '&':
- b.append("&");
- break;
- case '<':
- b.append("<");
- break;
- case '>':
- b.append(">");
- break;
- default:
- b.append(c);
- break;
- }
- }
- return b.toString();
- }
-
- private static String padEachLine(String padWith, String str) {
- StringBuffer out = new StringBuffer();
- String[] lines = str.split("\n");
- int i = 0;
- while (i < lines.length) {
- String line = lines[i];
- out.append(padWith);
- out.append(line);
- i++;
- if (i < lines.length) out.append('\n');
- }
- return out.toString();
- }
-
- private static boolean isBlank(final String str) {
- return str == null || "".equals(str) || "".equals(str.trim());
- }
-
- private static void checkDirsExistMkdir(File dir) {
- if ( dir == null ) throw new RuntimeException("checkDirsExistMkdir called with null");
- if (dir.getParentFile() == null ) {
- checkDirsExistMkdir(dir);
- }
- if (!dir.getParentFile().exists()) {
- checkDirsExistMkdir(dir.getParentFile());
- }
- if (!dir.exists()) {
- dir.mkdir();
- }
- }
-
-
- private void debugMsg(String msg) {
- if (!debug) return;
- messager.printMessage(Diagnostic.Kind.OTHER, getClass().getSimpleName() + " " + msg);
- }
-
- private void infoMsg(String msg) {
- messager.printMessage(Diagnostic.Kind.NOTE, msg);
- }
-
- private void errorMsg(String msg) {
- errorDuringProcessing = true;
- messager.printMessage(Diagnostic.Kind.ERROR, msg);
- }
-
- private void errorMsg(Exception e) {
- errorDuringProcessing = true;
- messager.printMessage(Diagnostic.Kind.ERROR, e.getMessage());
- }
-
- private void errorMsg(String msg, Element element) {
- errorDuringProcessing = true;
- messager.printMessage(Diagnostic.Kind.ERROR, msg, element);
- }
-
-}
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/json/JSONRPCBean.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/json/JSONRPCBean.java
deleted file mode 100644
index d9044a0b..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/json/JSONRPCBean.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.json;
-
-/**
- * Bean to encapsulate an RPC result.
- */
-public class JSONRPCBean {
-
- private Object result;
- private JSONRPCErrorBean error;
-
- public String getVersion() {
- return "1.1";
- }
-
- public Object getResult() {
- return result;
- }
-
- public void setResult(Object result) {
- this.result = result;
- }
-
- public JSONRPCErrorBean getError() {
- return error;
- }
-
- public void setError(JSONRPCErrorBean error) {
- this.error = error;
- }
-
-}
diff --git a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/json/JSONRPCErrorBean.java b/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/json/JSONRPCErrorBean.java
deleted file mode 100644
index 836c9c62..00000000
--- a/annotation/src/main/java/org/tuckey/web/filters/urlrewrite/json/JSONRPCErrorBean.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.json;
-
-/**
- * Bean to encapsulate RPC errors.
- */
-public class JSONRPCErrorBean {
-
- private int code;
- private String message;
- private Object error;
-
- public String getName() {
- return "JSONRPCError";
- }
-
- public int getCode() {
- return code;
- }
-
- public void setCode(int code) {
- this.code = code;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Object getError() {
- return error;
- }
-
- public void setError(Object error) {
- this.error = error;
- }
-}
diff --git a/annotation/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory b/annotation/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
deleted file mode 100644
index 01e21e54..00000000
--- a/annotation/src/main/resources/META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.tuckey.web.filters.urlrewrite.annotation.HttpUrlAPTFactory
\ No newline at end of file
diff --git a/annotation/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/annotation/src/main/resources/META-INF/services/javax.annotation.processing.Processor
deleted file mode 100644
index 590d16aa..00000000
--- a/annotation/src/main/resources/META-INF/services/javax.annotation.processing.Processor
+++ /dev/null
@@ -1 +0,0 @@
-org.tuckey.web.filters.urlrewrite.annotation.UrlRewriteAnnotationProcessor
\ No newline at end of file
diff --git a/annotation/src/test/java/org/tuckey/web/filters/urlrewrite/annotation/SampleMatchAction.java b/annotation/src/test/java/org/tuckey/web/filters/urlrewrite/annotation/SampleMatchAction.java
deleted file mode 100644
index fe101d27..00000000
--- a/annotation/src/test/java/org/tuckey/web/filters/urlrewrite/annotation/SampleMatchAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Copyright (c) 2005-2023, Paul Tuckey
- * All rights reserved.
- * ====================================================================
- * Licensed under the BSD License. Text as follows.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * - Neither the name tuckey.org nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- */
-package org.tuckey.web.filters.urlrewrite.annotation;
-
-import jakarta.servlet.FilterChain;
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.sql.SQLException;
-
-
-public class SampleMatchAction {
-
- @HttpUrl(value = "^/1clientinfo/$")
- public void listActive(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException, SQLException {
-
- }
-
- /**
- * In file 2nd.
- */
- @HttpUrl("^/clientinfo/(*)/$")
- public void clientDetails(int clientId)
- throws SQLException {
-
- }
-
- @HttpUrl("^/search/(clients|staff)/$")
- public void addClientFilterSecond(String searchType, @HttpParam String firstName,
- @HttpParam("lName")String lastName)
- throws SQLException {
-
- }
-
- /**
- * In the file 3rd. Should be 1st.
- *
- * Multiline doc.
- */
- @HttpUrl(value = "^/clientinfo/(*)/$", weight = 2)
- public void addClientFilterFirst(int clientId, FilterChain chain)
- throws SQLException {
-
- }
-
- /**
- * Should be the last item in the processed file.
- * In file 4th. Should be last.
- */
- @HttpUrl(value = "^/clientinfo/(*)/$", weight = -1)
- public void addClientFilterLast(int clientId, FilterChain chain)
- throws SQLException {
-
- }
-
- /**
- * In file 5th. Should be 2nd.
- */
- @HttpUrl(value = "^/clientinfo/(*)/$", weight = 1)
- public void addClientFilterSecond(int clientId, FilterChain chain)
- throws SQLException {
-
- }
-
- class ClientBean {
- private String name = "Bob";
- }
-
- @HttpExceptionHandler("java.lang.Exception")
- public void addExceptionHandler(Exception e)
- throws SQLException {
-
- }
-
- @HttpExceptionHandler
- public void addExceptionHandlerAuto(Exception e)
- throws SQLException {
-
- }
-
- @HttpJson
- public String clientDetailsRpc(@HttpParam int clientId)
- throws SQLException {
- return "Hello World";
- }
-
-}