Ignore:
Timestamp:
06/26/09 13:29:12 (16 years ago)
Author:
lgiessmann
Message:

ajax-client: fixed some bugs that were discovered by using opera; json-server: implemented a new json-handler, this handler returns a topic-psi-list of all valid topic-instances (valid: is oriented only on topic-typing and tmcl - all other constraints are not checked by the server)

Location:
trunk/src/rest_interface
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/rest_interface/rest-interface.lisp

    r28 r70  
    3131           :*json-get-summary-prefix*
    3232           :*json-get-all-type-psis*
     33           :*json-get-all-instance-psis*
    3334           :*json-get-topic-stub-prefix*
    3435           :*json-get-type-tmcl-prefix*
  • TabularUnified trunk/src/rest_interface/set-up-json-interface.lisp

    r68 r70  
    1515(defparameter *json-get-summary-url* "/json/summary/?$") ;the url to get a summary of all topic stored in isidorus; you have to set the GET-parameter "start" for the start index of all topics within elephant and the GET-paramter "end" for the last index of the topic sequence -> http://localhost:8000/json/summary/?start=12&end=13
    1616(defparameter *json-get-all-type-psis* "/json/tmcl/types/?$") ;returns a list of all psis that can be a type
     17(defparameter *json-get-all-instance-psis* "/json/tmcl/instances/?$") ;returns a list of all psis that belongs to a valid topic-instance
    1718(defparameter *json-get-topic-stub-prefix* "/json/topicstubs/(.+)$") ;the json prefix for getting some topic stub information of a topic
    1819(defparameter *json-get-type-tmcl-url* "/json/tmcl/type/?$") ;the json url for getting some tmcl information of a topic treated as a type
     
    3031                              (json-get-summary-url *json-get-summary-url*)
    3132                              (json-get-all-type-psis *json-get-all-type-psis*)
     33                              (json-get-all-instance-psis *json-get-all-instance-psis*)
    3234                              (json-get-topic-stub-prefix *json-get-topic-stub-prefix*)
    3335                              (json-get-type-tmcl-url *json-get-type-tmcl-url*)
     
    8587   hunchentoot:*dispatch-table*)
    8688  (push
     89   (create-regex-dispatcher json-get-all-instance-psis #'return-all-tmcl-instances)
     90   hunchentoot:*dispatch-table*)
     91  (push
    8792   (create-regex-dispatcher json-get-type-tmcl-url #'(lambda(&optional param)
    8893                                                       (declare (ignorable param))
     
    105110;; =============================================================================
    106111(defun return-all-tmcl-types(&optional param)
    107   "Returns all topics that are valid types -> so they have to be valid to the
     112  "Returns all topic-psi that are valid types -> so they have to be valid to the
    108113   topictype-constraint (if it exists) and the can't be abstract."
    109114  (declare (ignorable param))
     
    118123                       (setf (hunchentoot:content-type*) "text")
    119124                       (format nil "Condition: \"~a\"" err)))))
     125
     126(defun return-all-tmcl-instances(&optional param)
     127  "Returns all topic-psis that are valid instances of any topic type.
     128   The validity is only oriented on the typing of topics, e.g.
     129   type-instance or supertype-subtype."
     130  (declare (ignorable param))
     131  (handler-case (let ((topic-instances (json-tmcl::return-all-tmcl-instances)))
     132                  (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
     133                  (json:encode-json-to-string
     134                   (map 'list #'(lambda(y)
     135                                  (map 'list #'uri y))
     136                        (map 'list #'psis topic-instances))))
     137    (condition (err) (progn
     138                       (setf (hunchentoot:return-code*) hunchentoot:+http-internal-server-error+)
     139                       (setf (hunchentoot:content-type*) "text")
     140                       (format nil "Condition: \"~a\"" err)))))
     141
    120142
    121143(defun return-topic-stub-of-psi(&optional psi)
Note: See TracChangeset for help on using the changeset viewer.