Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mmt-errorView
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Maeder
mmt-errorView
Commits
42777153
Commit
42777153
authored
10 years ago
by
cmaeder
Browse files
Options
Downloads
Patches
Plain Diff
make search and routes work for sally and jetty
parent
c4538bd0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/BundleStarter.scala
+1
-1
1 addition, 1 deletion
src/main/scala/BundleStarter.scala
src/main/scala/SearchDB.scala
+9
-3
9 additions, 3 deletions
src/main/scala/SearchDB.scala
with
10 additions
and
4 deletions
src/main/scala/BundleStarter.scala
+
1
−
1
View file @
42777153
...
@@ -34,7 +34,7 @@ class BundleStarter {
...
@@ -34,7 +34,7 @@ class BundleStarter {
.initTemplating("/home/maeder/mmt-errorview/src/main/resource/static/")
.initTemplating("/home/maeder/mmt-errorview/src/main/resource/static/")
.setDebugTemplating(true)
.setDebugTemplating(true)
*/
*/
context
.
addRoutes
(
new
SearchDB
(
"servlet:///error/"
))
context
.
addRoutes
(
new
SearchDB
(
"servlet:///error/"
,
false
))
context
.
start
()
context
.
start
()
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/SearchDB.scala
+
9
−
3
View file @
42777153
...
@@ -9,7 +9,7 @@ import org.apache.camel.scala.dsl.builder.RouteBuilder
...
@@ -9,7 +9,7 @@ import org.apache.camel.scala.dsl.builder.RouteBuilder
import
org.apache.camel.util.jndi.JndiContext
import
org.apache.camel.util.jndi.JndiContext
import
org.eclipse.jetty.server.handler.ResourceHandler
import
org.eclipse.jetty.server.handler.ResourceHandler
class
SearchDB
(
p
refix
:
String
)
extends
RouteBuilder
{
class
SearchDB
(
inP
refix
:
String
,
addStaticRoute
:
Boolean
)
extends
RouteBuilder
{
def
query2HashMap
(
ex
:
Exchange
)
:
util.HashMap
[
String
,
String
]
=
{
def
query2HashMap
(
ex
:
Exchange
)
:
util.HashMap
[
String
,
String
]
=
{
val
hm
=
new
util
.
HashMap
[
String
,
String
]()
val
hm
=
new
util
.
HashMap
[
String
,
String
]()
...
@@ -18,6 +18,13 @@ class SearchDB(prefix: String) extends RouteBuilder {
...
@@ -18,6 +18,13 @@ class SearchDB(prefix: String) extends RouteBuilder {
hm
hm
}
}
var
prefix
=
inPrefix
if
(
addStaticRoute
)
{
(
prefix
+
"static?matchOnUriPrefix=true&handlers=#staticHandler"
)
-->
(
"log:lll"
+
this
.
getClass
+
"?showHeaders=true"
)
prefix
=
inPrefix
+
"sally/error/"
}
Table
.
columns
.
map
{
col
=>
Table
.
columns
.
map
{
col
=>
((
prefix
+
"count/"
+
col
)
transform
((
prefix
+
"count/"
+
col
)
transform
(
ex
=>
"%"
+
ex
.
getIn
.
getHeader
(
"text"
)
+
"%"
))
-->
(
ex
=>
"%"
+
ex
.
getIn
.
getHeader
(
"text"
)
+
"%"
))
-->
...
@@ -27,7 +34,6 @@ class SearchDB(prefix: String) extends RouteBuilder {
...
@@ -27,7 +34,6 @@ class SearchDB(prefix: String) extends RouteBuilder {
(
"db:SELECT * FROM errors WHERE "
+
col
+
" LIKE :#text LIMIT :#limit"
)
marshal
(
"db:SELECT * FROM errors WHERE "
+
col
+
" LIKE :#text LIMIT :#limit"
)
marshal
new
DataFormatDefinition
(
new
JacksonDataFormat
())
new
DataFormatDefinition
(
new
JacksonDataFormat
())
}
}
// prefix + "static?matchOnUriPrefix=true&handlers=#staticHandler" --> "log:a"
}
}
object
SearchDB
{
object
SearchDB
{
...
@@ -39,7 +45,7 @@ object SearchDB {
...
@@ -39,7 +45,7 @@ object SearchDB {
val
jdni
=
new
JndiContext
()
val
jdni
=
new
JndiContext
()
jdni
.
bind
(
"staticHandler"
,
resHandler
)
jdni
.
bind
(
"staticHandler"
,
resHandler
)
context
.
setJndiContext
(
jdni
)
context
.
setJndiContext
(
jdni
)
context
.
addRoutes
(
new
SearchDB
(
"jetty:http://localhost:8383/"
))
context
.
addRoutes
(
new
SearchDB
(
"jetty:http://localhost:8383/"
,
true
))
context
.
start
()
context
.
start
()
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment