Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
import static com.epam.deltix.qsrv.hf.tickdb.http.AbstractHandler.*;
import static com.epam.deltix.qsrv.hf.tickdb.http.HTTPProtocol.*;

import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

/**
*
*/
Expand Down Expand Up @@ -97,6 +101,11 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
final Unmarshaller um = TBJAXBContext.createUnmarshaller();
final Object body;

XMLInputFactory xif = XMLInputFactory.newFactory();
xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
XMLStreamReader xsr = null;

if (DEBUG) {
try {
final String xml = BasicIOUtil.readFromStream(req.getInputStream());
Expand All @@ -107,13 +116,24 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
LOGGER.fine("request: " + xml);
}

body = um.unmarshal(new StringReader(xml));
try {
xsr = xif.createXMLStreamReader(new StringReader(xml));
} catch(XMLStreamException e) {
throw new RuntimeException(e);
}
body = um.unmarshal(xsr);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
else
body = um.unmarshal(req.getInputStream());
else {
try {
xsr = xif.createXMLStreamReader(req.getInputStream());
} catch(XMLStreamException e) {
throw new RuntimeException(e);
}
body = um.unmarshal(xsr);
}

if (body instanceof XmlRequest)
HTTPProtocol.validateVersion(((XmlRequest) body).version);
Expand Down