forked from ShiftLeftSecurity/shiftleft-java-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchController.java
More file actions
37 lines (31 loc) · 1.15 KB
/
SearchController.java
File metadata and controls
37 lines (31 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package io.shiftleft.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Search login
*/
@Controller
public class SearchController {
@RequestMapping(value = "/search/user", method = RequestMethod.GET)
@Secured("ROLE_USER")
public String doGetSearch(@RequestParam String foo, HttpServletResponse response, HttpServletRequest request) {
java.lang.Object message = new Object();
try {
ExpressionParser parser = new SpelExpressionParser();
Expression exp = parser.parseExpression(foo);
message = (Object) exp.getValue();
} catch (Exception ex) {
logger.error(ex.getMessage());
}
return message.toString();
}
return message.toString();
}
}