Class: ArchivesSpaceOAIServer

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
oai/app/main.rb

Overview

JRuby 9.3.0.0 introduced more nuanced thread teardowns. See: https://github.com/jruby/jruby/pull/6176 Under the assumption that the thread dump facility is not widely relied-upon, we hereby comment it out… require ‘archivesspace_thread_dump’ ArchivesSpaceThreadDump.init(File.join(ASUtils.find_base_directory, “thread_dump_oai.txt”))

Constant Summary collapse

TIMEOUT =
600

Instance Method Summary collapse

Instance Method Details

#build_oai_urlObject



56
57
58
# File 'oai/app/main.rb', line 56

def build_oai_url
  URI.join(AppConfig[:backend_url], 'oai')
end

#prepare_headers(headers) ⇒ Object



60
61
62
63
64
# File 'oai/app/main.rb', line 60

def prepare_headers(headers)
  Hash[headers.map {|header, values|
         [header, values.join(' ')]
       }]
end

#send_get(query_string) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'oai/app/main.rb', line 44

def send_get(query_string)
  oai_url = build_oai_url
  oai_url.query = query_string

  ASHTTP.start_uri(oai_url, :open_timeout => TIMEOUT, :read_timeout => TIMEOUT) do |http|
    http_request = Net::HTTP::Get.new(oai_url.request_uri)
    response = http.request(http_request)

    [Integer(response.code), prepare_headers(response.to_hash), response.body]
  end
end