Package javax.ws.rs.core

Examples of javax.ws.rs.core.Response


         {
            try
            {
               System.out.println("STARTED!!!!");
               Thread.sleep(5000);
               Response jaxrs = Response.ok("basic").type(MediaType.TEXT_PLAIN).build();
               response.setResponse(jaxrs);
            }
            catch (Exception e)
            {
               e.printStackTrace();
View Full Code Here


         {
            try
            {
               System.out.println("STARTED Gzip !!!!");
               Thread.sleep(5000);
               Response jaxrs = Response.ok("HELLO WORLD").type(MediaType.TEXT_PLAIN).header("Content-Encoding", "gzip").build();
               response.setResponse(jaxrs);
            }
            catch (Exception e)
            {
               e.printStackTrace();
View Full Code Here

               allowHeaderValue += allow;
            }

            if (httpMethod.equals("OPTIONS"))
            {
               Response res = Response.ok().header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new DefaultOptionsMethodException("No resource method found for options, return OK with Allow header", res);
            }
            else
            {
               Response res = Response.status(HttpResponseCodes.SC_METHOD_NOT_ALLOWED).header(HttpHeaderNames.ALLOW, allowHeaderValue).build();
               throw new MethodNotAllowedException("No resource method found for " + httpMethod + ", return 405 with Allow header", res);
            }
         }
         else if (!consumeMatch)
         {
View Full Code Here

   }

   @Test
   public void testData()
   {
      Response response = proxy.createContact(new Contact("Solomon", "Duskis"));
      Assert.assertEquals(response.getStatus(), 201);
      String duskisUri = (String) response.getMetadata().getFirst(
              HttpHeaderNames.LOCATION);
      System.out.println(duskisUri);
      Assert.assertTrue(duskisUri.endsWith(ContactsResource.CONTACTS_URL
              + "/data/Duskis"));
      Assert
View Full Code Here

          .setAttachmentUnmarshaller(new XopAttachmentUnmarshaller(
              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

          xopRootMediaType, ContentIDUtils.generateContentID(), null);
      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

         {
            try
            {
               System.out.println("STARTED!!!!");
               Thread.sleep(5000);
               Response jaxrs = Response.ok("basic").type(MediaType.TEXT_PLAIN).build();
               response.setResponse(jaxrs);
            }
            catch (Exception e)
            {
               e.printStackTrace();
View Full Code Here

                  {
                     try
                     {
                        System.out.println("STARTED!!!!");
                        Thread.sleep(5000);
                        Response jaxrs = Response.ok("basic").type(MediaType.TEXT_PLAIN).build();
                        response.setResponse(jaxrs);
                     }
                     catch (Exception e)
                     {
                        e.printStackTrace();
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

TOP

Related Classes of javax.ws.rs.core.Response

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.