Package javax.ws.rs

Examples of javax.ws.rs.WebApplicationException


   public String get()
   {
      if (ctx == null)
      {
         System.out.println("NO CONTEXT!!!!!");
         throw new WebApplicationException(500);
      }
      System.out.println("CONTEXT WAS THERE!");
      return "hello world";
   }
View Full Code Here


   @GET
   @Produces("text/plain")
   @Path("exception")
   public String testException()
   {
      throw new WebApplicationException(412);
   }
View Full Code Here

      @Produces("text/quoted")
      public String get()
      {
         if (MyApplicationConfig.created == false || instantiationCount > 1)
         {
            throw new WebApplicationException(500);
         }
         return "hello";
      }
View Full Code Here

   {
      System.out.println("********* IN SECURE CLIENT");
      if (!ctx.isUserInRole("admin"))
      {
          System.out.println("NOT IN ROLE!!!!");
          throw new WebApplicationException(401);
      }
      return "Wild";
   }
View Full Code Here

      {
         System.out.println("********* IN SECURE CLIENT");
         if (!ctx.isUserInRole("admin"))
         {
            System.out.println("NOT IN ROLE!!!!");
            throw new WebApplicationException(401);
         }
         return "hello";
      }
View Full Code Here

              xopPackage));
      return unmarshaller.unmarshal(new StreamSource(rootPart.getBody(
          InputStream.class, null)));
    } catch (JAXBException e) {
      Response response = Response.serverError().build();
      throw new WebApplicationException(e, response);
    }
  }
View Full Code Here

      List<OutputPart> outputParts = xopPackage.getParts();
      outputParts.remove(outputPart);
      outputParts.add(0, outputPart);
    } catch (JAXBException e) {
      Response response = Response.serverError().build();
      throw new WebApplicationException(e, response);
    }
  }
View Full Code Here

      Iterator<ImageWriter> writers = ImageIO.getImageWritersByMIMEType(mediaType.toString());
      ImageWriter writer = writers.next();
      if (writer == null)
      {
         Response response = Response.serverError().entity("").build();
         throw new WebApplicationException(response);
      }
      return writer;
   }
View Full Code Here

         String[] availableTypes = ImageIO.getReaderMIMETypes();
         logger.warn("A reader for {0} was not found. This provider is currently configured"
                 + "to handle only {1}", mediaType, availableTypes);
         List<Variant> variants = ProviderHelper.getAvailableVariants(availableTypes);
         Response response = Response.notAcceptable(variants).status(Status.NOT_ACCEPTABLE).build();
         throw new WebApplicationException(response);
      }
      return reader;
   }
View Full Code Here

      catch (InvocationTargetException e)
      {
         Throwable cause = e.getCause();
         if (cause instanceof WebApplicationException)
         {
            WebApplicationException wae = (WebApplicationException) cause;
            throw wae;
         }
         throw new ApplicationException(cause);
      }
      catch (IllegalArgumentException e)
View Full Code Here

TOP

Related Classes of javax.ws.rs.WebApplicationException

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.