×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jul 2003
    Posts
    62

    If a function/class deprecated in java, what should i do?

    I am wondering, and i know it is off topic...

    I am doing some servlet things... with this code

    String requestUrl = HttpUtils.getRequestURL(request).toString();

    and it told me that i had depracations (HttpUtils) when i compile...

    So i check into servlet 2.4 (i use tomcat 5)

    and in the specifications

    SRV.3.1.15 HttpUtils
    public class HttpUtils
    Deprecated. As of Java(tm) Servlet API 2.3. These methods were only useful
    with the default encoding and have been moved to the request interfaces.
    SRV.3.1.15.1 Constructors
    HttpUtils()
    JAVAX.SERVLET.HTTP
    124
    public HttpUtils()
    Constructs an empty HttpUtils object.

    So what should i do? Should i ignore it?

    Actually i don't understand what it means and what should i do?

    There is no other possible ways to call

    getRequestUrl (..)

    Any help, please?

    Regards,
    Chua Wen Ching

  2. #2
    Registered User
    Join Date
    Jul 2003
    Location
    Finland, Tampere
    Posts
    1,113
    mibuyt
    If a function/class deprecated in java, what should i do?

    Use it with caution. This class/function should work, but they encourage other ways of doing it. Other more reliable/flexible/whatever_better ways

    I haven't done any servlet programming bigger, than small examples, but in your case it seems like HttpUtils don't bother about encoded strings (meaning other languages probably). Hence, they cannot be used for e.g., Chinise.

    Hence, you can use it freely in your program, just pay special care of what the class/method actually does. Othervise, realworld will strike you hard making realize what "deprecated" means if one of your markets is China just at the moment when you'll try to work with real data

  3. #3
    Regular Contributor
    Join Date
    Jul 2003
    Posts
    62
    Thanks.. I understand!

    Regards,
    Chua Wen Ching

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •