Java Code Examples for org.apache.cxf.common.util.PropertyUtils#getInteger()
The following examples show how to use
org.apache.cxf.common.util.PropertyUtils#getInteger() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SseEventSinkContextProvider.java From cxf with Apache License 2.0 | 6 votes |
@Override public SseEventSink createContext(Message message) { final HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST); if (request == null) { throw new IllegalStateException("Unable to retrieve HTTP request from the context"); } final MessageBodyWriter<OutboundSseEvent> writer = new OutboundSseEventBodyWriter( ServerProviderFactory.getInstance(message), message.getExchange()); final AsyncResponse async = new AsyncResponseImpl(message); final Integer bufferSize = PropertyUtils.getInteger(message, SseEventSinkImpl.BUFFER_SIZE_PROPERTY); final SseEventSink sink = createSseEventSink(request, writer, async, bufferSize); message.put(SseEventSink.class, sink); return sink; }
Example 2
Source File: RESTSecurityTokenServiceImpl.java From cxf with Apache License 2.0 | 5 votes |
private static int getDeflateLevel() { Integer level = null; Message m = PhaseInterceptorChain.getCurrentMessage(); if (m != null) { level = PropertyUtils.getInteger(m, "deflate.level"); } if (level == null) { level = Deflater.DEFLATED; } return level; }
Example 3
Source File: DeflateEncoderDecoder.java From cxf with Apache License 2.0 | 5 votes |
private static int getDeflateLevel() { Integer level = null; Message m = PhaseInterceptorChain.getCurrentMessage(); if (m != null) { level = PropertyUtils.getInteger(m, "deflate.level"); } if (level == null) { level = Deflater.DEFLATED; } return level; }
Example 4
Source File: StaxUtils.java From cxf with Apache License 2.0 | 5 votes |
public static XMLStreamReader configureReader(XMLStreamReader xreader, Message message) throws XMLStreamException { Integer messageMaxChildElements = PropertyUtils.getInteger(message, MAX_CHILD_ELEMENTS); Integer messageMaxElementDepth = PropertyUtils.getInteger(message, MAX_ELEMENT_DEPTH); Integer messageMaxAttributeCount = PropertyUtils.getInteger(message, MAX_ATTRIBUTE_COUNT); Integer messageMaxAttributeSize = PropertyUtils.getInteger(message, MAX_ATTRIBUTE_SIZE); Integer messageMaxTextLength = PropertyUtils.getInteger(message, MAX_TEXT_LENGTH); Long messageMaxElementCount = PropertyUtils.getLong(message, MAX_ELEMENT_COUNT); Long messageMaxXMLCharacters = PropertyUtils.getLong(message, MAX_XML_CHARACTERS); return configureReader(xreader, messageMaxChildElements, messageMaxElementDepth, messageMaxAttributeCount, messageMaxAttributeSize, messageMaxTextLength, messageMaxElementCount, messageMaxXMLCharacters); }
Example 5
Source File: HTTPConduit.java From cxf with Apache License 2.0 | 4 votes |
private static void detectRedirectLoop(String conduitName, String lastURL, String newURL, Message message) throws IOException { Map<String, Integer> visitedURLs = CastUtils.cast((Map<?, ?>)message.get(KEY_VISITED_URLS)); if (visitedURLs == null) { visitedURLs = new HashMap<>(); message.put(KEY_VISITED_URLS, visitedURLs); } Integer visitCount = visitedURLs.get(lastURL); if (visitCount == null) { visitCount = 1; } else { visitCount++; } visitedURLs.put(lastURL, visitCount); Integer newURLCount = visitedURLs.get(newURL); if (newURL != null && newURLCount != null) { // See if we are being redirected in a loop as best we can, // using string equality on URL. boolean invalidLoopDetected = newURL.equals(lastURL); Integer maxSameURICount = PropertyUtils.getInteger(message, AUTO_REDIRECT_MAX_SAME_URI_COUNT); if (!invalidLoopDetected) { // This new URI was already recorded earlier even though it is not equal to the last URI // Example: a-b-a, where 'a' is the new URI. Check if a limited number of occurrences of this URI // is allowed, fail by default. if (maxSameURICount == null || newURLCount > maxSameURICount) { invalidLoopDetected = true; } } else if (maxSameURICount != null && newURLCount <= maxSameURICount) { // This new URI was already recorded earlier and is the same as the last URI. // Example: a-a. But we have a property supporting a limited number of occurrences of this URI. // Continue the invocation. invalidLoopDetected = false; } if (invalidLoopDetected) { // We are in a redirect loop; -- bail String msg = "Redirect loop detected on Conduit '" + conduitName + "' on '" + newURL + "'"; LOG.log(Level.INFO, msg); throw new IOException(msg); } } }