IDEMPIERE-2928 Save Web Services User Agent in Session Description / IDEMPIERE-2929 Web Services Response BinaryData
This commit is contained in:
parent
447a497718
commit
a0c86233fc
|
@ -279,6 +279,9 @@ public class CompiereService {
|
||||||
session = MSession.get (getCtx(), true);
|
session = MSession.get (getCtx(), true);
|
||||||
}
|
}
|
||||||
session.setWebSession("WebService");
|
session.setWebSession("WebService");
|
||||||
|
|
||||||
|
session.setDescription(session.getDescription() + "\nUser Agent: " + getCtx().getProperty("#UserAgent"));
|
||||||
|
|
||||||
session.saveEx();
|
session.saveEx();
|
||||||
|
|
||||||
m_loggedin = true;
|
m_loggedin = true;
|
||||||
|
|
|
@ -41,6 +41,7 @@ import javax.jws.WebService;
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
import javax.xml.ws.WebServiceContext;
|
import javax.xml.ws.WebServiceContext;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.cxf.jaxrs.ext.MessageContext;
|
import org.apache.cxf.jaxrs.ext.MessageContext;
|
||||||
import org.apache.xmlbeans.StringEnumAbstractBase.Table;
|
import org.apache.xmlbeans.StringEnumAbstractBase.Table;
|
||||||
import org.compiere.model.I_AD_Column;
|
import org.compiere.model.I_AD_Column;
|
||||||
|
@ -1392,9 +1393,12 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
if (m_webservicetype.isOutputColumnNameAllowed(columnName)) {
|
if (m_webservicetype.isOutputColumnNameAllowed(columnName)) {
|
||||||
DataField dfid = dr.addNewField();
|
DataField dfid = dr.addNewField();
|
||||||
dfid.setColumn(columnName);
|
dfid.setColumn(columnName);
|
||||||
if (po.get_Value(i) != null)
|
if (po.get_Value(i) != null){
|
||||||
|
if(po.get_Value(i) instanceof byte[]){
|
||||||
|
dfid.setVal(new String(Base64.encodeBase64((byte[]) po.get_Value(i))));
|
||||||
|
}else
|
||||||
dfid.setVal(po.get_Value(i).toString());
|
dfid.setVal(po.get_Value(i).toString());
|
||||||
else
|
}else
|
||||||
dfid.setVal(null);
|
dfid.setVal(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1541,6 +1545,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
if (m_webservicetype.isOutputColumnNameAllowed(columnName)) {
|
if (m_webservicetype.isOutputColumnNameAllowed(columnName)) {
|
||||||
DataField dfid = dr.addNewField();
|
DataField dfid = dr.addNewField();
|
||||||
dfid.setColumn(columnName);
|
dfid.setColumn(columnName);
|
||||||
|
if(rsquery.getObject(columnName) instanceof byte[])
|
||||||
|
dfid.setVal(new String(Base64.encodeBase64(rsquery.getBytes(columnName))));
|
||||||
|
else
|
||||||
dfid.setVal(rsquery.getString(columnName));
|
dfid.setVal(rsquery.getString(columnName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,8 @@ public class AbstractService {
|
||||||
Env.setContext(m_cs.getCtx(), "#AD_User_ID", user.getAD_User_ID() );
|
Env.setContext(m_cs.getCtx(), "#AD_User_ID", user.getAD_User_ID() );
|
||||||
Env.setContext(m_cs.getCtx(), "#AD_User_Name", user.getName() );
|
Env.setContext(m_cs.getCtx(), "#AD_User_Name", user.getName() );
|
||||||
Env.setContext(m_cs.getCtx(), "#SalesRep_ID", user.getAD_User_ID() );
|
Env.setContext(m_cs.getCtx(), "#SalesRep_ID", user.getAD_User_ID() );
|
||||||
|
String userAgent = getHttpServletRequest().getHeader("User-Agent");
|
||||||
|
Env.setContext(m_cs.getCtx(), "#UserAgent", userAgent == null ? "Unknown" : userAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), selectedClient);
|
KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), selectedClient);
|
||||||
|
@ -331,7 +333,11 @@ public class AbstractService {
|
||||||
OutputField outField= outputFields.addNewOutputField();
|
OutputField outField= outputFields.addNewOutputField();
|
||||||
outField.setColumn(colName);
|
outField.setColumn(colName);
|
||||||
if(po.get_Value(indCol)!=null){
|
if(po.get_Value(indCol)!=null){
|
||||||
|
if(po.get_Value(indCol) instanceof byte[])
|
||||||
|
outField.setValue(new String(Base64.encodeBase64((byte[]) po.get_Value(indCol))));
|
||||||
|
else
|
||||||
outField.setValue(po.get_Value(indCol).toString());
|
outField.setValue(po.get_Value(indCol).toString());
|
||||||
|
|
||||||
Lookup lookup = poInfo.getColumnLookup(indCol);
|
Lookup lookup = poInfo.getColumnLookup(indCol);
|
||||||
if(lookup != null){
|
if(lookup != null){
|
||||||
//Setting text
|
//Setting text
|
||||||
|
|
Loading…
Reference in New Issue