@Test public void testResolveBody() { InputStream is = new ByteArrayInputStream(("{\"message\":\"" + theString + "\"}").getBytes()); when(mockedRequest.getMethod()).thenReturn("POST"); Object[] resolvedArgs = operationBodyParamBinding.resolveArgs(mockedRequest, is, MediaType.APPLICATION_JSON_TYPE, "utf-8"); assertEquals(resolvedArgs[0], theString); }
public RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding) { if (mediaType != null) { DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType); if(factory == null) { throw new CougarFrameworkException("Invalid content type " + mediaType); } UnMarshaller unMarshaller = factory.getUnMarshaller(); return (RescriptBody)unMarshaller.unmarshall(inputStream, bindingDescriptor.getBodyClass(), encoding, false); } return null; }
RescriptOperationBinding { public RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding) { if (mediaType != null) { DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType); if(factory == null) { throw new CougarFrameworkException("Invalid content type " + mediaType); } UnMarshaller unMarshaller = factory.getUnMarshaller(); return (RescriptBody)unMarshaller.unmarshall(inputStream, bindingDescriptor.getBodyClass(), encoding, false); } return null; } }
RescriptOperationBinding { public RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding) { if (mediaType != null) { DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType); if(factory == null) { throw new CougarFrameworkException("Invalid content type " + mediaType); } UnMarshaller unMarshaller = factory.getUnMarshaller(); return (RescriptBody)unMarshaller.unmarshall(inputStream, bindingDescriptor.getBodyClass(), encoding, false); } return null; } RescriptOperationBinding(RescriptOperationBindingDescriptor bindingDescriptor, OperationDefinition opDef, boolean hardFailEnums); }
RescriptOperationBinding { public RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding) { if (mediaType != null) { DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType); if(factory == null) { throw new CougarFrameworkException("Invalid content type " + mediaType); } UnMarshaller unMarshaller = factory.getUnMarshaller(); return (RescriptBody)unMarshaller.unmarshall(inputStream, bindingDescriptor.getBodyClass(), encoding, false); } return null; } RescriptOperationBinding(RescriptOperationBindingDescriptor bindingDescriptor, OperationDefinition opDef, boolean hardFailEnums); String getMethod(); OperationKey getOperationKey(); RescriptOperationBindingDescriptor getBindingDescriptor(); Object[] resolveArgs(HttpServletRequest request, InputStream inputStream, MediaType mediaType, String encoding); Object resolveArgument(String value, Parameter param, RescriptParamBindingDescriptor descriptor, String format); RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding); @Override String toString(); }
RescriptOperationBinding { public RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding) { if (mediaType != null) { DataBindingFactory factory = DataBindingManager.getInstance().getFactory(mediaType); if(factory == null) { throw new CougarFrameworkException("Invalid content type " + mediaType); } UnMarshaller unMarshaller = factory.getUnMarshaller(); return (RescriptBody)unMarshaller.unmarshall(inputStream, bindingDescriptor.getBodyClass(), encoding, false); } return null; } RescriptOperationBinding(RescriptOperationBindingDescriptor bindingDescriptor, OperationDefinition opDef, boolean hardFailEnums); String getMethod(); OperationKey getOperationKey(); RescriptOperationBindingDescriptor getBindingDescriptor(); Object[] resolveArgs(HttpServletRequest request, InputStream inputStream, MediaType mediaType, String encoding); Object resolveArgument(String value, Parameter param, RescriptParamBindingDescriptor descriptor, String format); RescriptBody resolveBody(InputStream inputStream, MediaType mediaType, String encoding); @Override String toString();  }