Changeset 2447
- Timestamp:
- 11/30/09 22:57:19 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molgenis/3.3/src/org/molgenis/framework/server/AbstractMolgenisServlet.java
r2369 r2447 111 111 * @return package name of this molgenisvariant. 112 112 */ 113 // public static abstract String getMolgenisVariantID();113 // public static abstract String getMolgenisVariantID(); 114 114 115 115 /** … … 151 151 this.handleRAPIrequest(request, response); 152 152 } 153 else if (path != null && path.contains("/api/soap"))153 else if (path != null && (path.contains("/api/soap") || path.contains("/api/rest")) ) 154 154 { 155 155 this.handleSOAPrequest(request, response); 156 156 } 157 elseif (path != null && path.contains("/xref/find"))157 if (path != null && path.contains("/xref/find")) 158 158 { 159 159 this.handleXREFrequest(request, response); … … 167 167 168 168 RestInterface.handleRequest(request, response, getDatabase()); 169 170 169 } 171 170 else … … 195 194 response.setBufferSize(10000); 196 195 response.setContentType("text/html; charset=UTF-8"); 197 196 198 197 // get the relative path 199 198 String filename = request.getRequestURI().substring( … … 233 232 // delegate to CXF servlet 234 233 // load the bus if needed 235 if (this.cxfLoaded == false && this.getSoapImpl() != null)234 if (this.cxfLoaded == false && (this.getSoapImpl() != null || this.getRestImpl() != null)) 236 235 { 237 236 super.loadBus(this.getServletConfig()); 238 237 Bus bus = this.getBus(); 239 238 BusFactory.setDefaultBus(bus); 240 Endpoint.publish("/", this.getSoapImpl()); 239 Endpoint.publish("/soap/", this.getSoapImpl()); 240 //Endpoint.publish("/rest/", this.getSoapImpl()); 241 241 242 this.cxfLoaded = true; 242 243 } … … 253 254 { 254 255 db = getDatabase(); 255 // db.beginTx(); DISCUSSION256 // db.beginTx(); DISCUSSION 256 257 logger.info("created database " + db); 257 258 } … … 319 320 // action == download, but now in a standard way, handled by 320 321 // controller 321 else if (ScreenModel.S HOW_DOWNLOAD.equals(requestTuple.getString(ScreenModel.INPUT_SHOW)))322 else if (ScreenModel.Show.SHOW_DOWNLOAD.equals(requestTuple.getString(FormModel.INPUT_SHOW))) 322 323 { 323 324 // get the screen that will hande the download request … … 340 341 else 341 342 { 342 343 343 344 molgenis.getController().handleRequest(db, requestTuple); 344 345 // handle request 345 346 molgenis.getController().reload(db); // reload the application 347 logger.debug("reloaded "+molgenis.getName()+" screen, rendering..."); 346 348 347 349 // ((UserInterface)molgenis).getDatabase().close(); … … 366 368 args.put("title", molgenis.getLabel()); 367 369 args.put("application", molgenis); 368 //args.put("username", userLogin.getUserName());370 // args.put("username", userLogin.getUserName()); 369 371 370 372 // FIXME complex screen handling 371 String show = requestTuple.getString( ScreenModel.INPUT_SHOW);373 String show = requestTuple.getString(FormModel.INPUT_SHOW); 372 374 if (show != null) 373 375 { … … 375 377 376 378 // if dialog, only show target 377 if (ScreenModel.S HOW_DIALOG.equals(show))379 if (ScreenModel.Show.SHOW_DIALOG.equals(show)) 378 380 { 379 381 FormModel target = (FormModel) molgenis.get(requestTuple.getString("__target")); … … 408 410 writer.close(); 409 411 } 410 // db.commitTx(); DISCUSSION412 // db.commitTx(); DISCUSSION 411 413 } 412 414 catch (Exception e) … … 418 420 // throw new RuntimeException(e); 419 421 } 420 421 422 422 423 } … … 489 490 filename = filename.replace(".", "/"); 490 491 filename = filename.substring(0, filename.length() - 2) + ".R"; 491 //map to hard drive, minus path papp/servlet 492 File root = new File(this.getClass().getResource("source.R").getFile()).getParentFile().getParentFile().getParentFile(); 493 494 if(filename.equals("source.R")) 492 // map to hard drive, minus path papp/servlet 493 File root = new File(this.getClass().getResource("source.R").getFile()).getParentFile().getParentFile() 494 .getParentFile(); 495 496 if (filename.equals("source.R")) 495 497 { 496 498 root = new File(root.getAbsolutePath() + "/app/servlet"); 497 499 } 498 500 File source = new File(root.getAbsolutePath() + "/" + filename); 499 500 // up to root of app501 502 // up to root of app 501 503 logger.info("trying to load R file: " + filename + " from path " + source); 502 if (source.exists())504 if (source.exists()) 503 505 { 504 506 this.writeURLtoOutput(source.toURL(), out); 505 } else 507 } 508 else 506 509 { 507 510 out.write("File '" + filename + "' not found"); … … 690 693 // setup the output-stream 691 694 response.setBufferSize(10000); 692 response.setContentType("text/html; charset=UTF-8"); 695 response.setContentType("text/html; charset=UTF-8"); 693 696 694 697 logger.info("upload service started"); … … 995 998 Tuple req = new HttpServletRequestTuple(request); 996 999 997 String xref_entity = Class.forName(req.getString("xref_entity")).getSimpleName();; 998 String xref_field = xref_entity + "."+req.getString("xref_field"); 999 String xref_label = xref_entity + "." +(String) req.getList("xref_label").get(0); 1000 String xref_entity = Class.forName(req.getString("xref_entity")).getSimpleName(); 1001 ; 1002 String xref_field = xref_entity + "." + req.getString("xref_field"); 1003 String xref_label = xref_entity + "." + (String) req.getList("xref_label").get(0); 1000 1004 List<QueryRule> xref_filters = QueryRuleUtil.fromRESTstring(req.getString("xref_filters")); 1001 1005 String xref_label_search = req.getString("xref_label_search"); … … 1003 1007 logger.debug(xref_entity + " " + xref_field + " " + xref_label + " " + xref_label_search); 1004 1008 List<String> queryFields = new ArrayList<String>(); 1005 queryFields.add( xref_field);1006 queryFields.add( xref_label);1009 queryFields.add(xref_field); 1010 queryFields.add(xref_label); 1007 1011 1008 1012 // create a CustomQuery 1009 1013 JoinQuery q = getDatabase().query(queryFields); 1010 1014 q.addRules(xref_filters); 1011 if (xref_label_search != null && xref_label_search != "") 1015 if (xref_label_search != null && xref_label_search != "") 1012 1016 { 1013 1017 q.like((String) xref_label, "%" + xref_label_search + "%"); 1014 q. orderASC((String) xref_label);1018 q.sortASC((String) xref_label); 1015 1019 } 1016 1020 q.limit(100); 1017 1018 1021 1019 1022 List<Tuple> result = q.find(); … … 1025 1028 for (int i = 0; i < result.size(); i++) 1026 1029 { 1027 // logger.debug("using: " + result.get(i));1030 // logger.debug("using: " + result.get(i)); 1028 1031 if (i > 0) out.write(","); 1029 1032 out.write(result.get(i).getString(xref_field) + ":\""); … … 1042 1045 } 1043 1046 } 1047 1048 public Object getRestImpl() throws DatabaseException, NamingException 1049 { 1050 // TODO Auto-generated method stub 1051 return null; 1052 } 1044 1053 }
Note: See TracChangeset
for help on using the changeset viewer.