Package com.sun.jersey.api

Examples of com.sun.jersey.api.NotFoundException


    public Response post(@FormParam("attribute_names") List<String> attrNames,
                         @FormParam("subjectid") String subjectId)
    {
        UserRecord rec = sm.getByToken(subjectId);
        if (rec == null) {
            throw new NotFoundException("No such token " + subjectId);
        }

        StringBuffer res = new StringBuffer(PREFIX + "token.id=" + subjectId + "\n");

        Attributes attrs = rec.getAttributes();
View Full Code Here


                         @FormParam("attribute_names") List<String> attrNames,
                         @FormParam("admin") String adminId)
    {
        UserRecord admin = sm.getByToken(adminId);
        if (admin == null) {
            throw new NotFoundException("Invalid token " + adminId);
        }

        // check that the admin user is actually in the admin group
        if (!isAdmin(admin.getUserId())) {
            return Response.status(Response.Status.FORBIDDEN)
                           .entity("Only administrators can read")
                           .type("text/plain").build();
        }

        // now look up the user
        UserRecord rec = sm.get(name);
        if (rec == null) {
            throw new NotFoundException("Unknown name " + name);
        }

        StringBuffer res = new StringBuffer(PREFIX + "name=" + name + "\n");
        res.append(PREFIX + "type=user\n");
        res.append(PREFIX + "attribute=\n");
View Full Code Here

    public GoobiProcess getProcess(@PathParam("ppnIdentifier") IdentifierPPN ippn) {

        GoobiProcess process = GoobiProcessDAO.getProcessByPPN(ippn);

        if (process == null) {
            throw new NotFoundException("No such process.");
        }

        return process;
    }
View Full Code Here

    public List<GoobiProcessStep> getProcessSteps(@PathParam("ppnIdentifier") IdentifierPPN ippn) {

        List<GoobiProcessStep> resultList = GoobiProcessDAO.getAllProcessSteps(ippn);

        if (resultList.isEmpty()) {
            throw new NotFoundException("No such process.");
        }

        return resultList;
    }
View Full Code Here

      List<URI> guids = service.listGuids();
      return Response.ok(AtomFactory.buildAtom(guids))
          .type(MediaType.APPLICATION_ATOM_XML).build();
    } catch (IOException e) {
      e.printStackTrace();
      throw new NotFoundException();
    }
  }
View Full Code Here

      List<URI> dsids = service.listDatastreams(guid);
      return Response.ok(AtomFactory.buildAtom(dsids))
          .type(MediaType.APPLICATION_ATOM_XML).build();
    } catch (Exception e) {
      e.printStackTrace();
      throw new NotFoundException();
    }
  }
View Full Code Here

    List<URI> dsids = null;
    try {
      dsids = service.getDatastream(guid, dsid);
    } catch (Exception e) {
      e.printStackTrace();
      throw new NotFoundException();
    }
    if (dsids.isEmpty()) {
      throw new NotFoundException("Datastream " + dsid + " of GUID "
          + guid + " is not found");
    } else if (dsids.size() == 1) {
      try {
        InputStream in = service.openDatastream(guid, dsid, null);
        return Response.ok(in).type(ConverterManager.getMimeType(dsid))
            .build();
      } catch (Exception e) {
        e.printStackTrace();
        throw new NotFoundException();
      }
    } else {
      return Response.ok(AtomFactory.buildAtom(dsids))
          .type(MediaType.APPLICATION_ATOM_XML).build();
    }
View Full Code Here

      in = service.openDatastream(guid, dsid, serialNumber);
      return Response.ok(in).type(ConverterManager.getMimeType(dsid))
          .build();
    } catch (Exception e) {
      e.printStackTrace();
      throw new NotFoundException();
    }
  }
View Full Code Here

  public Response offlineDownload(@QueryParam("path") String path) {

    String plainText = DownloadLocationHelper.decrypt(path);
    String[] parts = plainText.split("/");
    if (parts.length != 2) {
      throw new NotFoundException();
    }
    String email = parts[0];
    String filename = parts[1];

    try {
      final OfflineDownloadResponse response = downloadResponseFetcher
          .fetch(email, filename);
      return Response
          .ok(new StreamingOutput() {
            @Override
            public void write(OutputStream output)
                throws IOException, WebApplicationException {
              IOUtils.copy(response.getBlob().openInputStream(),
                  output);
            }
          })
          .header("Content-Disposition",
              "attachment; filename=" + filename).build();
    } catch (IOException e) {
      throw new NotFoundException();
    }
  }
View Full Code Here

    public Building getBuilding() {
        SqlSession sess = IBatisFactory.getInstance().getSqlSession();
        Building b = (Building) sess.selectOne("Building.getByBuildingId", new Long(buildingIdStr));
        sess = null;
        if (b == null) {
            throw new NotFoundException("No such Building.");
        }
        return b;
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.NotFoundException

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.