Skip to content

Commit e6db48c

Browse files
Merge pull request #23 from ChillyCheesy/feat/controller
Feat/controller
2 parents 7119cc0 + dcb2546 commit e6db48c

File tree

68 files changed

+33
-2005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+33
-2005
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
modulo_modulename=ModuloServer
2-
modulo_version=BINKS-0.3.1
2+
modulo_version=BINKS-0.4.0

modulo-api/src/main/java/com/chillycheesy/modulo/ModuloAPI.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import com.chillycheesy.modulo.controllers.ControllerContainer;
44
import com.chillycheesy.modulo.events.EventContainer;
55
import com.chillycheesy.modulo.modules.ModuleContainer;
6-
import com.chillycheesy.modulo.pages.PageContainer;
7-
import com.chillycheesy.modulo.signals.SignalContainer;
86
import com.chillycheesy.modulo.utils.Logger;
97

108
/**
@@ -23,14 +21,6 @@ public class ModuloAPI {
2321
* Event section.
2422
*/
2523
private static EventContainer event;
26-
/**
27-
* Signal section.
28-
*/
29-
private static SignalContainer signal;
30-
/**
31-
* Page manager.
32-
*/
33-
private static PageContainer page;
3424
/**
3525
* Controller container.
3626
*/
@@ -58,24 +48,6 @@ public static EventContainer getEvent() {
5848
return event = event == null ? new EventContainer() : event;
5949
}
6050

61-
/**
62-
* Getter for Signal logic section.
63-
*
64-
* @return The Signal section.
65-
*/
66-
public static SignalContainer getSignal() {
67-
return signal = signal == null ? new SignalContainer() : signal;
68-
}
69-
70-
/**
71-
* Getter for Signal logic section.
72-
*
73-
* @return The Signal section.
74-
*/
75-
public static PageContainer getPage() {
76-
return page = page == null ? new PageContainer() : page;
77-
}
78-
7951
/**
8052
* Getter for Logger logic section.
8153
*

modulo-api/src/main/java/com/chillycheesy/modulo/controllers/HttpPathVariableController.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,22 @@ private boolean match(List<String> requestPathList, List<String> pathVariableSpl
9999
final String requestPath = requestPathIterator.next();
100100
final String pathVariable = pathVariableIterator.next();
101101
if (argMatch(requestPath, pathVariable, configuration)) {
102-
if (pathVariable.equals("**")) {
103-
final StringBuilder additionalPath = new StringBuilder(requestPath);
104-
requestPathIterator.forEachRemaining(value -> additionalPath.append("/").append(value));
105-
configuration.set("additional-path", additionalPath.toString());
102+
if (isAdditionalPath(requestPathIterator, requestPath, pathVariable, configuration))
106103
return true;
107-
}
108-
} else {
109-
return false;
110-
}
104+
} else return false;
111105
}
112-
return true;
106+
if (!requestPathIterator.hasNext() && !pathVariableIterator.hasNext()) return true;
107+
else return pathVariableIterator.hasNext() && isAdditionalPath(requestPathIterator, "", pathVariableIterator.next(), configuration);
108+
}
109+
110+
private boolean isAdditionalPath(Iterator<String> requestPathIterator, String base, String pathVariable, Configuration configuration) {
111+
if (pathVariable.equals("**")) {
112+
final StringBuilder additionalPath = new StringBuilder(base);
113+
requestPathIterator.forEachRemaining(value -> additionalPath.append("/").append(value));
114+
configuration.set("additional-path", additionalPath.toString());
115+
return true;
116+
}
117+
return false;
113118
}
114119

115120
/**

modulo-api/src/main/java/com/chillycheesy/modulo/controllers/MethodController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.chillycheesy.modulo.controllers;
22

33
import com.chillycheesy.modulo.config.Configuration;
4-
import com.chillycheesy.modulo.controllers.annotations.HttpParamMethodControllerParameterAnnotationApplier;
5-
import com.chillycheesy.modulo.controllers.annotations.MethodControllerParameterAnnotationApplier;
6-
import com.chillycheesy.modulo.controllers.annotations.PathVariableMethodControllerParameterAnnotationApplier;
7-
import com.chillycheesy.modulo.controllers.annotations.RequestBodyMethodControllerParameterAnnotationApplier;
4+
import com.chillycheesy.modulo.controllers.methodcontroller.HttpParamMethodControllerParameterAnnotationApplier;
5+
import com.chillycheesy.modulo.controllers.methodcontroller.MethodControllerParameterAnnotationApplier;
6+
import com.chillycheesy.modulo.controllers.methodcontroller.PathVariableMethodControllerParameterAnnotationApplier;
7+
import com.chillycheesy.modulo.controllers.methodcontroller.RequestBodyMethodControllerParameterAnnotationApplier;
88

99
import javax.servlet.http.HttpServletRequest;
1010
import javax.servlet.http.HttpServletResponse;

modulo-api/src/main/java/com/chillycheesy/modulo/controllers/annotations/HttpParam.java renamed to modulo-api/src/main/java/com/chillycheesy/modulo/controllers/methodcontroller/HttpParam.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.chillycheesy.modulo.controllers.annotations;
1+
package com.chillycheesy.modulo.controllers.methodcontroller;
22

33
import java.lang.annotation.*;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.chillycheesy.modulo.controllers.annotations;
1+
package com.chillycheesy.modulo.controllers.methodcontroller;
22

33
import com.chillycheesy.modulo.config.Configuration;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.chillycheesy.modulo.controllers.annotations;
1+
package com.chillycheesy.modulo.controllers.methodcontroller;
22

33
import com.chillycheesy.modulo.config.Configuration;
44

modulo-api/src/main/java/com/chillycheesy/modulo/controllers/annotations/PathVariable.java renamed to modulo-api/src/main/java/com/chillycheesy/modulo/controllers/methodcontroller/PathVariable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.chillycheesy.modulo.controllers.annotations;
1+
package com.chillycheesy.modulo.controllers.methodcontroller;
22

33
import java.lang.annotation.*;
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.chillycheesy.modulo.controllers.annotations;
1+
package com.chillycheesy.modulo.controllers.methodcontroller;
22

33

44
import com.chillycheesy.modulo.config.Configuration;

modulo-api/src/main/java/com/chillycheesy/modulo/controllers/annotations/RequestBody.java renamed to modulo-api/src/main/java/com/chillycheesy/modulo/controllers/methodcontroller/RequestBody.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.chillycheesy.modulo.controllers.annotations;
1+
package com.chillycheesy.modulo.controllers.methodcontroller;
22

33
import java.lang.annotation.*;
44

0 commit comments

Comments
 (0)