public HttpConsumer(HttpCommonEndpoint endpoint, Processor processor) { super(endpoint, processor); if (endpoint.isTraceEnabled()) { setTraceEnabled(true); } if (endpoint.isOptionsEnabled()) { setOptionsEnabled(true); } }
/** * Reads the response body from the given http servlet request. * * @param request http servlet request * @param exchange the exchange * @return the request body, can be <tt>null</tt> if no body * @throws IOException is thrown if error reading response body */ public static Object readRequestBodyFromServletRequest(HttpServletRequest request, Exchange exchange) throws IOException { InputStream is = HttpConverter.toInputStream(request, exchange); return readResponseBodyFromInputStream(is, exchange); }
@Override public String getRestrictMethod() { return consumer.getEndpoint().getHttpMethodRestrict(); }
public HttpBinding getHttpBinding() { if (httpBinding == null) { // create a new binding and use the options from this endpoint httpBinding = new DefaultHttpBinding(); httpBinding.setHeaderFilterStrategy(getHeaderFilterStrategy()); httpBinding.setTransferException(isTransferException()); if (getComponent() != null) { httpBinding.setAllowJavaSerializedObject(getComponent().isAllowJavaSerializedObject()); } httpBinding.setEagerCheckContentAvailable(isEagerCheckContentAvailable()); httpBinding.setMapHttpMessageBody(isMapHttpMessageBody()); httpBinding.setMapHttpMessageHeaders(isMapHttpMessageHeaders()); httpBinding.setMapHttpMessageFormUrlEncodedBody(isMapHttpMessageFormUrlEncodedBody()); } return httpBinding; }
@Override public boolean isMatchOnUriPrefix() { return consumer.getEndpoint().isMatchOnUriPrefix(); }
@Deprecated public DefaultHttpBinding(HttpCommonEndpoint endpoint) { this.headerFilterStrategy = endpoint.getHeaderFilterStrategy(); this.transferException = endpoint.isTransferException(); if (endpoint.getComponent() != null) { this.allowJavaSerializedObject = endpoint.getComponent().isAllowJavaSerializedObject(); } }
@Override protected void doStart() throws Exception { super.doStart(); if (getEndpoint().canConnect(this)) { canConnected = true; getEndpoint().connect(this); suspended = false; } }
public HttpBinding getBinding() { return getEndpoint().getHttpBinding(); }
@Override protected void doStop() throws Exception { suspended = false; if (canConnected) { canConnected = false; getEndpoint().disconnect(this); } super.doStop(); }
@Override public ServletEndpoint getEndpoint() { return (ServletEndpoint) super.getEndpoint(); } }
@Override public String getConsumerPath() { return consumer.getPath(); }
@Override public void setHttpBinding(HttpBinding binding) { super.setHttpBinding(binding); this.binding = binding; }
@Override public ServletComponent getComponent() { return (ServletComponent) super.getComponent(); }
@Override protected Object createBody() { try { return endpoint.getHttpBinding().parseBody(this); } catch (IOException e) { throw new RuntimeCamelException(e); } }
/** * To use the shared HttpConfiguration as base configuration. */ @Override public void setHttpConfiguration(HttpConfiguration httpConfiguration) { // need to override and call super for component docs super.setHttpConfiguration(httpConfiguration); }
/** * Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object * <p/> * This is by default turned off. If you enable this then be aware that Java will deserialize the incoming * data from the request to Java and that can be a potential security risk. */ @Override public void setAllowJavaSerializedObject(boolean allowJavaSerializedObject) { // need to override and call super for component docs super.setAllowJavaSerializedObject(allowJavaSerializedObject); }
@Override public String toString() { return getConsumerPath(); } }
/** * To use a custom HttpBinding to control the mapping between Camel message and HttpClient. */ @Override public void setHttpBinding(HttpBinding httpBinding) { // need to override and call super for component docs super.setHttpBinding(httpBinding); }
/** * Gets the parameter. This method doesn't resolve reference parameters in the registry. * * @param parameters the parameters * @param key the key * @param type the requested type to convert the value from the parameter * @return the converted value parameter */ public <T> T getParameter(Map<String, Object> parameters, String key, Class<T> type) { return getParameter(parameters, key, type, null); }
public HttpProtocolHeaderFilterStrategy() { initialize(); }