package com.perforce.spark.view; import javax.servlet.http.HttpServletResponse; import org.apache.http.HttpResponse; import spark.Request; import spark.Response; import com.perforce.p4java.server.IOptionsServer; import com.perforce.spark.ErrorModel; import com.perforce.spark.connection.ConnectionConfig; import com.perforce.spark.connection.ConnectionSession; import com.perforce.spark.depot.DepotFactory; import com.perforce.spark.depot.DepotModel; import com.perforce.spark.repository.RepoInterface; public class ViewControl extends ErrorModel { public static Object view(Request request, Response response) { // use the 'proxy' account to view or proxy files String user = ConnectionConfig.getProxyUser(); String ticket = ConnectionConfig.getProxyTicket(); request.session().attribute(ConnectionSession.USER, user); request.session().attribute(ConnectionSession.TICKET, ticket); // get raw file from Store or Proxy try { IOptionsServer p4 = ConnectionSession.get(request, response); String base = request.pathInfo(); DepotModel depot = DepotFactory.getByBase(p4, base); RepoInterface repo = depot.getRepo(); if (request.queryParams().isEmpty()) { HttpServletResponse raw = repo.fetch(p4, request, response); return raw; } else { HttpResponse raw = repo.query(p4, request, response); return raw; } } catch (Exception e) { e.printStackTrace(); response.status(404); return response.raw(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#8 | 15371 | Paul Allen | Query support for index. | ||
#7 | 15295 | Paul Allen | Remap 'orbit' -> 'jar' extension. | ||
#6 | 15233 | Paul Allen | Show repoID in search and return 404 (not 401) in view. | ||
#5 | 15221 | Paul Allen | Generate Gem index and submit after a deploy or proxy fetch event. | ||
#4 | 15094 | Paul Allen | Added support for Proxy and Group. | ||
#3 | 14863 | Paul Allen | Change File/Dir browse to support extended options | ||
#2 | 14228 | Paul Allen |
Moved View over to the new model. Retactor connection to package. |
||
#1 | 14226 | Paul Allen | Tidy up Browse elements over to micro MVC model |