public Context getContext(String path) { if (!path.startsWith("/")) { return null; // according to spec, null is returned // if we can't return a servlet, so it's more probable // servlets will check for null than IllegalArgument } // Return null if cross context lookups are not allowed if (!crossContext) return null; // absolute path Request lr = contextM.createRequest(path); if (vhost != null) lr.setServerName(vhost); getContextManager().processRequest(lr); return lr.getContext(); }
private void processRequest(DataInputStream in) throws IOException { long serverId = in.readLong(); ServerObject server = servingById.get(serverId); long requestId = in.readLong(); Request r = new Request(this, server.getObject()); r.deserialize(in); r.invoke(); if (requestId != -1) { sendResponse(requestId, r.getResult(), r.getResultDeclaredType()); } }
private void processResponse(DataInputStream in) throws IOException { long requestId = in.readLong(); Request r = requests.remove(requestId); if (r == null) { throw new IllegalStateException( "Request " + requestId + " is unknown (last request generated was " + nextRequest.get()); } Object o = null; if (in.readBoolean()) { o = serializerFor(classForName(in.readUTF()), r.getResultDeclaredType()).deserialize(in); } r.set(o); }
private void sendRequest(long objectId, long requestId, Request r) throws IOException { DataOutputStream out = newFlusher(); out.writeByte(REQUEST); out.writeLong(objectId); out.writeLong(requestId); r.serialize(out); out.writeBoolean(false); out.flush(); }
/** * _more_ * * @param request _more_ * @param icon _more_ * @return _more_ */ public String getIconUrl(Request request, String icon) { return request.getAbsoluteUrl(getRepository().iconUrl(icon)); }