Java 类javax.xml.rpc.handler.MessageContext 实例源码

项目:jplag    文件:LoggingHandler.java   
public boolean handleRequest(MessageContext context) {
//      System.out.println("Entering LoggingHandler::handleRequest()");
/*      try
        {
            SOAPMessageContext smsgct=(SOAPMessageContext) context;
            SOAPMessage msg=smsgct.getMessage();
            SOAPEnvelope envelope=msg.getSOAPPart().getEnvelope();
            SOAPHeader header=msg.getSOAPHeader();
            if(header==null)
            {
                header=envelope.addHeader();
            }

            SOAPHeaderElement accessElement=header.addHeaderElement(
                    envelope.createName("logged","ns1",
                    "http://example.com/jplag"));
            accessElement.addTextNode("You got logged!!");
        }
        catch(SOAPException e)
        {
            e.printStackTrace();
        }*/
        logMessage("request", context);
//      System.out.println("Leaving LoggingHandler::handleRequest()");
        return true;
    }
项目:jplag    文件:LoggingHandler.java   
private void logMessage(String method, MessageContext context) {
     FileOutputStream fout = createFile();
     if(fout==null) return;
     LogOutputStream out = new LogOutputStream(fout, true);
     try {
         out.println("<" + method + ">");
         //Uncomment this statement to log the SOAP messages.
         out.println(logSOAPMessage(context));
         out.println("</" + method + ">");
     } catch (Exception ex) {
         ex.printStackTrace(System.out);
throw new JAXRPCException("LoggingHandler: Unable to log the message in " + method + " - {" + ex.getClass().getName() + "}"
        + ex.getMessage());
     } finally {
         out.flush();
out.close();
     }
 }
项目:jplag    文件:LoggingHandler.java   
private String logSOAPMessage(MessageContext context) {
        StringBuffer stringBuffer = new StringBuffer();
        SOAPMessageContext smc = (SOAPMessageContext) context;
        SOAPMessage soapMessage = smc.getMessage();
/*      try
        {
            SOAPBody soapBody = soapMessage.getSOAPBody();
            NodeList list=soapBody.getElementsByTagName("inputZipFile");
        }
        catch(Exception e)
        {
            // ignore filtering
        }*/

        ByteArrayOutputStream bout= new ByteArrayOutputStream();
        try {
            soapMessage.writeTo(bout);
        } catch(Exception e) {
            e.printStackTrace(System.out);
        }
        stringBuffer.append(bout.toString() + "\n");

        return stringBuffer.toString();
    }
项目:jplag    文件:JPlagClientAccessHandler.java   
/**
 * Adds an "Access" element to the SOAP header
 */
public boolean handleRequest(MessageContext msgct) {
    if (msgct instanceof SOAPMessageContext) {
        SOAPMessageContext smsgct = (SOAPMessageContext) msgct;
        try {
            SOAPMessage msg = smsgct.getMessage();
            SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
            SOAPHeader header = msg.getSOAPHeader();

            if (header == null)
                header = envelope.addHeader(); // add an header if non exists

            SOAPHeaderElement accessElement = header.addHeaderElement(envelope.createName("Access", "ns0", JPLAG_TYPES_NS));
            SOAPElement usernameelem = accessElement.addChildElement("username");
            usernameelem.addTextNode(username);
            SOAPElement passwordelem = accessElement.addChildElement("password");
            passwordelem.addTextNode(password);
            SOAPElement compatelem = accessElement.addChildElement("compatLevel");
            compatelem.addTextNode(compatibilityLevel + "");
        } catch (SOAPException x) {
            System.out.println("Unable to create access SOAP header!");
            x.printStackTrace();
        }
    }
    return true;
}
项目:jplag    文件:JPlagClientAccessHandler.java   
/**
 * Adds an "Access" element to the SOAP header
 */
public boolean handleRequest(MessageContext msgct) {
    if(msgct instanceof SOAPMessageContext) {
        SOAPMessageContext smsgct=(SOAPMessageContext) msgct;
        try {
            SOAPMessage msg=smsgct.getMessage();
            SOAPEnvelope envelope=msg.getSOAPPart().getEnvelope();
            SOAPHeader header=msg.getSOAPHeader();

            if(header==null)
                header=envelope.addHeader(); // add an header if non exists

            SOAPHeaderElement accessElement=header.addHeaderElement(
                    envelope.createName("Access","ns0",
                            "http://www.ipd.uni-karlsruhe.de/jplag/types"));
            SOAPElement usernameelem=accessElement.addChildElement(
                       "username");
            usernameelem.addTextNode(username);
            SOAPElement passwordelem=accessElement.addChildElement(
                       "password");
            passwordelem.addTextNode(password);
               SOAPElement compatelem=accessElement.addChildElement(
                       "compatLevel");
               compatelem.addTextNode(compatibilityLevel+"");
        } catch (SOAPException x) {
            System.out.println("Unable to create access SOAP header!");
            x.printStackTrace();
        }
    }
    return true;
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
public boolean handleRequest(MessageContext mc) {
    mc.setProperty(ALLOW_FORM_OPTIMIZATION,
        Boolean.TRUE);
    try {
        return processMessage(mc, true);
    } catch (WSSecurityException e) {
        if (doDebug) {
            log.debug(e.getMessage(), e);
        }
        throw new JAXRPCException(e);
    }
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
public boolean handleResponse(MessageContext mc) {
    mc.setProperty(ALLOW_FORM_OPTIMIZATION,
        Boolean.TRUE);
    try {
        return processMessage(mc, false);
    } catch (WSSecurityException e) {
        if (doDebug) {
            log.debug(e.getMessage(), e);
        }
        throw new JAXRPCException(e);
    }
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
/**
 * Handles SOAP Faults that may occur during message processing
 */
public boolean handleFault(MessageContext mc) {
    if (doDebug) {
        log.debug("Entered handleFault");
    }
    return true;
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
/**
 * Switch for transferring control to doReceiver and doSender
 */
public boolean processMessage(MessageContext mc, boolean isRequestMessage) throws WSSecurityException {

    RequestData reqData = new RequestData();
    reqData.setMsgContext(mc);

    doDebug = log.isDebugEnabled();
    String deployment = null;
    String handleFlow = null;

    if ((deployment = (String) getOption(DEPLOYMENT)) == null) {
        deployment = (String) mc.getProperty(DEPLOYMENT);
    }
    if (deployment == null) {
        throw new JAXRPCException("WSS4JHandler.processMessage: No deployment defined");
    }
    if ((handleFlow = (String) getOption(FLOW)) == null) {
        handleFlow = (String) mc.getProperty(FLOW);
    }
    if (handleFlow == null) {
        handleFlow = "";
    }

    // call doSender if we are -
    // (handling request and client-side deployment) or (handling response and server-side deployment).
    // call doReceiver if we are -
    // (handling request and server-side deployment) or (handling response and client-side deployment).

    boolean needsHandling = ( isRequestMessage && !handleFlow.equals(RESPONSE_ONLY)) ||
                            (!isRequestMessage && !handleFlow.equals(REQUEST_ONLY));
    try {
        if (deployment.equals(CLIENT_DEPLOYMENT) ^ isRequestMessage) {
            if (needsHandling) {
                return doReceiver(mc, reqData, isRequestMessage);
            }
        } else {
            if (needsHandling) {
                return doSender(mc, reqData, isRequestMessage);
            }
        }
    } finally {
        reqData.clear();
        reqData = null;
    }
    return true;
}
项目:cagrid-general    文件:StockManagerAuthorization.java   
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
    throws AuthorizationException {

    if(!operation.getNamespaceURI().equals(getServiceNamespace())){
      return false;
    }
    if(operation.getLocalPart().equals("getMultipleResourceProperties")){
        authorizeGetMultipleResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getResourceProperty")){
        authorizeGetResourceProperty(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("queryResourceProperties")){
        authorizeQueryResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
        authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getQuote")){
        authorizeGetQuote(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getChart")){
        authorizeGetChart(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("createPortfolio")){
        authorizeCreatePortfolio(peerSubject, context, operation);
        return true;
    }       
    return false;
}
项目:common-biorepository-model    文件:CBMAuthorization.java   
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
    throws AuthorizationException {

    if(!operation.getNamespaceURI().equals(getServiceNamespace())){
      return false;
    }
    if(operation.getLocalPart().equals("getMultipleResourceProperties")){
        authorizeGetMultipleResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getResourceProperty")){
        authorizeGetResourceProperty(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("queryResourceProperties")){
        authorizeQueryResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
        authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("query")){
        authorizeQuery(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("executeQuery")){
        authorizeExecuteQuery(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("transferQuery")){
        authorizeTransferQuery(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("executeTransferQuery")){
        authorizeExecuteTransferQuery(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("extractCBMdata")){
        authorizeExtractCBMdata(peerSubject, context, operation);
        return true;
    }       
    return false;
}
项目:oscm    文件:TestSessionContext.java   
@Override
public MessageContext getMessageContext() throws IllegalStateException {
    throw new UnsupportedOperationException();
}
项目:development    文件:TestSessionContext.java   
@Override
public MessageContext getMessageContext() throws IllegalStateException {
    throw new UnsupportedOperationException();
}
项目:jplag    文件:LoggingHandler.java   
public boolean handleResponse(MessageContext context) {
    logMessage("response", context);
    return true;
}
项目:jplag    文件:LoggingHandler.java   
public boolean handleFault(MessageContext context) {
    logMessage("fault", context);
    return true;
}
项目:windup-rulesets    文件:JaxRpcGenericHandlerTest.java   
public boolean handleRequest(MessageContext context)
{
    return true;
}
项目:windup-rulesets    文件:JaxRpcGenericHandlerTest.java   
public boolean handleResponse(MessageContext context)
{
    return true;
}
项目:windup-rulesets    文件:JaxRpcGenericHandlerTest.java   
public boolean handleRequest(MessageContext context)
{
    return true;
}
项目:windup-rulesets    文件:JaxRpcGenericHandlerTest.java   
public boolean handleResponse(MessageContext context)
{
    return true;
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
public Object getProperty(Object msgContext, String key) {
    return ((MessageContext)msgContext).getProperty(key);
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
public void setProperty(Object msgContext, String key, Object value) {
    ((MessageContext)msgContext).setProperty(key, value);
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
public String getPassword(Object msgContext) {
    return (String) ((MessageContext)msgContext).getProperty(Call.PASSWORD_PROPERTY);
}
项目:wso2-wss4j    文件:WSS4JHandler.java   
public void setPassword(Object msgContext, String password) {
    ((MessageContext)msgContext).setProperty(Call.PASSWORD_PROPERTY, password);
}
项目:cagrid-core    文件:GTSAuthorization.java   
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
    throws AuthorizationException {

    if(!operation.getNamespaceURI().equals(getServiceNamespace())){
      return false;
    }
    if(operation.getLocalPart().equals("addTrustedAuthority")){
        authorizeAddTrustedAuthority(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("findTrustedAuthorities")){
        authorizeFindTrustedAuthorities(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("removeTrustedAuthority")){
        authorizeRemoveTrustedAuthority(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("addPermission")){
        authorizeAddPermission(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("findPermissions")){
        authorizeFindPermissions(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("revokePermission")){
        authorizeRevokePermission(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("updateTrustedAuthority")){
        authorizeUpdateTrustedAuthority(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("addTrustLevel")){
        authorizeAddTrustLevel(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("updateTrustLevel")){
        authorizeUpdateTrustLevel(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getTrustLevels")){
        authorizeGetTrustLevels(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("removeTrustLevel")){
        authorizeRemoveTrustLevel(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("addAuthority")){
        authorizeAddAuthority(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("updateAuthority")){
        authorizeUpdateAuthority(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("updateAuthorityPriorities")){
        authorizeUpdateAuthorityPriorities(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getAuthorities")){
        authorizeGetAuthorities(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("removeAuthority")){
        authorizeRemoveAuthority(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("updateCRL")){
        authorizeUpdateCRL(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("validate")){
        authorizeValidate(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
        authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getMultipleResourceProperties")){
        authorizeGetMultipleResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getResourceProperty")){
        authorizeGetResourceProperty(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("queryResourceProperties")){
        authorizeQueryResourceProperties(peerSubject, context, operation);
        return true;
    }       
    return false;
}
项目:caobr    文件:CaObrAuthorization.java   
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
    throws AuthorizationException {

    if(!operation.getNamespaceURI().equals(getServiceNamespace())){
      return false;
    }
    if(operation.getLocalPart().equals("getMultipleResourceProperties")){
        authorizeGetMultipleResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getResourceProperty")){
        authorizeGetResourceProperty(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("queryResourceProperties")){
        authorizeQueryResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
        authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getAllAnnotations")){
        authorizeGetAllAnnotations(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getAllConcepts")){
        authorizeGetAllConcepts(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getAllOntologies")){
        authorizeGetAllOntologies(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getAllResources")){
        authorizeGetAllResources(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getAnnotations")){
        authorizeGetAnnotations(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getConcepts")){
        authorizeGetConcepts(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("isConcept")){
        authorizeIsConcept(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("isConceptInAnyOntology")){
        authorizeIsConceptInAnyOntology(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("isConcepts")){
        authorizeIsConcepts(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("isConceptsInAnyOntology")){
        authorizeIsConceptsInAnyOntology(peerSubject, context, operation);
        return true;
    }       
    return false;
}
项目:cagrid-core    文件:CredentialDelegationServiceAuthorization.java   
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation)
    throws AuthorizationException {

    if(!operation.getNamespaceURI().equals(getServiceNamespace())){
      return false;
    }
    if(operation.getLocalPart().equals("initiateDelegation")){
        authorizeInitiateDelegation(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("approveDelegation")){
        authorizeApproveDelegation(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("findDelegatedCredentials")){
        authorizeFindDelegatedCredentials(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("updateDelegatedCredentialStatus")){
        authorizeUpdateDelegatedCredentialStatus(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("findCredentialsDelegatedToClient")){
        authorizeFindCredentialsDelegatedToClient(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("searchDelegatedCredentialAuditLog")){
        authorizeSearchDelegatedCredentialAuditLog(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("deleteDelegatedCredential")){
        authorizeDeleteDelegatedCredential(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("addAdmin")){
        authorizeAddAdmin(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("removeAdmin")){
        authorizeRemoveAdmin(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getAdmins")){
        authorizeGetAdmins(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){
        authorizeGetServiceSecurityMetadata(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getMultipleResourceProperties")){
        authorizeGetMultipleResourceProperties(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("getResourceProperty")){
        authorizeGetResourceProperty(peerSubject, context, operation);
        return true;
    } else if(operation.getLocalPart().equals("queryResourceProperties")){
        authorizeQueryResourceProperties(peerSubject, context, operation);
        return true;
    }       
    return false;
}
项目:common-biorepository-model    文件:CBMAuthorization.java   
public void authorizeTransferQuery(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cagrid-core    文件:GridGrouperAuthorization.java   
public void authorizeGetSubjectsWithGroupPrivilege(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cagrid-core    文件:TavernaWorkflowServiceImplAuthorization.java   
public void authorizeStartWorkflow(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cagrid-core    文件:CredentialDelegationServiceAuthorization.java   
public void authorizeRemoveAdmin(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cagrid-core    文件:GTSAuthorization.java   
public void authorizeGetMultipleResourceProperties(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cagrid-core    文件:GridGrouperAuthorization.java   
public void authorizeDisableMembershipRequests(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:caarray    文件:CaGridEnumerationAuthorization.java   
public void authorizeGetServiceSecurityMetadata(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cananolab    文件:CaNanoLabServiceAuthorization.java   
public void authorizeGetKeywordsBySampleId(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

    }
项目:cagrid2    文件:DorianAuthorization.java   
public void authorizeRequestHostCertificate(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cagrid-core    文件:DorianAuthorization.java   
public void authorizeSetPublish(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cagrid-core    文件:FederatedQueryResultsAuthorization.java   
public void authorizeDestroy(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:cananolab    文件:CaNanoLabServiceAuthorization.java   
public void authorizeGetOtherPointOfContactsBySampleId(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

    }
项目:caarray    文件:CaArraySvc_v1_0Authorization.java   
public void authorizeGetAllCharacteristicCategories(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}
项目:labviewer    文件:StudyConsumerAuthorization.java   
public void authorizeGetMultipleResourceProperties(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException {

}