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


Java Fault類代碼示例

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


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

示例1: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
/**
 * Handles the {@link Connection} in the given {@link Message}.
 * @see DBConnectionResponseInterceptor
 */
@Override
public void handleMessage(final Message message) throws Fault {
	final Connection con = (Connection) message.getExchange().getInMessage().getContextualProperty(
			DBConnectionContextProvider.PROPERTY_CONNECTION);

	if(con != null) {
		try {
			final int responseCode = (int) message.get(Message.RESPONSE_CODE);

			if(Family.familyOf(responseCode).equals(Family.SERVER_ERROR)) {
				con.rollback();
			}
			else {
				con.commit();
			}

			con.close();
		}
		catch(final SQLException e) {
			LOGGER.error("Can't commit/rollback/close db connection because of an SQLException.", e);
		}
	}
}
 
開發者ID:XMBomb,項目名稱:InComb,代碼行數:28,代碼來源:DBConnectionResponseInterceptor.java

示例2: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@SuppressWarnings("nls")
@Override
public void handleMessage(SoapMessage message) throws Fault
{
	final UserState us = CurrentUser.getUserState();
	XMLStreamWriterCallback obj = new XMLStreamWriterCallback()
	{
		@Override
		public void write(XMLStreamWriter writer) throws Fault, XMLStreamException
		{
			writer.writeEmptyElement("equella");
			writer.writeAttribute("session", us.getSessionID());
			writer.writeAttribute("id", us.getUserBean().getUniqueID());
			writer.writeAttribute("username", us.getUserBean().getUsername());

		}
	};

	message.getHeaders().add(new Header(new QName("equella"), obj, new StaxDataBinding()));
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:21,代碼來源:TokenHeaderOutInterceptor.java

示例3: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@Override
public void handleMessage(SoapMessage message) throws Fault
{
	Header header = message.getHeader(new QName("equella"));
	if( header != null )
	{
		Element e = (Element) header.getObject();
		PropBagEx equella = new PropBagEx(e);
		String token = equella.getNode("token");
		if( !Check.isEmpty(token) )
		{
			HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
			try
			{
				userService.loginWithToken(token, userService.getWebAuthenticationDetails(request), true);
			}
			catch( RuntimeException ex )
			{
				LOGGER.error("Error initialising session with SOAP header token '" + token + "' for URL "
					+ request.getRequestURL().toString());
				throw ex;
			}
		}
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:26,代碼來源:TokenHeaderInInterceptor.java

示例4: invoke

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@Override
public DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("Vrij bericht ontvanger");
    LOGGER.debug("Vrij bericht ontvanger aangeroepen");
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    try {
        schemaValidatorService.valideer(request, VrijBerichtWebService.SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("Vrij bericht ontvanger aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    return AlgemeneFoutHandler.doeBijFout(e -> {
        LOGGER.error("Algemene fout", e);
        throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het vrij bericht verzoek.");
    }).voerUit(() -> maakResponse(request));
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:17,代碼來源:VrijBerichtWebService.java

示例5: invoke

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@Override
public DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("Bevraging voor Levering");
    LOGGER.debug("Bevraging voor levering aangeroepen");
    try {
        schemaValidatorService.valideer(request, SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("Bevraging aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    return AlgemeneFoutHandler.doeBijFout(e -> {
        LOGGER.error("Algemene fout", e);
        throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het verzoek.");
    }).voerUit(() -> maakResponse(request));
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:17,代碼來源:BevragingWebService.java

示例6: invoke

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@Override
public DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("Stuf bericht vertaler ontvanger");
    LOGGER.debug("Stuf bericht vertaler ontvanger aangeroepen");
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    try {
        schemaValidatorService.valideer(request, SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("Stuf bericht vertaler ontvanger aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    return AlgemeneFoutHandler.doeBijFout(e -> {
        LOGGER.error("Algemene fout", e);
        throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het stuf vertaal verzoek.");
    }).voerUit(() -> maakResponse(request));
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:17,代碼來源:StufWebService.java

示例7: invoke

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
/**
 * Voert het verzoek uit.
 * @param request de ingaande request
 * @return het response
 */
@Bedrijfsregel(Regel.R1978)
@Bedrijfsregel(Regel.R1979)
@Bedrijfsregel(Regel.R1984)
@Override
public final DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("OnderhoudAfnemerindicatie");
    LOGGER.debug("AfnemerindicatiesService aangeroepen");
    try {
        schemaValidatorService.valideer(request, OnderhoudAfnemerindicatiesWebServiceImpl.SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("AfnemerindicatiesService aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    return AlgemeneFoutHandler.doeBijFout(
            e1 -> {
                LOGGER.error("Algemene fout", e1);
                throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het verzoek.");
            }
    ).voerUit(() -> getDomSource(request));
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:27,代碼來源:OnderhoudAfnemerindicatiesWebServiceImpl.java

示例8: invoke

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
/**
 * Handelt het verzoek af.
 * @param request het verzoek
 * @return het response.
 */
@Bedrijfsregel(Regel.R1978)
@Bedrijfsregel(Regel.R1979)
@Override
public final DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("Synchronisatie Service");
    LOGGER.debug("SynchronisatieService aangeroepen");
    try {
        schemaValidatorService.valideer(request, SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("SynchronisatieService aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    return AlgemeneFoutHandler
            .doeBijFout(e1 -> {
                LOGGER.error("Algemene fout", e1);
                throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het verzoek.");
            }).voerUit(() -> maakResponse(request));
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:25,代碼來源:SynchronisatieWebServiceImpl.java

示例9: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@Override
public void handleMessage(Message message) throws Fault
{
    final OutputStream os = message.getContent(OutputStream.class);
    if (os == null)
    {
        return;
    }
    Logger logger = getMessageLogger(message);

    if (logger.isLoggable(Level.INFO) || writer != null)
    {
        // Write the output while caching it for the log message
        boolean hasLogged = message.containsKey(LOG_SETUP);
        if (!hasLogged)
        {
            message.put(LOG_SETUP, Boolean.TRUE);
            final CacheAndWriteOutputStream newOut = new CacheAndWriteOutputStream(
                    os);
            message.setContent(OutputStream.class, newOut);
            newOut.registerCallback(new LoggingCallback(logger, message, os));
        }
    }
}
 
開發者ID:Huawei,項目名稱:eSDK_EC_SDK_Java,代碼行數:25,代碼來源:UCLoggingOutInterceptor.java

示例10: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
public void handleMessage(Message message)
    throws Fault
{
    // 通知流量監控模塊
    IMonitor monitor = ApplicationContextUtil.getBean("southFCMonitor");
    if (monitor != null)
    {
        monitor.reportStatus(1); // 增加一次SOAP調用
        IPerformer performer = ApplicationContextUtil.getBean("southFCPerformer");
        if (performer != null)
        {
            if (performer.doFilter(null))
            {
                monitor.reportStatus(-1); // 被流控消息不計入監控數據
                SOAPException soapExc = new SOAPException("");
                Fault fault = new Fault(soapExc);
                fault.setFaultCode(new QName(Integer.toString(ESDKErrorCodeConstant.ERROR_CODE_SDK_SYSBUSY)));
                throw fault;
            }
        }
    }
}
 
開發者ID:Huawei,項目名稱:eSDK_EC_SDK_Java,代碼行數:23,代碼來源:UCOBGOutInterceptor.java

示例11: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@Override
public void handleMessage(Message message) throws Fault {
	// allows WADL requests for unauthenticated users
	String messageQueryString = String.valueOf(message.get(Message.QUERY_STRING));
	boolean isServiceRequest = "_wadl".equalsIgnoreCase(messageQueryString);
	if (isServiceRequest) {
		return;
	}

	LoggedInInfo info = getLoggedInInfo(message);
	boolean isAuthenticated = info != null && (info.getLoggedInProvider() != null || info.getLoggedInSecurity() != null);
	if (isAuthenticated) {
		return;
	}

	logAccessError(message);

	ResponseBuilder builder = Response.status(Status.UNAUTHORIZED);
	builder.type(MediaType.TEXT_XML);
	builder.entity("<error>Not authorized</error>");
	message.getExchange().put(Response.class, builder.build());
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:23,代碼來源:AuthenticationInInterceptor.java

示例12: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
public void handleMessage(Message message)
    throws Fault
{
   
    OperationInfo operation = message.get(MessageInfo.class).getOperation();
    
    String inputName = operation.getInputName();
    
    if("login".equals(inputName) || "getPublicKey".equals(inputName))
    {
        Map headers = (Map)message.get(Message.PROTOCOL_HEADERS);
        List msgSession = (List)headers.get("Set-Cookie");
        if(msgSession != null && !msgSession.isEmpty())
        {
            MsgSessionHolder.getInstance().setSession(msgSession);
        }
    }
}
 
開發者ID:Huawei,項目名稱:eSDK_IVS_Java,代碼行數:20,代碼來源:MsgInInterceptor.java

示例13: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@SuppressWarnings({"unchecked", "rawtypes"})
public void handleMessage(Message message)
    throws Fault
{
    
    OperationInfo operation = message.get(MessageInfo.class).getOperation();
    
    String inputName = operation.getInputName();
    
    if (!"getPublicKey".equals(inputName))
    {
        List session = MsgSessionHolder.getInstance().getSession();
        if (session != null && !session.isEmpty())
        {
            Map headers = (Map)message.get(Message.PROTOCOL_HEADERS);
            headers.put("Cookie", session);
        }
    }
}
 
開發者ID:Huawei,項目名稱:eSDK_IVS_Java,代碼行數:20,代碼來源:MsgOutInterceptor.java

示例14: handleMessage

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void handleMessage(Message message)
    throws Fault
{
    // 對返回參數中的sessionId截取,通過拆分字符串的方式解析出IVS中的sessionId
    Map<String, List> headers = (Map<String, List>)message.get(Message.PROTOCOL_HEADERS);
    if (message.toString().contains("loginResponse") || message.toString().contains("setSecretKeyResponse"))
    {
        List<String> msgSession = headers.get("Set-Cookie");
        if (null != msgSession && !msgSession.isEmpty())
        {
            // 發消息到SDK的情況,如果不是loginRequest接口,不賦值
            MsgSessionHolder.getInstance().setSession(msgSession);
        }
    }
    
}
 
開發者ID:Huawei,項目名稱:eSDK_IVS_Java,代碼行數:18,代碼來源:MsgInInterceptor.java

示例15: processReport

import org.apache.cxf.interceptor.Fault; //導入依賴的package包/類
@Override
public ObjectListType processReport(String query, RemoteReportParametersType parameters,
		SelectorQualifiedGetOptionsType options) {

	try {
		
		Map<QName, Object> parametersMap = getParamsMap(parameters);
		ObjectQuery q = reportService.parseQuery(query, parametersMap);
		Collection<PrismObject<? extends ObjectType>> resultList = reportService.searchObjects(q,
				MiscSchemaUtil.optionsTypeToOptions(options));

		return createObjectListType(resultList);
	} catch (SchemaException | ObjectNotFoundException | SecurityViolationException
			| CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
		// TODO Auto-generated catch block
		throw new Fault(e);
	}

}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:20,代碼來源:ReportWebService.java


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