@Override /* RestConverter */ @SuppressWarnings({"rawtypes", "unchecked"}) public Object convert(RestRequest req, Object o, ClassMeta cm) throws RestException { if (o == null) return null; if (req.getPathRemainder() != null) { try { if (cm.getPojoSwap() != null) o = cm.getPojoSwap().swap(o, req.getBeanContext()); PojoRest p = new PojoRest(o, req.getReaderParser()); o = p.get(req.getPathRemainder()); } catch (SerializeException e) { throw new RestException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e); } catch (PojoRestException e) { throw new RestException(e.getStatus(), e); } } return o; } }
@Override /* RestConverter */ @SuppressWarnings({"rawtypes", "unchecked"}) public Object convert(RestRequest req, Object o) throws RestException, InternalServerError { if (o == null) return null; String pathRemainder = req.getPathMatch().getRemainder(); if (pathRemainder != null) { try { BeanSession bs = req.getBeanSession(); PojoSwap swap = bs.getClassMetaForObject(o).getPojoSwap(bs); if (swap != null) o = swap.swap(bs, o); PojoRest p = new PojoRest(o, req.getBody().getReaderParser()); o = p.get(pathRemainder); } catch (PojoRestException e) { throw new RestException(e, e.getStatus()); } catch (Exception e) { throw new InternalServerError(e); } } return o; } }
@Override /* RestConverter */ @SuppressWarnings({"rawtypes", "unchecked"}) public Object convert(RestRequest req, Object o) throws RestException, InternalServerError { if (o == null) return null; String pathRemainder = req.getPathMatch().getRemainder(); if (pathRemainder != null) { try { BeanSession bs = req.getBeanSession(); PojoSwap swap = bs.getClassMetaForObject(o).getPojoSwap(bs); if (swap != null) o = swap.swap(bs, o); PojoRest p = new PojoRest(o, req.getBody().getReaderParser()); o = p.get(pathRemainder); } catch (PojoRestException e) { throw new RestException(e, e.getStatus()); } catch (Exception e) { throw new InternalServerError(e); } } return o; } }
@Override /* RestConverter */ @SuppressWarnings({"rawtypes", "unchecked"}) public Object convert(RestRequest req, Object o) throws RestException, InternalServerError { if (o == null) return null; String pathRemainder = req.getPathMatch().getRemainder(); if (pathRemainder != null) { try { BeanSession bs = req.getBeanSession(); PojoSwap swap = bs.getClassMetaForObject(o).getPojoSwap(bs); if (swap != null) o = swap.swap(bs, o); PojoRest p = new PojoRest(o, req.getBody().getReaderParser()); o = p.get(pathRemainder); } catch (PojoRestException e) { throw new RestException(e, e.getStatus()); } catch (Exception e) { throw new InternalServerError(e); } } return o; } }