1. Jan Lahoda
  2. jackpot30

Commits

Jan Lahoda  committed 920e323

When an unknown segment ID is given, produce error 404 rather that crash with an exception

  • Participants
  • Parent commits 0eae96d
  • Branches default

Comments (0)

Files changed (2)

File remoting/server/web/base.web.api/src/org/netbeans/modules/jackpot30/backend/base/CategoryStorage.java

View file
  • Ignore whitespace
  */
 package org.netbeans.modules.jackpot30.backend.base;
 
+import com.sun.jersey.api.NotFoundException;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
             if (s.id.equals(id)) return s;
         }
 
-        return null;
+        throw new NotFoundException("No category with id: " + id);
     }
     
     private final String id;

File remoting/server/web/web.main/src/web/main/WebMain.java

View file
  • Ignore whitespace
         jerseyAdapter.setServletInstance(new ServletContainer());
 
         // register all above defined adapters
-        gws.addGrizzlyAdapter(jerseyAdapter);
         gws.addGrizzlyAdapter(new GrizzlyAdapter(){
             public void service(GrizzlyRequest request, GrizzlyResponse response){
                 if (request.getRequestURI().contains("/index/icons/")) {
                         }
                     }
                 }
+                response.setStatus(404);
             }
         });
+        gws.addGrizzlyAdapter(jerseyAdapter);
 
         // let Grizzly run
         gws.start();