Skip to content

Commit

Permalink
v0.2.2.59 crated. postHTTP processor created
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsen A. Gutsal committed Feb 5, 2014
1 parent 37d9960 commit 6e52e25
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion GnutchGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.apache.camel.Exchange

class GnutchGrailsPlugin {

def version = "0.2.2.58"
def version = "0.2.2.59"
def grailsVersion = "2.2 > *"
def loadAfter = ['controllers', 'services', 'routing']
def title = "Grails Apache Nutch alternative"
Expand Down
18 changes: 12 additions & 6 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ environments {
multiplier = 10
}
handlers {
// org.apache.camel.Processor definition. Called after HTML is transformed into XHTML
// ex.in.body contains XHML document (actually contains reference to org.w3c.org.Document)
postHTTP = { Exchange ex ->

}
// org.apache.camel.Processor definition. Called after HTML is transformed into XHTML
// ex.in.body contains XHML document (actually contains reference to org.w3c.org.Document)
postXHTML = { Exchange ex ->
Expand Down Expand Up @@ -77,6 +82,7 @@ environments {
}

validate = { Exchange ex ->
return true
def title = XPathAPI.eval(ex.in.body, "//field[@name = 'title']").str()
def content = XPathAPI.eval(ex.in.body, "//field[@name = 'content']").str()

Expand All @@ -86,12 +92,12 @@ environments {
// Route definition. Should consume from 'direct:publish' and provide some business logic
publish = {
from('direct:publish').
//to("file:///home/archer/tmp/gnutch-output")
setHeader(Exchange.HTTP_URI, constant("${gnutch.solr.coreUrl}/update?commit=true")).
setHeader(Exchange.HTTP_QUERY, constant('commit=true')).
setHeader(Exchange.HTTP_METHOD, constant('POST')).
setHeader(Exchange.CONTENT_TYPE, constant('application/xml')).
to("http://null")
to("file:///home/archer/tmp/gnutch-output")
// setHeader(Exchange.HTTP_URI, constant("${gnutch.solr.coreUrl}/update?commit=true")).
// setHeader(Exchange.HTTP_QUERY, constant('commit=true')).
// setHeader(Exchange.HTTP_METHOD, constant('POST')).
// setHeader(Exchange.CONTENT_TYPE, constant('application/xml')).
// to("http://null")
}
}

Expand Down
6 changes: 1 addition & 5 deletions grails-app/routes/GnutchRoutes.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class GnutchRoutes extends RouteBuilder {
setBody(constant()).
log(LoggingLevel.DEBUG, 'gnutch', 'Retrieving ${headers.contextURI}').
to('http://null'). // invoking HttpClient
inOut('direct:postHttp').
process { ex -> (config.gnutch.handlers.postHTTP as org.apache.camel.Processor).process(ex) }.
choice().
// for text/html Content-type we unmarshall with Tidy, extracting sublinks and index page
when(header('Content-Type').contains("text/html")).
Expand Down Expand Up @@ -194,10 +194,6 @@ class GnutchRoutes extends RouteBuilder {
beanRef('invalidDocumentCollectorService', 'collect').
end()

from('direct:postHttp').
convertBodyTo(java.lang.String) // doing nothing, just converting to String


config.gnutch.handlers.publish.delegate = this
config.gnutch.handlers.publish.call()
}
Expand Down

0 comments on commit 6e52e25

Please sign in to comment.