Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.edu.agh.soa;
- import javax.ejb.Stateless;
- import javax.jws.WebResult;
- import javax.jws.WebService;
- import javax.jws.WebMethod;
- import javax.jws.WebParam;
- //import org.jboss.ejb3.annotation.SecurityDomain;
- //import org.jboss.ws.api.annotation.WebContext;
- //import javax.annotation.security.DeclareRoles;
- //import javax.annotation.security.RolesAllowed;
- import java.util.ArrayList;
- @Stateless
- @WebService
- //@SecurityDomain("domain1")
- //@DeclareRoles("user3")
- //@WebContext(
- // authMethod="BASIC",
- // transportGuarantee="NONE",
- // secureWSDLAccess=false)
- public class Hello {
- ArrayList<String> subjects = new ArrayList<>();
- String name;
- String surname;
- @WebMethod
- //@RolesAllowed("user3")
- @WebResult(name="returned")
- public String
- listSubjects(@WebParam(name="filter") String filter) {
- ArrayList<String> filtered = new ArrayList<>();
- for(String elem : subjects) {
- if(elem.contains(filter)) {
- filtered.add(elem);
- }
- }
- return "Filtered out: " + filtered;
- }
- @WebMethod
- @WebResult(name="returned")
- public String
- addSubject(@WebParam(name="subj") String subj) {
- subjects.add(subj);
- return "After add: " + subjects;
- }
- @WebMethod
- public void
- editName(String name) {
- this.name = name;
- }
- @WebMethod
- public void
- editSurname(String surname) {
- this.surname = surname;
- }
- }
Add Comment
Please, Sign In to add comment