Package org.atomojo.app.auth

Examples of org.atomojo.app.auth.User


         if (emailE!=null) {
            email = emailE.getText();
         }
         try {

            User user = auth.getUser(cred,alias);
            if (user!=null) {
               try {
                  if (nameE!=null || emailE!=null) {
                     // The name starts the same and can only be changed.  It can't be deleted
                     String newName = user.getName();
                     // Set it to the new name only if it was specified
                     if (name!=null) {
                        newName = name;
                     }
                     String newEmail = user.getEmail();
                     // Set to new e-mail if it exists
                     if (email!=null) {
                        newEmail = email;
                     }
                     // If the e-mail was missing, remove it
View Full Code Here


               getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
               return new StringRepresentation("XML error while parsing document: "+ex.getMessage());
            }
         }
        
         User user = (User)getRequest().getAttributes().get(App.USER_ATTR);
         try {
            Entry entry = app.createEntry(user,feed,doc);
           
            getResponse().setStatus(Status.SUCCESS_CREATED);
            Form headers = new Form();
            getResponse().getAttributes().put("org.restlet.http.headers",headers);
            Reference ref = new Reference(myself+"_/"+entry.getUUID().toString());
            getResponse().setLocationRef(ref);
            Representation rep = new InfosetRepresentation(MediaType.APPLICATION_ATOM,doc);
            rep.setCharacterSet(CharacterSet.UTF_8);
            rep.setTag(new Tag(Long.toString(entry.getEdited().getTime()),false));
            MediaType entryType = new MediaType(rep.getMediaType().getName(),rep.getMediaType().getParameters().createSeries(EntryResource.entryParameters));
            rep.setMediaType(entryType);
            return rep;
           
         } catch (AppException ex) {
            getContext().getLogger().log(Level.SEVERE,ex.getMessage(),ex.getCause());
            getResponse().setStatus(ex.getStatus());
            return new StringRepresentation(ex.getMessage());
         }
        
      } else {
         // Get the slug for the resource & entry
         Form headers = (Form)getRequest().getAttributes().get("org.restlet.http.headers");
         String slug = headers.getValues("slug");
         if (slug==null) {
            slug = headers.getValues("Slug");
         }
         if (slug!=null) {
            try {
               // Decode the precent encoding of the UTF-8 values
               slug = URLDecoder.decode(slug,"UTF-8");
               // Encode the slug as a URL encoding
               slug = URLEncoder.encode(slug,"UTF-8");
            } catch (UnsupportedEncodingException ex) {
               getLogger().log(Level.SEVERE,"Cannot decode slug value: "+slug,ex);
            }
            getContext().getLogger().info("Slug="+slug);
         }
         String idS = headers.getValues("id");
         UUID id = null;
         if (idS!=null) {
            try {
               id = UUID.fromString(idS);
            } catch (Exception ex) {
            }
         } else {
            id = UUID.randomUUID();
         }
        
         try {

            // Get author name for identity
            User user = (User)getRequest().getAttributes().get(App.USER_ATTR);
            Entry entry = app.createMediaEntry(user,feed,entity,slug,id);
           
            getResponse().setStatus(Status.SUCCESS_CREATED);
            headers = new Form();
            getResponse().getAttributes().put("org.restlet.http.headers",headers);
View Full Code Here

      if (dest==null) {
         getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         return null;
      } else {
         Reference ref = getRequest().getRootRef().clone().addSegment("R/");
         User user = (User)getRequest().getAttributes().get(App.USER_ATTR);
         URI root = URI.create(ref.toString());
         String path = null;
         try {
            path = root.relativize(new URI(dest)).toString();
            String [] segments = path.split("/");
View Full Code Here

         return new StringRepresentation("Bad 'Slug' header value: "+slug);
      }
      try {

         // Get author name for identity
         User user = (User)getRequest().getAttributes().get(App.USER_ATTR);
        
         Representation entity = storage.getMedia(feed.getPath(),feed.getUUID(),media.getName());
         entity.setMediaType(media.getMediaType());
        
         UUID id = UUID.randomUUID();
View Full Code Here

TOP

Related Classes of org.atomojo.app.auth.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.