Results 1 to 3 of 3

Thread: ResourceUtils and JNLP ...

  1. #1
    Join Date
    Jul 2006
    Location
    Switzerland
    Posts
    21

    Default ResourceUtils and JNLP ...

    Hi,

    I'm using Spring-3.1.1 and I have a question if the ResourceUtils correctly checks for JNLP connection ...

    The following code should check if the connection is a JNLP connection.
    Code:
    /**
     * Set the {@link URLConnection#setUseCaches "useCaches"} flag on the
     * given connection, preferring <code>false</code> but leaving the
     * flag at <code>true</code> for JNLP based resources.
     * @param con the URLConnection to set the flag on
     */
    public static void useCachesIfNecessary(URLConnection con) {
       con.setUseCaches(con.getClass().getName().startsWith("JNLP"));
    }
    I've debugged the code and the getName() of the connection returns the name with packages prefixed in case of using the Oracle JDK (as expected) what prevents the flag set to true.
    I think this call should use ClassUtils.getShortName() instead of getClass().getName().

    Code:
    /**
     * Set the {@link URLConnection#setUseCaches "useCaches"} flag on the
     * given connection, preferring <code>false</code> but leaving the
     * flag at <code>true</code> for JNLP based resources.
     * @param con the URLConnection to set the flag on
     */
    public static void useCachesIfNecessary(URLConnection con) {
       con.setUseCaches(ClassUtils.getShortName(con.getClass()).startsWith("JNLP"));
    }
    I'm not sure if this is the correct forum for this question ... or is it better to create a JIRA issue?

    Cheers
    Andi

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,631

    Default

    If you think it is a bug or if it is wrong create a JIRA.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2006
    Location
    Switzerland
    Posts
    21

Tags for this Thread

Posting Permissions

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