public static String getProtocolHeader(Message m, String name, String defaultValue) { return getProtocolHeader(m, name, defaultValue, false); }
public String getMethod() { return HttpUtils.getProtocolHeader(m, Message.HTTP_REQUEST_METHOD, null); }
public String getMethod() { return HttpUtils.getProtocolHeader(m, Message.HTTP_REQUEST_METHOD, null); }
public static String getProtocolHeader(Message m, String name, String defaultValue) { return getProtocolHeader(m, name, defaultValue, false); }
public static String getPathToMatch(Message m, boolean addSlash) { String var = addSlash ? REQUEST_PATH_TO_MATCH_SLASH : REQUEST_PATH_TO_MATCH; String pathToMatch = (String)m.get(var); if (pathToMatch != null) { return pathToMatch; } String requestAddress = getProtocolHeader(m, Message.REQUEST_URI, "/"); if (m.get(Message.QUERY_STRING) == null) { int index = requestAddress.lastIndexOf('?'); if (index > 0 && index < requestAddress.length()) { m.put(Message.QUERY_STRING, requestAddress.substring(index + 1)); requestAddress = requestAddress.substring(0, index); } } String baseAddress = getBaseAddress(m); pathToMatch = getPathToMatch(requestAddress, baseAddress, addSlash); m.put(var, pathToMatch); return pathToMatch; }
public static String getPathToMatch(Message m, boolean addSlash) { String var = addSlash ? REQUEST_PATH_TO_MATCH_SLASH : REQUEST_PATH_TO_MATCH; String pathToMatch = (String)m.get(var); if (pathToMatch != null) { return pathToMatch; } String requestAddress = getProtocolHeader(m, Message.REQUEST_URI, "/"); if (m.get(Message.QUERY_STRING) == null) { int index = requestAddress.lastIndexOf('?'); if (index > 0 && index < requestAddress.length()) { m.put(Message.QUERY_STRING, requestAddress.substring(index + 1)); requestAddress = requestAddress.substring(0, index); } } String baseAddress = getBaseAddress(m); pathToMatch = getPathToMatch(requestAddress, baseAddress, addSlash); m.put(var, pathToMatch); return pathToMatch; }
private void setExchangeProperties(Message message, OperationResourceInfo ori, MultivaluedMap<String, String> values, int numberOfResources) { message.getExchange().put(OperationResourceInfo.class, ori); message.put(RESOURCE_METHOD, ori.getMethodToInvoke()); message.put(URITemplate.TEMPLATE_PARAMETERS, values); String plainOperationName = ori.getMethodToInvoke().getName(); if (numberOfResources > 1) { plainOperationName = ori.getClassResourceInfo().getServiceClass().getSimpleName() + "#" + plainOperationName; } message.getExchange().put(RESOURCE_OPERATION_NAME, plainOperationName); boolean oneway = ori.isOneway() || MessageUtils.isTrue(HttpUtils.getProtocolHeader(message, Message.ONE_WAY_REQUEST, null)); message.getExchange().setOneWay(oneway); }
String httpMethod = HttpUtils.getProtocolHeader(message, Message.HTTP_REQUEST_METHOD, HttpMethod.POST, true); acceptTypes = HttpUtils.getProtocolHeader(message, Message.ACCEPT_CONTENT_TYPE, null); if (acceptTypes == null) { acceptTypes = "*/*";
private void setExchangeProperties(Message message, Exchange exchange, OperationResourceInfo ori, MultivaluedMap<String, String> values, int numberOfResources) { final ClassResourceInfo cri = ori.getClassResourceInfo(); exchange.put(OperationResourceInfo.class, ori); exchange.put(JAXRSUtils.ROOT_RESOURCE_CLASS, cri); message.put(RESOURCE_METHOD, ori.getMethodToInvoke()); message.put(URITemplate.TEMPLATE_PARAMETERS, values); String plainOperationName = ori.getMethodToInvoke().getName(); if (numberOfResources > 1) { plainOperationName = cri.getServiceClass().getSimpleName() + "#" + plainOperationName; } exchange.put(RESOURCE_OPERATION_NAME, plainOperationName); if (ori.isOneway() || PropertyUtils.isTrue(HttpUtils.getProtocolHeader(message, Message.ONE_WAY_REQUEST, null))) { exchange.setOneWay(true); } ResourceProvider rp = cri.getResourceProvider(); if (rp instanceof SingletonResourceProvider) { //cri.isSingleton is not guaranteed to indicate we have a 'pure' singleton exchange.put(Message.SERVICE_OBJECT, rp.getInstance(message)); } }
String httpMethod = HttpUtils.getProtocolHeader(message, Message.HTTP_REQUEST_METHOD, HttpMethod.POST, true); acceptTypes = HttpUtils.getProtocolHeader(message, Message.ACCEPT_CONTENT_TYPE, null); if (acceptTypes == null) { acceptTypes = "*/*";