當前位置: 首頁>>代碼示例>>Java>>正文


Java WebServiceContext類代碼示例

本文整理匯總了Java中javax.xml.ws.WebServiceContext的典型用法代碼示例。如果您正苦於以下問題:Java WebServiceContext類的具體用法?Java WebServiceContext怎麽用?Java WebServiceContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WebServiceContext類屬於javax.xml.ws包,在下文中一共展示了WebServiceContext類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createWebServiceContextMock

import javax.xml.ws.WebServiceContext; //導入依賴的package包/類
private WebServiceContext createWebServiceContextMock(String expectedIP,
        String expectedUser) {
    requestMock = mock(HttpServletRequest.class);
    when(requestMock.getRemoteAddr()).thenReturn(expectedIP);

    Principal principalMock = mock(Principal.class);
    when(principalMock.getName()).thenReturn(expectedUser);

    MessageContext msgContextMock = mock(MessageContext.class);
    when(msgContextMock.get(anyString())).thenReturn(requestMock);

    WebServiceContext wsContextMock = mock(WebServiceContext.class);
    when(wsContextMock.getUserPrincipal()).thenReturn(principalMock);
    when(wsContextMock.getMessageContext()).thenReturn(msgContextMock);

    return wsContextMock;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:18,代碼來源:CategorizationServiceWSTest.java

示例2: identify

import javax.xml.ws.WebServiceContext; //導入依賴的package包/類
public UddiEntityPublisher identify(String authInfo, String authorizedName, WebServiceContext ctx) throws AuthenticationException {
        EntityManager em = PersistenceManager.getEntityManager();
        EntityTransaction tx = em.getTransaction();
        try {
                tx.begin();
                Publisher publisher = em.find(Publisher.class, authorizedName);
                if (publisher == null) {
                        throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
                }

                return publisher;
        } finally {
                if (tx.isActive()) {
                        tx.rollback();
                }
                em.close();
        }
}
 
開發者ID:apache,項目名稱:juddi,代碼行數:19,代碼來源:JUDDIAuthenticator.java

示例3: identify

import javax.xml.ws.WebServiceContext; //導入依賴的package包/類
@Override
public UddiEntityPublisher identify(String authInfo, String authorizedName, WebServiceContext ctx) throws AuthenticationException {

        EntityManager em = PersistenceManager.getEntityManager();
        EntityTransaction tx = em.getTransaction();
        try {
                tx.begin();
                Publisher publisher = em.find(Publisher.class, authorizedName);
                if (publisher == null) {
                        throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
                }

                return publisher;
        } finally {
                if (tx.isActive()) {
                        tx.rollback();
                }
                em.close();
        }

}
 
開發者ID:apache,項目名稱:juddi,代碼行數:22,代碼來源:XMLDocAuthenticator.java

示例4: identify

import javax.xml.ws.WebServiceContext; //導入依賴的package包/類
public UddiEntityPublisher identify(String authInfo, String authorizedName, WebServiceContext ctx) throws AuthenticationException, FatalErrorException {
    EntityManager em = PersistenceManager.getEntityManager();
    EntityTransaction tx = em.getTransaction();
    try {
        tx.begin();
        Publisher publisher = em.find(Publisher.class, authorizedName);
        if (publisher == null)
            throw new UnknownUserException(new ErrorMessage("errors.auth.NoPublisher", authorizedName));
        return publisher;
    } finally {
        if (tx.isActive()) {
            tx.rollback();
        }
        em.close();
    }
}
 
開發者ID:apache,項目名稱:juddi,代碼行數:17,代碼來源:LdapSimpleAuthenticator.java

示例5: isWebServiceContextResource

import javax.xml.ws.WebServiceContext; //導入依賴的package包/類
private boolean isWebServiceContextResource(Resource atResource, Field field) {
    Class type = atResource.type();
    if (type == java.lang.Object.class) {
        if (field != null && field.getType() == WebServiceContext.class) {
            return true;
        }
    } else if (type == WebServiceContext.class) {
        //TODO: Should I check if the field declared type is assignable from WebServiceContext. Spec is not clear about this.
        return true;
    }
    if (log.isDebugEnabled()) {
        log.debug(
                "Invalid Field type or Resource Type found, cannot inject WebServiceContext on this field");
    }
    return false;
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:17,代碼來源:WebServiceContextInjectorImpl.java

示例6: testInjectionOnField

import javax.xml.ws.WebServiceContext; //導入依賴的package包/類
public void testInjectionOnField(){
    Object serviceInstance = new ResourceInjectionTestImpl1();
    TestLogger.logger.debug("------------------------------");
    TestLogger.logger.debug("Test : " + getName());
    try{
        ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
        injector.inject(resource, serviceInstance);
        ResourceInjectionTestImpl1 serviceImpl =(ResourceInjectionTestImpl1)serviceInstance;
        assertNotNull(serviceImpl.ctx);
        TestLogger.logger.debug("Resource Injected on Field");
        TestLogger.logger.debug("------------------------------");
    }catch(Exception e){
        e.printStackTrace();
        fail();
    }
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:17,代碼來源:ResourceInjectionTests.java

示例7: testInjectionOnMethod

import javax.xml.ws.WebServiceContext; //導入依賴的package包/類
public void testInjectionOnMethod(){
    Object serviceInstance = new ResourceInjectionTestImpl2();
    TestLogger.logger.debug("------------------------------");
    TestLogger.logger.debug("Test : " + getName());
    try{
        ResourceInjector injector = ResourceInjectionFactory.createResourceInjector(WebServiceContext.class);
        injector.inject(resource, serviceInstance);
        ResourceInjectionTestImpl2 serviceImpl =(ResourceInjectionTestImpl2)serviceInstance;
        assertNotNull(serviceImpl.ctx);
        TestLogger.logger.debug("Resource Injected on Method");
        TestLogger.logger.debug("------------------------------");
    }catch(Exception e){
        e.printStackTrace();
        fail();
    }
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:17,代碼來源:ResourceInjectionTests.java


注:本文中的javax.xml.ws.WebServiceContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。