@Override public UriInfo getUriInfo() { return new UriInfoImpl(m); }
@Override public UriInfo getUriInfo() { return new UriInfoImpl(m); }
protected String getIssuerId(Message m) { if (issuerId == null) { return new UriInfoImpl(m).getBaseUri().toString(); } return issuerId; }
private String getAbsoluteTargetAddress(Message m) { if (accessTokenServiceAddress == null) { return new UriInfoImpl(m).getAbsolutePath().toString(); } if (!accessTokenServiceAddress.startsWith("http")) { String httpBasePath = (String)m.get("http.base.path"); return UriBuilder.fromUri(httpBasePath) .path(accessTokenServiceAddress) .build() .toString(); } return accessTokenServiceAddress; }
private String getWebAppContext(Message m) { if (addWebAppContext) { if (addEndpointAddressToContext) { return new UriInfoImpl(m).getBaseUri().getRawPath(); } String httpBasePath = (String)m.get("http.base.path"); return URI.create(httpBasePath).getRawPath(); } return "/"; }
private String getAbsoluteTargetAddress(Message m) { if (accessTokenServiceAddress == null) { return new UriInfoImpl(m).getAbsolutePath().toString(); } if (!accessTokenServiceAddress.startsWith("http")) { String httpBasePath = (String)m.get("http.base.path"); return UriBuilder.fromUri(httpBasePath) .path(accessTokenServiceAddress) .build() .toString(); } return accessTokenServiceAddress; }
@Override public void setRequestUri(URI requestUri) throws IllegalStateException { if (requestUri.isAbsolute()) { String baseUriString = new UriInfoImpl(m).getBaseUri().toString(); String requestUriString = requestUri.toString(); if (!requestUriString.startsWith(baseUriString)) { setRequestUri(requestUri, URI.create("/")); return; } requestUriString = requestUriString.substring(baseUriString.length()); if (requestUriString.isEmpty()) { requestUriString = "/"; } requestUri = URI.create(requestUriString); } doSetRequestUri(requestUri); }
@Override public void setRequestUri(URI requestUri) throws IllegalStateException { if (requestUri.isAbsolute()) { String baseUriString = new UriInfoImpl(m).getBaseUri().toString(); String requestUriString = new UriInfoImpl(m).getBaseUri().toString(); if (!requestUriString.startsWith(baseUriString)) { setRequestUri(requestUri, URI.create("/")); return; } else { requestUriString = requestUriString.substring(baseUriString.length()); if (requestUriString.isEmpty()) { requestUriString = "/"; } requestUri = URI.create(requestUriString); } } doSetRequestUri(requestUri); }
private static Object readQueryString(String queryName, Class<?> paramType, Type genericType, Annotation[] paramAnns, Message m, String defaultValue, boolean decode) { MultivaluedMap<String, String> queryMap = new UriInfoImpl(m, null).getQueryParameters(decode); if ("".equals(queryName)) { return InjectionUtils.handleBean(paramType, paramAnns, queryMap, ParameterType.QUERY, m, false); } return InjectionUtils.createParameterObject(queryMap.get(queryName), paramType, genericType, paramAnns, defaultValue, false, ParameterType.QUERY, m); }
private String getAbsoluteAssertionServiceAddress(Message m) { if (assertionConsumerServiceAddress == null) { if (Boolean.TRUE.equals(JAXRSUtils.getCurrentMessage().get(SSOConstants.RACS_IS_COLLOCATED))) { assertionConsumerServiceAddress = new UriInfoImpl(m).getAbsolutePath().toString(); } else { reportError("MISSING_ASSERTION_SERVICE_URL"); throw ExceptionUtils.toInternalServerErrorException(null, null); } } if (!assertionConsumerServiceAddress.startsWith("http")) { String httpBasePath = (String)m.get("http.base.path"); return UriBuilder.fromUri(httpBasePath) .path(assertionConsumerServiceAddress) .build() .toString(); } return assertionConsumerServiceAddress; }
private static Object readQueryString(String queryName, Class<?> paramType, Type genericType, Annotation[] paramAnns, Message m, String defaultValue, boolean decode) { MultivaluedMap<String, String> queryMap = new UriInfoImpl(m, null).getQueryParameters(decode); if ("".equals(queryName)) { return InjectionUtils.handleBean(paramType, paramAnns, queryMap, ParameterType.QUERY, m, false); } else { return InjectionUtils.createParameterObject(queryMap.get(queryName), paramType, genericType, paramAnns, defaultValue, false, ParameterType.QUERY, m); } }
public ResponseBuilder location(URI loc) { if (!loc.isAbsolute()) { Message currentMessage = PhaseInterceptorChain.getCurrentMessage(); if (currentMessage != null) { UriInfo ui = new UriInfoImpl(currentMessage.getExchange().getInMessage(), null); loc = ui.getBaseUriBuilder() .path(loc.getRawPath()) .replaceQuery(loc.getRawQuery()) .fragment(loc.getRawFragment()).buildFromEncoded(); } } return setHeader(HttpHeaders.LOCATION, loc); }
public ResponseBuilder location(URI loc) { if (!loc.isAbsolute()) { Message currentMessage = PhaseInterceptorChain.getCurrentMessage(); if (currentMessage != null) { UriInfo ui = new UriInfoImpl(currentMessage.getExchange().getInMessage(), null); loc = ui.getBaseUriBuilder() .path(loc.getRawPath()) .replaceQuery(loc.getRawQuery()) .fragment(loc.getRawFragment()).buildFromEncoded(); } } return setHeader(HttpHeaders.LOCATION, loc); }
public String preprocess(Message m, UriInfo u) { handleExtensionMappings(m, u); handleLanguageMappings(m, u); MultivaluedMap<String, String> queries = u.getQueryParameters(); handleTypeQuery(m, queries); handleCType(m, queries); handleMethod(m, queries, new HttpHeadersImpl(m)); return new UriInfoImpl(m, null).getPath(); }
@SuppressWarnings("unchecked") private static UriInfo createUriInfo(Message m) { if (MessageUtils.isRequestor(m)) { m = m.getExchange() != null ? m.getExchange().getOutMessage() : m; } MultivaluedMap<String, String> templateParams = (MultivaluedMap<String, String>)m.get(URITemplate.TEMPLATE_PARAMETERS); return new UriInfoImpl(m, templateParams); }
@SuppressWarnings("unchecked") private static UriInfo createUriInfo(Message m) { if (MessageUtils.isRequestor(m)) { m = m.getExchange() != null ? m.getExchange().getOutMessage() : m; } MultivaluedMap<String, String> templateParams = (MultivaluedMap<String, String>)m.get(URITemplate.TEMPLATE_PARAMETERS); return new UriInfoImpl(m, templateParams); }
private org.apache.camel.Exchange prepareExchange(Exchange cxfExchange, Method method, Object[] paramArray, Object response) { ExchangePattern ep = ExchangePattern.InOut; if (method.getReturnType() == Void.class) { ep = ExchangePattern.InOnly; } final org.apache.camel.Exchange camelExchange = endpoint.createExchange(ep); //needs access in MessageObserver/Interceptor to close the UnitOfWork cxfExchange.put(org.apache.camel.Exchange.class, camelExchange); if (response != null) { camelExchange.getOut().setBody(response); } CxfRsBinding binding = endpoint.getBinding(); binding.populateExchangeFromCxfRsRequest(cxfExchange, camelExchange, method, paramArray); // REVISIT: It can be done inside a binding but a propagateContext would need to be passed along as // the CXF in message property. Question: where should this property name be set up ? if (endpoint.isPropagateContexts()) { camelExchange.setProperty(UriInfo.class.getName(), new UriInfoImpl(cxfExchange.getInMessage())); camelExchange.setProperty(Request.class.getName(), new RequestImpl(cxfExchange.getInMessage())); camelExchange.setProperty(HttpHeaders.class.getName(), new HttpHeadersImpl(cxfExchange.getInMessage())); camelExchange.setProperty(SecurityContext.class.getName(), new SecurityContextImpl(cxfExchange.getInMessage())); } return camelExchange; }
/** * Return users matching the given criteria. The visible groups, trees and companies are checked. The returned * groups of each user depends on the groups the user can see. The result is not secured : it contains DN. * * @param company * The optional company name to match. * @param group * The optional group name to match. * @return All matched users. */ public List<UserOrg> findAllNotSecure(final String company, final String group) { final Set<GroupOrg> visibleGroups = groupResource.getContainers(); // Search the users final MessageImpl message = new MessageImpl(); message.put(Message.QUERY_STRING, DataTableAttributes.PAGE_LENGTH + "=10000000"); return findAllNotSecure(visibleGroups, company, group, null, new UriInfoImpl(message)).getContent(); }
private Continuation getContinuation(String name) { ContinuationProvider provider = (ContinuationProvider)context.get(ContinuationProvider.class.getName()); if (provider == null) { Message m = PhaseInterceptorChain.getCurrentMessage(); UriInfo uriInfo = new UriInfoImpl(m); if (uriInfo.getAbsolutePath().toString().contains("/books/subresources/")) { // when we suspend a CXF continuation from a sub-resource, the invocation will // return directly to that object - and sub-resources do not have contexts supported // by default - so we just need to depend on PhaseInterceptorChain provider = (ContinuationProvider)m.get(ContinuationProvider.class.getName()); } } if (provider == null) { throw new WebApplicationException(500); } synchronized (suspended) { Continuation suspendedCont = suspended.remove(name); if (suspendedCont != null) { return suspendedCont; } } return provider.getContinuation(); }
public String preprocess(Message m, UriInfo u) { handleExtensionMappings(m, u); handleLanguageMappings(m, u); MultivaluedMap<String, String> queries = u.getQueryParameters(); handleTypeQuery(m, queries); handleCType(m, queries); handleMethod(m, queries, new HttpHeadersImpl(m)); Response r = checkMetadataRequest(m, u); if (r != null) { m.getExchange().put(Response.class, r); } return new UriInfoImpl(m, null).getPath(); }