ABAP Framework for developing HTTP web services.
class yea_testing_service definition
public
inheriting from yea_abs_service
final
create public .
public section.
methods constructor.
methods yea_service~root redefinition.
endclass.
class yea_testing_service implementation.
method yea_service~root.
returning = '/yea/tests'.
endmethod.
method constructor.
super->constructor( ).
endmethod.
endclass.
class yea_root_route definition
public
final
create public .
public section.
interfaces yea_route.
endclass.
class yea_root_route implementation.
method yea_route~execute.
response->set_status( 200 )->send_text( request->method( ) ).
endmethod.
endclass.
method constructor.
super->constructor( ).
data(route) = new yea_root_route( ).
me->get( path = '/' route = route ).
me->post( path = '/' route = route ).
me->put( path = '/' route = route ).
me->delete( path = '/' route = route ).
endmethod.
~ > curl -H "sap-user: ..." -H "sap-password: ..." -X GET -si http://linux-nsts:8000/yea/tests
HTTP/1.1 200 Ok
set-cookie: sap-usercontext=sap-client=001; path=/
set-cookie: SAP_SESSIONID_NPL_001=YiuQPa3taGgJpycbgKq-dwGa-lNKzxHnmJ4IACflDbk%3d; path=/
content-type: text/plain; charset=utf-8
content-length: 3
GET
~ > curl -H "sap-user: ..." -H "sap-password: ..." -X POST -si http://linux-nsts:8000/yea/tests
HTTP/1.1 200 Ok
set-cookie: sap-usercontext=sap-client=001; path=/
set-cookie: SAP_SESSIONID_NPL_001=61tLssgv-TlhcX34DWutIQlGUn9KzxHnmJ4IACflDbk%3d; path=/
content-type: text/plain; charset=utf-8
content-length: 4
POST
~ > curl -H "sap-user: ..." -H "sap-password: ..." -H -X PUT -si http://linux-nsts:8000/yea/tests
HTTP/1.1 200 Ok
set-cookie: sap-usercontext=sap-client=001; path=/
content-type: text/plain; charset=utf-8
content-length: 3
PUT
~ > curl -H "sap-user: ..." -H "sap-password: ..." -H -X DELETE -si http://linux-nsts:8000/yea/tests
HTTP/1.1 200 Ok
set-cookie: sap-usercontext=sap-client=001; path=/
set-cookie: SAP_SESSIONID_NPL_001=rpwC8DRGLZcppBE2sJeVnBLMRRtKzxHnmJ4IACflDbk%3d; path=/
content-type: text/plain; charset=utf-8
content-length: 6
DELETE
~ > curl -H "sap-user: ..." -H "sap-password: ..." -X GET -si http://linux-nsts:8000/yea/tests/nowhere
HTTP/1.1 404 Not found
set-cookie: sap-usercontext=sap-client=001; path=/
set-cookie: SAP_SESSIONID_NPL_001=Ikv5NdI1ntxa7lWxdSr3SeLQ6cVK2BHnmn4IACflDbk%3d; path=/
content-type: text/html
content-length: 0
~/ > curl -H "sap-user: ..." -H "sap-password: ..." -X MADEUP -si http://linux-nsts:8000/yea/tests
HTTP/1.1 405 Method not allowed
set-cookie: sap-usercontext=sap-client=001; path=/
set-cookie: SAP_SESSIONID_NPL_001=pP0bOFv495KiZPX70RNdEetgloVK2BHnmn4IACflDbk%3d; path=/
content-type: text/html
content-length: 0
-
yea_abs_service
an abstract implementation for building web servicesroot
returns the root path to the service as defined in SICF
-
yea_request
an abstraction fori_http_request
.method
get the method used in the requestcontent_type
get the content-type supplied by the clientheaders
todobody
returns a string representation of the bodyraw
returns a xstring representation of the bodypath
the path that was used in the requestquery
an interface to access queries used in the uriparameters
an interface to access parameters used in the uriroot
returns the root of the service
-
yea_response
an abstraction fori_http_response
.redirect
tells the client to visit another routeset_status
sets the HTTP status codesend_text
send a plain text messagesend_file
send a filesend_json
send a json object (not implemeneted yet)end
prevents this instance from future modificationfinished
-
yea_route
an interface for providing a route implementation -
yea_parameters
an interface for retreiving variables in a URIget
get a valuehas
checks if a value is avaliablelist
a string table of keys
-
yea_query
similar to parameters but for URI queries.get
has
list