If you look into the basics of the URL framework in Java, you can see it is fairly easy to add support for new protocols and content types. The engineers at Sun, planning for a self-extensible browser, divided the problem into protocol handling and content handling. Handling the protocol means managing or handling the interaction between the client and the server: generating requests in correct format, interpreting headers, acknowledging data receipt, etc. Handling content means doing something that fits the data received, e.g. displaying an image. The software that displays the image does not care how the data got there by gopher, HTTP, FTP, or your own protocol. So, protocol and content are decoupled. I LOVE DECOUPLING! On the other hand, the protocol handler could care less about the data, image, HTML, MPEG, etc., but merely extracts the data from the headers to pass to the content handler.
Protocol handling is further abstracted in parts in the java.net package: URL, URLConnection, URLStreamHandlerFactory. URL is the only concrete class and in implementing your own protocol you have to write concrete subclasses for the URLStreamHandler and URLConnection classes. The result is, say, something sent as, say, dakota://www.crackwillow.com instead of http://www.cracckwillow.com. To use the former two classes, you also have to write a class that implements the URLStreamHandlerFactory interface. URLs are pointers which specify the protocol, e.g. mailto:, http and ftp. The URL constructor strips the input and gets the protocol string (e.g. "http") and uses it to call the right URLStreamHandlerFactory. When the URL gets the stream handler, it uses the stream handler to finish parsing the URL string and to create a subclass of URLConnection that knows how to deal with servers for the protocol. (You can define a URL format that is appropriate to your task.) The URLConnection class is responsible for ineracting with the server. This class knows how to read headers and generate requests. The output is raw data for a content handler. You can build a browser, too, which will accept new protocols at runtime. Cool, eh? There are numerous books out there outlining how to do this. With Java, it is very simple. Not hard at all and something someone with specialized interests, like you seem to have, should use. Cheers. On 5/6/05, temp temp <[EMAIL PROTECTED]> wrote: > I did not understand writing my own protocol . > Can you elobrate or explain me writing my own > protocol for uploading files . > > > --- Dakota Jack <[EMAIL PROTECTED]> wrote: > > > If the stream to the file upload fails, then the > > file upload must > > abort. I would suggest, again, that you seriously > > consider writing > > your own protocol instead of using HTTP. Or, you > > might, as previously > > suggested by someone else, use FTP. You realize you > > can use FTP with > > your server, right? > > > > > > > > On 5/6/05, temp temp <[EMAIL PROTECTED]> wrote: > > > Now I am using commons file upload .At times I get > > > this error message. > > > > > > Processing of multipart/form-data request failed. > > > Stream ended unexpectedly]: > > > org.apache.commons.fileupload.FileUploadException: > > > Processing of multipart/form-data request failed. > > > Stream ended unexpectedly > > > > > > what causes this and how to resolve this. > > > > > > > > > --- Dakota Jack <[EMAIL PROTECTED]> wrote: > > > > > > > An initial view show that you do not set an > > upper > > > > limit on the file > > > > size. Why don't you cheeck and see if there is > > one > > > > in commons? I > > > > suspect there might be. You can override that, > > of > > > > course. If you > > > > don't want to check, why don't you just override > > it? > > > > > > > > Also, have you considered writing your own > > protocol > > > > for this? I have > > > > to agree that HTTP is not the best for this. > > Maybe > > > > you could use FTP > > > > or write one that works best for you. > > > > > > > > > > > > > > > > On 5/5/05, temp temp <[EMAIL PROTECTED]> > > wrote: > > > > > Atached is my upload jsp upload ActionForm and > > > > > upload Action > > > > > > > > > > thanks & regards > > > > > > > > > > > > > > > --- Dakota Jack <[EMAIL PROTECTED]> wrote: > > > > > > Then let see the code you are using and go > > from > > > > > > there. > > > > > > > > > > > > On 5/4/05, temp temp <[EMAIL PROTECTED]> > > > > wrote: > > > > > > > > > > > > > > I want to continue on this path and donot > > know > > > > how > > > > > > to > > > > > > > fix it please help me . > > > > > > > > > > > > > > thanks & regards > > > > > > > > > > > > > > If you really want to continue on this > > path > > > > and > > > > > > > > don't know how to fix > > > > > > > > it, let me know and I will be glad to > > help. > > > > > > > > > > > > > > --- Dakota Jack <[EMAIL PROTECTED]> > > wrote: > > > > > > > > You might want to build your own file > > upload > > > > > > > > application off of > > > > > > > > commons or cos. > > > > > > > > > > > > > > > > The Struts application is not > > particularly > > > > > > > > sophisticated. However, if > > > > > > > > you do, then you have to build your own > > > > objects > > > > > > to > > > > > > > > mine the data, > > > > > > > > because Struts has tied the internals of > > the > > > > > > > > RequestProcessor to the > > > > > > > > upload application and the last I looked > > > > they > > > > > > are > > > > > > > > going to continue to > > > > > > > > do so even with 1.3 although everything > > else > > > > is > > > > > > > > abstracted out of the > > > > > > > > RequestProcessor in 1.3. I just rebuilt > > the > > > > > > whole > > > > > > > > thing so that I > > > > > > > > don't have to worry about the multipart > > > > handling > > > > > > > > stuff in Struts. > > > > > > > > > > > > > > > > If you really want to continue on this > > path > > > > and > > > > > > > > don't know how to fix > > > > > > > > it, let me know and I will be glad to > > help. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 5/4/05, temp temp > > <[EMAIL PROTECTED]> > > > > > > wrote: > > > > > > > > > I am using struts and trying to upload > > > > files > > > > > > of > > > > > > > > any > > > > > > > > > type and size.If the server as well as > > > > client > > > > > > is > > > > > > > > on > > > > > > > > > the same PC no issues ,but if I try to > > > > > > accomplish > > > > > > > > this > > > > > > > > > across the network then I am only able > > to > > > > > > upload a > > > > > > > > > file if the size is less then 1 MB > > .Not > > > > sure > > > > > > what > > > > > > > > the > > > > > > > > > problem is. > > > > > > > > > > > > > > > > > > thanks & regards > > > > > > > > > > > > > > > > > > __________________________________ > > > > > > > > > Do you Yahoo!? > > > > > > > > > Yahoo! Small Business - Try our new > > > > resources > > > > > > > > site! > > > > > > > > > > > http://smallbusiness.yahoo.com/resources/ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > > To unsubscribe, e-mail: > > > > > > > > [EMAIL PROTECTED] > > > > > > > > > For additional commands, e-mail: > > > > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > "You can lead a horse to water but you > > > > cannot > > > > > > make > > > > > > > > it float on its back." > > > > > > > > ~Dakota Jack~ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > To unsubscribe, e-mail: > > > > > > > > [EMAIL PROTECTED] > > > > > > > > For additional commands, e-mail: > > > > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > __________________________________ > > > > > > > Do you Yahoo!? > > > > > > > Yahoo! Small Business - Try our new > > resources > > > > > > site! > > > > > > > http://smallbusiness.yahoo.com/resources/ > > > > > > > > > > > > > > > > === message truncated === > > > __________________________________ > Yahoo! Mail Mobile > Take Yahoo! Mail with you! Check email on your mobile phone. > http://mobile.yahoo.com/learn/mail > -- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]