Package javax.ws.rs

Examples of javax.ws.rs.WebApplicationException


         public DummyObject readFrom(Class<DummyObject> type, Type genericType, Annotation[] annotations,
                                     MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
                 throws IOException, WebApplicationException
         {
            throw new WebApplicationException(999); // deliberate crazy status
         }

      });

      HttpClient client = new HttpClient();
View Full Code Here


         public void writeTo(DummyObject t, Class<?> type, Type genericType, Annotation[] annotations,
                             MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
                 throws IOException, WebApplicationException
         {
            throw new WebApplicationException(999); // deliberate crazy status
         }

      });

      HttpClient client = new HttpClient();
View Full Code Here

      @GET
      @Produces("text/plain")
      @Path("/bad")
      public String response()
      {
         throw new WebApplicationException(Response.status(Status.CONFLICT).entity("conflicted").build());
      }
View Full Code Here

   public static class MyTestResource implements MyTest
   {
      public void postIt(String msg)
      {
         System.out.println("HERE: " + msg);
         throw new WebApplicationException(401);
      }
View Full Code Here

   {
      @Path("/exception")
      @GET
      public Response get() throws WebApplicationException
      {
         throw new WebApplicationException(Response.status(HttpResponseCodes.SC_UNAUTHORIZED).build());

      }
View Full Code Here

      @Path("/exception/entity")
      @GET
      public Response getEntity() throws WebApplicationException
      {
         throw new WebApplicationException(Response.status(HttpResponseCodes.SC_UNAUTHORIZED).entity("error").build());

      }
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

    {
      viewingPleasure.render(getContextData(HttpServletRequest.class), getContextData(HttpServletResponse.class));
    }
    catch (ServletException ex)
    {
      throw new WebApplicationException(ex);
    }
  }
View Full Code Here

                   break;
               }
           }
           if (greetingMessage == null)
           {
               throw new WebApplicationException(500);
           }
           return greetingMessage;
       }
   }
View Full Code Here

        if ("login".equals(action)) {
            return ("System Message" + "__" + name + " has joined.");
        } else if ("post".equals(action)) {
            return name + "__" + form.getFirst("message");
        } else {
            throw new WebApplicationException(422);
        }
    }
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.