It's roughly this: @Scope("perthread") public Transport buildHttpTransport(HttpServletRequest request) { return new HttpTransport(request.getAddress(), request.getPort(), request.isSecure()); }
Actually, you can't directly inject HttpServletRequest (you can inject Tapestry's Request, and its possible to change things so that HttpServletRequest is injectable; see TapestryModule). The point is ... a service builder method can perform the necessary transformations. And you want this service to be perthread (there's a constant you can use in lieu of the "pertread" string there). On Nov 16, 2007 3:01 AM, lyifan <[EMAIL PROTECTED]> wrote: > > I want to implement a service: > > public interface Transport { > public void send(); > } > > public class HttpTransport implement Transport { > private String _address; > private int _port; > private boolean _ssl; > public HttpTransport (String address, int port, boolean ssl) { > _address = address; > _port = port; > _ssl = ssl; > } > > public void send) { > // ...... > } > } > > The parameter of the constructor is from http request. How can I build this > service? I know I can use setters, but I just wanna know how to build a > service using constructor. > -- > View this message in context: > http://www.nabble.com/T5.0.6-about-Tapestry-ioc-tf4820490.html#a13791068 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Partner and Senior Architect at Feature50 Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]