use of org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest in project webtools.servertools by eclipse.
the class ModifyMessageAction method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
if (selection != null) {
Object element = ((StructuredSelection) selection).getFirstElement();
if (element != null && element instanceof Request) {
Request req = (Request) element;
ResendHTTPRequest newReq = MonitorManager.createResendRequest(req);
MonitorManager.getInstance().addResendRequest(req, newReq);
TreeViewer treeViewer = MonitorView.view.treeViewer;
treeViewer.add(req, newReq);
treeViewer.setSelection(new StructuredSelection(newReq), false);
}
}
}
use of org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest in project webtools.servertools by eclipse.
the class ResendMessageAction method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
if (selection != null) {
Object element = ((StructuredSelection) selection).getFirstElement();
if (element != null && element instanceof Request) {
Request req = (Request) element;
ResendHTTPRequest newReq = MonitorManager.createResendRequest(req);
MonitorManager.getInstance().addResendRequest(req, newReq);
TreeViewer treeViewer = MonitorView.view.treeViewer;
treeViewer.add(req, newReq);
treeViewer.setSelection(new StructuredSelection(newReq), false);
newReq.sendRequest();
}
}
}
use of org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest in project webtools.servertools by eclipse.
the class ViewerManager method setRequest.
public void setRequest(Request rr) {
// maintain the state of the request and request header if they've been modified.
if (request instanceof ResendHTTPRequest && request.getResponse(Request.ALL) == null) {
ResendHTTPRequest resRequest = (ResendHTTPRequest) request;
// EditableContentViewer editViewer = (ContentViewer) reqViewer;
byte[] content = reqViewer.getContent();
byte[] b = resRequest.getRequest(Request.CONTENT);
if (content != null && b != null && !MonitorUIPlugin.parse(b).equals(MonitorUIPlugin.parse(content))) {
resRequest.setRequest(content, Request.CONTENT);
}
byte[] header = reqHeader.getContent();
b = resRequest.getRequest(Request.TRANSPORT);
if (header != null && b != null && !MonitorUIPlugin.parse(b).equals(MonitorUIPlugin.parse(header))) {
resRequest.setRequest(header, Request.TRANSPORT);
}
}
reqHeader.setRequestResponse(rr);
respHeader.setRequestResponse(rr);
byte[] b = null;
if (rr != null)
b = filter(rr.getRequest(Request.CONTENT));
reqViewer.setContent(b);
b = null;
if (rr != null)
b = filter(rr.getResponse(Request.CONTENT));
respViewer.setContent(b);
request = rr;
// editor can be set as editable
if (request instanceof ResendHTTPRequest && request.getResponse(Request.ALL) == null) {
if (displayHeaderInf)
reqHeader.setEditable(true);
reqViewer.setEditable(true);
} else {
if (displayHeaderInf)
reqHeader.setEditable(false);
reqViewer.setEditable(false);
}
}
use of org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest in project webtools.servertools by eclipse.
the class MonitorTreeContentProvider method getParent.
/*
* Returns the parent for the given element, or <code>null</code>
* indicating that the parent can't be computed.
*/
public Object getParent(Object element) {
if (element != null) {
if (element instanceof Integer)
return ROOT;
Request call = (Request) element;
if (call instanceof ResendHTTPRequest) {
ResendHTTPRequest callResend = (ResendHTTPRequest) call;
Request parent = callResend.getOriginalRequest();
if (parent != null)
return parent;
}
return new Integer(call.getLocalPort());
}
return null;
}
use of org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest in project webtools.servertools by eclipse.
the class MonitorTreeContentProvider method getChildren.
/**
* Returns an iterator over the child elements of the given element.
* <p>
* Note: The difference between this method and
* <code>IStructuredContentProvider.getElements</code> is
* that <code>getElements</code> is called to obtain the
* tree viewer's root elements, whereas <code>getChildren</code> is used
* to obtain the children of a given node in the tree
* (including a root).
* </p>
* <p>
* [Issue: Don't know what above is trying to say.
* See IStructuredContentProvider.getElements.
* ]
* </p>
*
* @param element the element
* @return an iterator over the child elements
* (element type: <code>Object</code>)
*/
public Object[] getChildren(Object element) {
if (element instanceof Integer) {
Integer in = (Integer) element;
List<Request> list = new ArrayList<Request>();
Request[] requests = MonitorUIPlugin.getInstance().getRequests();
if (requests != null) {
for (Request req : requests) {
if ((req.getLocalPort() == in.intValue()) && !(req instanceof ResendHTTPRequest))
list.add(req);
}
}
return list.toArray();
} else if (element instanceof Request) {
Request req = (Request) element;
ResendHTTPRequest[] rr = MonitorManager.getInstance().getResendRequests(req);
List<Request> list = new ArrayList<Request>();
if (rr != null) {
for (ResendHTTPRequest r : rr) list.add(r);
}
return list.toArray();
}
return null;
}
Aggregations