Skip to content

Commit 569df63

Browse files
committed
Convert ActionCode to an enum.
Shorten all the names by removing ACTION_ from the beginning. We have to use ActionCode.XXX to ACTION_ is just wasted screen space. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@996677 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3d5de56 commit 569df63

23 files changed

Lines changed: 189 additions & 238 deletions

java/org/apache/catalina/authenticator/FormAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ protected boolean restoreRequest(Request request, Session session)
460460

461461
if (body != null) {
462462
request.getCoyoteRequest().action
463-
(ActionCode.ACTION_REQ_SET_BODY_REPLAY, body);
463+
(ActionCode.REQ_SET_BODY_REPLAY, body);
464464

465465
// Set content type
466466
MessageBytes contentType = MessageBytes.newInstance();

java/org/apache/catalina/authenticator/SSLAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public boolean authenticate(Request request,
133133
request.getAttribute(Globals.CERTIFICATES_ATTR);
134134
if ((certs == null) || (certs.length < 1)) {
135135
request.getCoyoteRequest().action
136-
(ActionCode.ACTION_REQ_SSL_CERTIFICATE, null);
136+
(ActionCode.REQ_SSL_CERTIFICATE, null);
137137
certs = (X509Certificate[])
138138
request.getAttribute(Globals.CERTIFICATES_ATTR);
139139
}

java/org/apache/catalina/connector/CoyoteAdapter.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public boolean event(org.apache.coyote.Request req,
221221
error = true;
222222
connector.getService().getContainer().getPipeline().getFirst().event(request, response, request.getEvent());
223223
}
224-
res.action(ActionCode.ACTION_COMET_END, null);
224+
res.action(ActionCode.COMET_END, null);
225225
} else if (!error && read && request.getAvailable()) {
226226
// If this was a read and not all bytes have been read, or if no data
227227
// was read from the connector, then it is an error
@@ -285,7 +285,7 @@ public boolean asyncDispatch(org.apache.coyote.Request req,org.apache.coyote.Res
285285
}
286286
} else if (impl.getState()==AsyncContextImpl.AsyncState.STARTED){
287287
//TODO SERVLET3 - async
288-
res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
288+
res.action(ActionCode.ASYNC_START, request.getAsyncContext());
289289
async = true;
290290
break;
291291
} else if (impl.getState()==AsyncContextImpl.AsyncState.NOT_STARTED){
@@ -311,11 +311,11 @@ public boolean asyncDispatch(org.apache.coyote.Request req,org.apache.coyote.Res
311311
// Invoke a read event right away if there are available bytes
312312
if (event(req, res, SocketStatus.OPEN)) {
313313
comet = true;
314-
res.action(ActionCode.ACTION_COMET_BEGIN, null);
314+
res.action(ActionCode.COMET_BEGIN, null);
315315
}
316316
} else {
317317
comet = true;
318-
res.action(ActionCode.ACTION_COMET_BEGIN, null);
318+
res.action(ActionCode.COMET_BEGIN, null);
319319
}
320320
} else {
321321
// Clear the filter chain, as otherwise it will not be reset elsewhere
@@ -325,7 +325,7 @@ public boolean asyncDispatch(org.apache.coyote.Request req,org.apache.coyote.Res
325325
}
326326
if (!async && !comet) {
327327
response.finishResponse();
328-
req.action(ActionCode.ACTION_POST_REQUEST , null);
328+
req.action(ActionCode.POST_REQUEST , null);
329329
}
330330

331331
} catch (IOException e) {
@@ -406,11 +406,11 @@ public void service(org.apache.coyote.Request req,
406406
// Invoke a read event right away if there are available bytes
407407
if (event(req, res, SocketStatus.OPEN)) {
408408
comet = true;
409-
res.action(ActionCode.ACTION_COMET_BEGIN, null);
409+
res.action(ActionCode.COMET_BEGIN, null);
410410
}
411411
} else {
412412
comet = true;
413-
res.action(ActionCode.ACTION_COMET_BEGIN, null);
413+
res.action(ActionCode.COMET_BEGIN, null);
414414
}
415415
} else {
416416
// Clear the filter chain, as otherwise it will not be reset elsewhere
@@ -422,17 +422,17 @@ public void service(org.apache.coyote.Request req,
422422
}
423423
AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
424424
if (asyncConImpl!=null && asyncConImpl.getState()==AsyncContextImpl.AsyncState.STARTED) {
425-
res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
425+
res.action(ActionCode.ASYNC_START, request.getAsyncContext());
426426
async = true;
427427
} else if (request.isAsyncDispatching()) {
428428
asyncDispatch(req, res, SocketStatus.OPEN);
429429
if (request.isAsyncStarted()) {
430430
async = true;
431-
res.action(ActionCode.ACTION_ASYNC_START, request.getAsyncContext());
431+
res.action(ActionCode.ASYNC_START, request.getAsyncContext());
432432
}
433433
} else if (!comet) {
434434
response.finishResponse();
435-
req.action(ActionCode.ACTION_POST_REQUEST , null);
435+
req.action(ActionCode.POST_REQUEST , null);
436436
}
437437

438438
} catch (IOException e) {
@@ -587,7 +587,7 @@ protected boolean postParseRequest(org.apache.coyote.Request req,
587587
serverName = req.localName();
588588
if (serverName.isNull()) {
589589
// well, they did ask for it
590-
res.action(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, null);
590+
res.action(ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, null);
591591
}
592592
} else {
593593
serverName = req.serverName();

java/org/apache/catalina/connector/InputBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public int available() {
253253
available = cb.getLength();
254254
}
255255
if (available == 0) {
256-
coyoteRequest.action(ActionCode.ACTION_AVAILABLE, null);
256+
coyoteRequest.action(ActionCode.AVAILABLE, null);
257257
available = (coyoteRequest.getAvailable() > 0) ? 1 : 0;
258258
}
259259
return available;

java/org/apache/catalina/connector/OutputBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ protected void doFlush(boolean realFlush)
314314
doFlush = false;
315315

316316
if (realFlush) {
317-
coyoteResponse.action(ActionCode.ACTION_CLIENT_FLUSH,
317+
coyoteResponse.action(ActionCode.CLIENT_FLUSH,
318318
coyoteResponse);
319319
// If some exception occurred earlier, or if some IOE occurred
320320
// here, notify the servlet with an IOE

java/org/apache/catalina/connector/Request.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ public Object getAttribute(String name) {
922922
if(attr != null)
923923
return attr;
924924
if( isSSLAttribute(name) ) {
925-
coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE,
925+
coyoteRequest.action(ActionCode.REQ_SSL_ATTRIBUTE,
926926
coyoteRequest);
927927
attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
928928
if( attr != null) {
@@ -1224,7 +1224,7 @@ public String getRealPath(String path) {
12241224
public String getRemoteAddr() {
12251225
if (remoteAddr == null) {
12261226
coyoteRequest.action
1227-
(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest);
1227+
(ActionCode.REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest);
12281228
remoteAddr = coyoteRequest.remoteAddr().toString();
12291229
}
12301230
return remoteAddr;
@@ -1240,7 +1240,7 @@ public String getRemoteHost() {
12401240
remoteHost = getRemoteAddr();
12411241
} else {
12421242
coyoteRequest.action
1243-
(ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest);
1243+
(ActionCode.REQ_HOST_ATTRIBUTE, coyoteRequest);
12441244
remoteHost = coyoteRequest.remoteHost().toString();
12451245
}
12461246
}
@@ -1254,7 +1254,7 @@ public String getRemoteHost() {
12541254
public int getRemotePort(){
12551255
if (remotePort == -1) {
12561256
coyoteRequest.action
1257-
(ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
1257+
(ActionCode.REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
12581258
remotePort = coyoteRequest.getRemotePort();
12591259
}
12601260
return remotePort;
@@ -1267,7 +1267,7 @@ public int getRemotePort(){
12671267
public String getLocalName(){
12681268
if (localName == null) {
12691269
coyoteRequest.action
1270-
(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
1270+
(ActionCode.REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
12711271
localName = coyoteRequest.localName().toString();
12721272
}
12731273
return localName;
@@ -1280,7 +1280,7 @@ public String getLocalName(){
12801280
public String getLocalAddr(){
12811281
if (localAddr == null) {
12821282
coyoteRequest.action
1283-
(ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
1283+
(ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
12841284
localAddr = coyoteRequest.localAddr().toString();
12851285
}
12861286
return localAddr;
@@ -1294,7 +1294,7 @@ public String getLocalAddr(){
12941294
public int getLocalPort(){
12951295
if (localPort == -1){
12961296
coyoteRequest.action
1297-
(ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE, coyoteRequest);
1297+
(ActionCode.REQ_LOCALPORT_ATTRIBUTE, coyoteRequest);
12981298
localPort = coyoteRequest.getLocalPort();
12991299
}
13001300
return localPort;
@@ -2381,11 +2381,11 @@ public boolean getAvailable() {
23812381
}
23822382

23832383
public void cometClose() {
2384-
coyoteRequest.action(ActionCode.ACTION_COMET_CLOSE,getEvent());
2384+
coyoteRequest.action(ActionCode.COMET_CLOSE,getEvent());
23852385
}
23862386

23872387
public void setCometTimeout(long timeout) {
2388-
coyoteRequest.action(ActionCode.ACTION_COMET_SETTIMEOUT,new Long(timeout));
2388+
coyoteRequest.action(ActionCode.COMET_SETTIMEOUT,new Long(timeout));
23892389
}
23902390

23912391
/**

java/org/apache/catalina/core/AsyncContextImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void complete() {
9090
state.compareAndSet(AsyncState.TIMING_OUT_NEED_COMPLETE,
9191
AsyncState.COMPLETING)) {
9292
AtomicBoolean dispatched = new AtomicBoolean(false);
93-
request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_COMPLETE,
93+
request.getCoyoteRequest().action(ActionCode.ASYNC_COMPLETE,
9494
dispatched);
9595
if (!dispatched.get()) doInternalComplete(false);
9696
} else {
@@ -152,7 +152,7 @@ public void run() {
152152
};
153153
this.dispatch = run;
154154
AtomicBoolean dispatched = new AtomicBoolean(false);
155-
request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_DISPATCH, dispatched );
155+
request.getCoyoteRequest().action(ActionCode.ASYNC_DISPATCH, dispatched );
156156
if (!dispatched.get()) {
157157
try {
158158
doInternalDispatch();
@@ -398,7 +398,7 @@ public long getTimeout() {
398398
@Override
399399
public void setTimeout(long timeout) {
400400
this.timeout = timeout;
401-
request.getCoyoteRequest().action(ActionCode.ACTION_ASYNC_SETTIMEOUT,
401+
request.getCoyoteRequest().action(ActionCode.ASYNC_SETTIMEOUT,
402402
Long.valueOf(timeout));
403403
}
404404

0 commit comments

Comments
 (0)