Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm afraid I can't offer anything on the Scala front, but as far as Java goes you should think of your new service as being in the Service layer of your application, whereas the REST/SOAP/Whatever interface to your service is defined in the Web/Servlet layer. </p> <p>So let us say you have a service like the following in your com.myco.services package:</p> <pre><code>public interface PersonService { public Person createPerson(PersonIdentifier id, PersonType type); public Person retrievePerson(PersonIdentifier id); public void updatePerson(Person existingPerson); public void deletePerson(Person existingPerson); public boolean authenticatePerson(String personName, String password); } </code></pre> <p>We'll take it as read that you have an PersonServiceImpl implementation of this that updates your database or whatever. In your application on the same JVM you can inject the PersonServiceImpl into your code and call the methods directly, without having to marshal or unmarshal the parameters.</p> <p>In the Web layer you can have a separate PersonServiceController that is mapped to URLs in your servlet. When a URL like "http://myco.com/person/update" is hit, the body of the request can be passed to the controller like so:</p> <pre><code>public class PersonServiceController { private final PersonService personService; // Inject PersonServiceImpl in constructor ... public void updatePerson(String requestBody) { Person updatedPerson = unmarshalPerson(requestBody); this.personService.updatePerson(updatedPerson); } ... } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload