001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.camel.component.servlet; 018 019 import java.net.URI; 020 import java.net.URISyntaxException; 021 022 import org.apache.camel.Consumer; 023 import org.apache.camel.Processor; 024 import org.apache.camel.Producer; 025 import org.apache.camel.component.http.HttpClientConfigurer; 026 import org.apache.camel.component.http.HttpConsumer; 027 import org.apache.camel.component.http.HttpEndpoint; 028 import org.apache.commons.httpclient.HttpConnectionManager; 029 import org.apache.commons.httpclient.params.HttpClientParams; 030 031 public class ServletEndpoint extends HttpEndpoint { 032 033 private String servletName; 034 035 public ServletEndpoint() { 036 super(); 037 } 038 039 public ServletEndpoint(String endPointURI, ServletComponent component, URI httpUri, HttpClientParams params, HttpConnectionManager httpConnectionManager, 040 HttpClientConfigurer clientConfigurer) throws URISyntaxException { 041 super(endPointURI, component, httpUri, params, httpConnectionManager, clientConfigurer); 042 } 043 044 public void setServletName(String name) { 045 servletName = name; 046 } 047 048 public String getServletName() { 049 return servletName; 050 } 051 052 @Override 053 public Producer createProducer() throws Exception { 054 throw new UnsupportedOperationException("You cannot create producer with servlet endpoint, please consider to use http or http4 endpoint."); 055 } 056 057 @Override 058 public Consumer createConsumer(Processor processor) throws Exception { 059 return new HttpConsumer(this, processor); 060 } 061 062 @Override 063 public boolean isLenientProperties() { 064 // in contrast to the HttpEndpoint, the ServletEndpoint knows about all it's options on the passed URI 065 return false; 066 } 067 068 }