Package org.jboss.resteasy.spi

Examples of org.jboss.resteasy.spi.WriterException


            } else if (isJSONAbleCollection(type, genericType)) {
                return getString((Collection<JSONAble>)object).getBytes().length;
            }
            return 0;
        } catch (JSONException e) {
            throw new WriterException(e);
        }
    }
View Full Code Here


                content = getString((Collection<JSONAble>)object);
            } else {
                return;
            }
        } catch (JSONException e) {
            throw new WriterException(e);
        }

        try {
            PrintStream ps = new PrintStream(new BufferedOutputStream(entityStream), true, "UTF-8");
            String contentTypeHeader = mediaType.toString() + ";charset=utf-8";
View Full Code Here

      }
      catch (Exception e)
      {

         logger.debug("Failed to encode yaml for object: {0}", t.toString());
         throw new WriterException(e);

      }

   }
View Full Code Here

         headers.putSingle("Content-Type", contentType);
         mp.writeTo(os);
      }
      catch (Exception e)
      {
         throw new WriterException(e);
      }
   }
View Full Code Here

         httpHeaders.putSingle("Content-Type", MediaType.valueOf(mimeMultipart.getContentType()));
         mimeMultipart.writeTo(entityStream);
      }
      catch (MessagingException e)
      {
         throw new WriterException(e);
      }

   }
View Full Code Here

            {
               value = method.invoke(obj);
            }
            catch (IllegalAccessException e)
            {
               throw new WriterException(e);
            }
            catch (InvocationTargetException e)
            {
               throw new WriterException(e.getCause());
            }
            PartType partType = method.getAnnotation(PartType.class);
            String filename = getFilename(method);

            multipart.addFormData(param.value(), value, method.getReturnType(), method.getGenericReturnType(), MediaType.valueOf(partType.value()), filename);
View Full Code Here

            {
               value = field.get(obj);
            }
            catch (IllegalAccessException e)
            {
               throw new WriterException(e);
            }
            PartType partType = field.getAnnotation(PartType.class);
            String filename = getFilename(field);

            output.addFormData(param.value(), value, field.getType(), field.getGenericType(), MediaType.valueOf(partType.value()), filename);
View Full Code Here

         StreamResult result = new StreamResult(output);
         transformerFactory.newTransformer().transform(source, result);
      }
      catch (TransformerException te)
      {
         throw new WriterException(te);
      }
   }
View Full Code Here

*/
public class WriterExceptionMapperTest extends TestExceptionMapperBase {

    @Test
    public void handleExceptionWithoutResponse() {
        WriterException nfe = new WriterException("unacceptable");
        WriterExceptionMapper nfem = injector.getInstance(WriterExceptionMapper.class);
        Response r = nfem.toResponse(nfe);
        assertEquals(500, r.getStatus());
        verifyMessage(r, rtmsg("unacceptable"));
    }
View Full Code Here

    @Test
    public void handleExceptionWithResponse() {
        Response mockr = mock(Response.class);
        when(mockr.getStatus()).thenReturn(400);
        WriterException nfe = new WriterException("unacceptable", mockr);
        WriterExceptionMapper nfem = injector.getInstance(WriterExceptionMapper.class);
        Response r = nfem.toResponse(nfe);
        assertEquals(400, r.getStatus());
        verifyMessage(r, rtmsg("unacceptable"));
    }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.spi.WriterException

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.