/** * Sets the input properties for the current {@link java.lang.Thread} and * returns any existing input properties that have been set (so they can be * restored later). */ public static InputProperties setThreadInputProperties( InputProperties inputProperties) { Preconditions.checkNotNull(inputProperties, "inputProperties"); InputProperties currentProperties = getThreadInputProperties(); threadInputProperties.set(inputProperties); return currentProperties; }
/** * Sets the input properties for the current {@link java.lang.Thread} and * returns any existing input properties that have been set (so they can be * restored later). */ public static InputProperties setThreadInputProperties( InputProperties inputProperties) { Preconditions.checkNotNull(inputProperties, "inputProperties"); InputProperties currentProperties = getThreadInputProperties(); threadInputProperties.set(inputProperties); return currentProperties; }
@SuppressWarnings("unchecked") public Object getContent(DataSource ds) throws IOException { // Get the input properties to use when parsing content InputProperties inputProperties = getThreadInputProperties(); // Find the parser to handle the input content type ContentType contentType = new ContentType(ds.getContentType()); AltRegistry altRegistry = inputProperties.getAltRegistry(); AltFormat altFormat = altRegistry.lookupType(contentType); InputParser<?> parser = altRegistry.getParser(altFormat); if (parser == null) { throw new IOException("Invalid multipart content: " + contentType); } try { return parseAtom(parser, ds.getInputStream(), contentType, inputProperties, inputProperties.getRootType()); } catch (ServiceException se) { IOException ioe = new IOException("Error parsing content"); ioe.initCause(se); throw ioe; } }
@SuppressWarnings("unchecked") public Object getContent(DataSource ds) throws IOException { // Get the input properties to use when parsing content InputProperties inputProperties = getThreadInputProperties(); // Find the parser to handle the input content type ContentType contentType = new ContentType(ds.getContentType()); AltRegistry altRegistry = inputProperties.getAltRegistry(); AltFormat altFormat = altRegistry.lookupType(contentType); InputParser<?> parser = altRegistry.getParser(altFormat); if (parser == null) { throw new IOException("Invalid multipart content: " + contentType); } try { return parseAtom(parser, ds.getInputStream(), contentType, inputProperties, inputProperties.getRootType()); } catch (ServiceException se) { IOException ioe = new IOException("Error parsing content"); ioe.initCause(se); throw ioe; } }