use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class IdentityRequestWrapper method processRequestFilter.
@Override
public Navajo processRequestFilter(HttpServletRequest request) throws IOException, ServletException {
Navajo in = null;
// String sendEncoding = request.getHeader("Accept-Encoding");
String recvEncoding = request.getHeader("Content-Encoding");
// boolean useSendCompression = ((sendEncoding != null) &&
// (sendEncoding.indexOf("zip") != -1));
boolean useRecvCompression = ((recvEncoding != null) && (recvEncoding.indexOf("zip") != -1));
BufferedInputStream is = null;
if (useRecvCompression) {
java.util.zip.GZIPInputStream unzip = new java.util.zip.GZIPInputStream(request.getInputStream());
is = new BufferedInputStream(unzip);
in = NavajoFactory.getInstance().createNavajo(is);
} else {
is = new BufferedInputStream(request.getInputStream());
in = NavajoFactory.getInstance().createNavajo(is);
}
if (in == null) {
throw new ServletException("Invalid request.");
}
return in;
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class LaszloRequestWrapper method processRequestFilter.
@Override
public Navajo processRequestFilter(HttpServletRequest request) throws IOException, ServletException {
Navajo in = null;
// String sendEncoding = request.getHeader("Accept-Encoding");
String recvEncoding = request.getHeader("Content-Encoding");
// boolean useSendCompression = ((sendEncoding != null) &&
// (sendEncoding.indexOf("zip") != -1));
boolean useRecvCompression = ((recvEncoding != null) && (recvEncoding.indexOf("zip") != -1));
BufferedInputStream is = null;
if (useRecvCompression) {
java.util.zip.GZIPInputStream unzip = new java.util.zip.GZIPInputStream(request.getInputStream());
is = new BufferedInputStream(unzip);
in = NavajoLaszloConverter.createNavajoFromLaszlo(is);
} else {
is = new BufferedInputStream(request.getInputStream());
in = NavajoLaszloConverter.createNavajoFromLaszlo(is);
}
return in;
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class BirtHandler method doService.
@Override
public final Navajo doService(Access a) {
Navajo inDoc = getInDoc(a);
inDoc.removeInternalMessages();
Binary birtBinary = getBirtBinary(inDoc);
Navajo navajoBirt = makeNavajoBirt(birtBinary);
return navajoBirt;
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class Switch method testWithPropertyAndSingleValueParameter.
@Test
public void testWithPropertyAndSingleValueParameter() throws Exception {
FunctionInterface fi = fff.getInstance(cl, "Switch");
fi.reset();
Navajo n = createTestNavajo();
fi.setInMessage(n);
fi.insertOperand(Expression.evaluate("[/Single/Vuur]", n));
fi.insertIntegerOperand(0);
try {
Object result = fi.evaluate();
} catch (TMLExpressionException tmle) {
assertTrue(tmle.getMessage().indexOf("Not enough") != -1);
}
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class Switch method createTestNavajo.
@Override
protected Navajo createTestNavajo() throws Exception {
Navajo doc = NavajoFactory.getInstance().createNavajo();
Message array = NavajoFactory.getInstance().createMessage(doc, "Aap");
array.setType(Message.MSG_TYPE_ARRAY);
Message array1 = NavajoFactory.getInstance().createMessage(doc, "Aap");
array.addElement(array1);
doc.addMessage(array);
Property p = NavajoFactory.getInstance().createProperty(doc, "Noot", Property.INTEGER_PROPERTY, "10", 10, "", "in");
p.setValue(10);
array1.addProperty(p);
Message single = NavajoFactory.getInstance().createMessage(doc, "Single");
doc.addMessage(single);
Property p2 = NavajoFactory.getInstance().createProperty(doc, "Selectie", "1", "", "in");
p2.addSelection(NavajoFactory.getInstance().createSelection(doc, "key", "value", true));
single.addProperty(p2);
Property p3 = NavajoFactory.getInstance().createProperty(doc, "Vuur", Property.INTEGER_PROPERTY, "10", 10, "", "out");
p3.setValue(10);
single.addProperty(p3);
return doc;
}
Aggregations